Packagecom.yworks.yfiles.algo
Classpublic class NodeOrders
InheritanceNodeOrders Inheritance YObject Inheritance Object

Provides graph algorithms that order the nodes of a graph by a specific criterion.



Public Methods
 MethodDefined By
  
NodeOrders(init:Boolean = true)
NodeOrders
  
[static] Like dfsCompletion2() but the result is returned as a NodeList.
NodeOrders
  
dfsCompletion2(graph:Graph, order:Vector.<int>):void
[static] This method calculates a node order that is identical with the order of node completion events in a depth first search.
NodeOrders
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
NodeOrders
 Inherited
hashCode():int
YObject
  
[static]
NodeOrders
  
[static] Like st2() but the result is returned as a NodeList.
NodeOrders
  
st2(graph:Graph, stOrder:Vector.<int>):void
[static] Assigns an ST-order to the nodes of a biconnected graph.
NodeOrders
  
st3(graph:Graph, stOrder:Vector.<int>, stEdge:Edge):void
[static] Similar to st2().
NodeOrders
  
toNodeList(graph:Graph, order:Vector.<int>):NodeList
[static] Converts an array-based result yield by a method of this class to a NodeList that contains all nodes of the order in the correct sequence.
NodeOrders
  
toNodeMap(order:NodeList, result:NodeMap):void
[static] Copies a list-based result yield by a method of this class to a NodeMap.
NodeOrders
  
toNodeMap2(graph:Graph, order:Vector.<int>, result:NodeMap):void
[static] Copies an array-based result yield by a method of this class to a NodeMap that will provide values of basic type int.
NodeOrders
  
[static] Returns a topological node order of an acyclic graph.
NodeOrders
  
topological2(graph:Graph, order:Vector.<int>):Boolean
[static] Assigns a topological order to the nodes of an acyclic graph.
NodeOrders
Protected Methods
 MethodDefined By
  
NodeOrders
Constructor Detail
NodeOrders()Constructor
public function NodeOrders(init:Boolean = true)



Parameters
init:Boolean (default = true)
Method Detail
dfsCompletion()method
public static function dfsCompletion(graph:Graph):NodeList

Like dfsCompletion2() but the result is returned as a NodeList.

Parameters

graph:Graph

Returns
NodeList

See also

dfsCompletion2()method 
public static function dfsCompletion2(graph:Graph, order:Vector.<int>):void

This method calculates a node order that is identical with the order of node completion events in a depth first search. This order is a reversed topological order in case the input graph is acyclic.

Complexity O(graph.N()+graph.E())

Parameters

graph:Graph
 
order:Vector.<int>

See also

getClass()method 
override public function getClass():Class

Returns
Class
initNodeOrders()method 
protected final function initNodeOrders():void

newNodeOrders()method 
public static function newNodeOrders():NodeOrders

Returns
NodeOrders
st()method 
public static function st(graph:Graph):NodeList

Like st2() but the result is returned as a NodeList.

Parameters

graph:Graph

Returns
NodeList

See also

st2()method 
public static function st2(graph:Graph, stOrder:Vector.<int>):void

Assigns an ST-order to the nodes of a biconnected graph. An ST order (v_1,v_2,....,v_n) for a biconnected graph is a node order which guarantees that

  1. the first node S and the last node T are connected by an edge.
  2. For each node v_i in the order that are not S or T there are neighbors v_j and v_k with j < i and k > i.

Precondition tOrder.length == graph.N()

Precondition GraphChecker.isBiconnected(graph)

Complexity O(graph.N()+graph.E())

Parameters

graph:Graph — the graph being acted upon
 
stOrder:Vector.<int> — result value that holds for each node v the zero-based index within the calculated order, i.e stOrder[v.index()] == 5 means that v is the 6-th node within the order.

st3()method 
public static function st3(graph:Graph, stOrder:Vector.<int>, stEdge:Edge):void

Similar to st2(). Additionally, the edge between the first node S and the last node T of the returned ordering can be specified.

Parameters

graph:Graph
 
stOrder:Vector.<int>
 
stEdge:Edge — an edge that connects the first node of the ordering with the last node of the ordering.

See also

toNodeList()method 
public static function toNodeList(graph:Graph, order:Vector.<int>):NodeList

Converts an array-based result yield by a method of this class to a NodeList that contains all nodes of the order in the correct sequence.

Parameters

graph:Graph
 
order:Vector.<int>

Returns
NodeList
toNodeMap()method 
public static function toNodeMap(order:NodeList, result:NodeMap):void

Copies a list-based result yield by a method of this class to a NodeMap. The resulting NodeMap will provide for each node the index of the node within the given order. The index is of basic type int.

Parameters

order:NodeList
 
result:NodeMap

toNodeMap2()method 
public static function toNodeMap2(graph:Graph, order:Vector.<int>, result:NodeMap):void

Copies an array-based result yield by a method of this class to a NodeMap that will provide values of basic type int.

Parameters

graph:Graph
 
order:Vector.<int>
 
result:NodeMap

topological()method 
public static function topological(graph:Graph):NodeList

Returns a topological node order of an acyclic graph.

Precondition GraphChecker.isAcyclic(graph)

Complexity O(graph.N()+graph.E())

Parameters

graph:Graph

Returns
NodeList
topological2()method 
public static function topological2(graph:Graph, order:Vector.<int>):Boolean

Assigns a topological order to the nodes of an acyclic graph.

If the given graph is not acyclic then this method returns false leaving the contents of result topOrder unspecified.

A topological node order of an acyclic graph has the property that for each node v all of its successors have a higher rank in the order than v itself.

Precondition order.length == graph.N()

Complexity O(graph.N()+graph.E())

Parameters

graph:Graph — the graph being acted upon
 
order:Vector.<int> — result value that holds for each node v the zero-based index within the calculated order, i.e topOrder[v.index()] == 5 means that v is the 6-th node within the order.

Returns
Boolean