Packagecom.yworks.yfiles.layout.grouping
Classpublic class GraphGrouping
InheritanceGraphGrouping Inheritance YObject Inheritance Object

Instances of this class can be used by algorithms to efficiently query the structure of such type of graphs. The grouping information is provided through DataProviders, whose keys are defined in the GroupingKeys interface.



Public Properties
 PropertyDefined By
  graph : Graph
[read-only] Returns the Graph instance this object provides information for.
GraphGrouping
  layoutGraph : LayoutGraph
[read-only] Returns the LayoutGraph instance this object provides information for.
GraphGrouping
  root : Node
[read-only] Returns a node instance that can be used as a handle to the virtual root of the node hierarchy.
GraphGrouping
Public Methods
 MethodDefined By
  
GraphGrouping(graph:Graph, init:Boolean = true)
Creates a new instance of Grouping.
GraphGrouping
  
dispose():void
Disposes the data structures held by this instance.
GraphGrouping
 Inherited
equals(o:Object):Boolean
YObject
  
Returns the children of the given group node as a NodeList.
GraphGrouping
  
getClass():Class
[override]
GraphGrouping
  
Returns all descendants of the given group node as a NodeList.
GraphGrouping
  
Convenience method that returns a list of all Edges crossing the group node boundary of the given group node in such a way, that there target is inside the group node and the source does not lie inside the group node.
GraphGrouping
  
Convenience method that returns a list of all Edges crossing the group node boundary of the given group node in such a way, that there target is outside the group node and the source does not lie outside the group node.
GraphGrouping
  
Returns the nearest common ancestor in the hierarchy structure.
GraphGrouping
  
Returns the parent of the given node or null if the node is at the top of the hierarchy
GraphGrouping
  
Convenience method that returns a node that can be used to represent node in the group inGroup, that is either the node itself if it is an immediate child of inGroup, or a node that is a child of inGroup and an ancestor of node at the same time or null if neither of the latter applies.
GraphGrouping
  
hasChildren(v:Node):Boolean
Determines if the given node is a group node with children.
GraphGrouping
 Inherited
hashCode():int
YObject
  
isFlat(graph:Graph):Boolean
[static] A graph is considered to be flat if it is either not grouped or there is no group node that contains child nodes present in the graph.
GraphGrouping
  
isGrouped(graph:Graph):Boolean
[static] A graph is considered to be grouped if the three low-level grouping data providers com.yworks.yfiles.layout.grouping.GroupingKeys.GROUP_DPKEY, com.yworks.yfiles.layout.grouping.GroupingKeys.NODE_ID_DPKEY and com.yworks.yfiles.layout.grouping.GroupingKeys.PARENT_NODE_ID_DPKEY are registered.
GraphGrouping
  
isGroupNode(node:Node):Boolean
Determines if the given node is a group node.
GraphGrouping
  
isNormalEdge(e:Edge):Boolean
Determines if the given Edge is a normal edge, i.e.
GraphGrouping
  
[static] Creates a new instance of Grouping.
GraphGrouping
Protected Methods
 MethodDefined By
  
Factory method for a NodeMap
GraphGrouping
  
disposeInfoMap(graph:Graph, infoMap:NodeMap):void
Factory destructor method for a NodeMap
GraphGrouping
  
init():void
Initializes internal data structures.
GraphGrouping
  
Initializes this object.
GraphGrouping
Property Detail
graphproperty
graph:Graph  [read-only]

Returns the Graph instance this object provides information for.


Implementation
    public function get graph():Graph
layoutGraphproperty 
layoutGraph:LayoutGraph  [read-only]

Returns the LayoutGraph instance this object provides information for.

This Grouping instance must have been created with a com.yworks.yfiles.layout.LayoutGraph


Implementation
    public function get layoutGraph():LayoutGraph

See also

rootproperty 
root:Node  [read-only]

Returns a node instance that can be used as a handle to the virtual root of the node hierarchy. This handle can be given to the getChildren() method to obtain the nodes, that are at the top level of the hierarchy. The instance is *not* part of the graph.


Implementation
    public function get root():Node
Constructor Detail
GraphGrouping()Constructor
public function GraphGrouping(graph:Graph, init:Boolean = true)

Creates a new instance of Grouping. Grouping instances provide a convenient way for all kind of algorithms to traverse the node grouping hierarchy. The hierarchy is cached during the call to this constructor. It is build using the information bound to the graph using the DataProviders that are registered with the graph instance. Grouping instances hold a state that with the graph instance that should be disposed (dispose()) once the grouping instance is not needed anymore.

Parameters
graph:Graph
 
init:Boolean (default = true) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods. This parameter can safely be ignored/omitted when calling the constructor.

See also

Method Detail
createInfoMap()method
protected function createInfoMap(graph:Graph):NodeMap

Factory method for a NodeMap

Parameters

graph:Graph

Returns
NodeMap
dispose()method 
public function dispose():void

Disposes the data structures held by this instance. Calling this method renders this instance useless.

disposeInfoMap()method 
protected function disposeInfoMap(graph:Graph, infoMap:NodeMap):void

Factory destructor method for a NodeMap

Parameters

graph:Graph
 
infoMap:NodeMap

getChildren()method 
public function getChildren(parent:Node):NodeList

Returns the children of the given group node as a NodeList.

Parameters

parent:Node

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

Returns
Class
getDescendants()method 
public function getDescendants(parent:Node):NodeList

Returns all descendants of the given group node as a NodeList.

Parameters

parent:Node — A group node. If null is given, the graph's root is used.

Returns
NodeList — A recursively built NodeList containing all descendants of the given group node.
getEdgesGoingIn()method 
public function getEdgesGoingIn(groupNode:Node):EdgeList

Convenience method that returns a list of all Edges crossing the group node boundary of the given group node in such a way, that there target is inside the group node and the source does not lie inside the group node.

Parameters

groupNode:Node

Returns
EdgeList
getEdgesGoingOut()method 
public function getEdgesGoingOut(groupNode:Node):EdgeList

Convenience method that returns a list of all Edges crossing the group node boundary of the given group node in such a way, that there target is outside the group node and the source does not lie outside the group node.

Parameters

groupNode:Node

Returns
EdgeList
getNearestCommonAncestor()method 
public function getNearestCommonAncestor(n1:Node, n2:Node):Node

Returns the nearest common ancestor in the hierarchy structure.

This method returns the nearest ancestor of n1 and n2 that contains both n1 and n2 or it returns root if no such node exists. In the special cases of n2 being a child of n1 (or vice versa) or if n1 == n2, the parent of n1 (or n2 respectively) is returned.

Parameters

n1:Node — one of the two nodes whose common ancestor is determined.
 
n2:Node — one of the two nodes whose common ancestor is determined.

Returns
Node — The nearest common ancestor node, or root .

See also

getParent()method 
public function getParent(node:Node):Node

Returns the parent of the given node or null if the node is at the top of the hierarchy

Parameters

node:Node

Returns
Node
getRepresentative()method 
public function getRepresentative(node:Node, inGroup:Node):Node

Convenience method that returns a node that can be used to represent node in the group inGroup, that is either the node itself if it is an immediate child of inGroup, or a node that is a child of inGroup and an ancestor of node at the same time or null if neither of the latter applies.

Parameters

node:Node — the node for which a representative will be returned
 
inGroup:Node — the group to which the representative should belong.

Returns
Node
hasChildren()method 
public function hasChildren(v:Node):Boolean

Determines if the given node is a group node with children.

Parameters

v:Node

Returns
Boolean
init()method 
protected function init():void

Initializes internal data structures. The state of the graph at the moment of this method invocation will be reflected by this instance.

initGraphGrouping()method 
protected final function initGraphGrouping(graph:Graph):void

Initializes this object. See the documentation of the corresponding factory method newGraphGrouping() for details.

Parameters

graph:Graph

See also

isFlat()method 
public static function isFlat(graph:Graph):Boolean

A graph is considered to be flat if it is either not grouped or there is no group node that contains child nodes present in the graph. This method determines whether a graph is flat

Parameters

graph:Graph

Returns
Boolean
isGrouped()method 
public static function isGrouped(graph:Graph):Boolean

A graph is considered to be grouped if the three low-level grouping data providers com.yworks.yfiles.layout.grouping.GroupingKeys.GROUP_DPKEY, com.yworks.yfiles.layout.grouping.GroupingKeys.NODE_ID_DPKEY and com.yworks.yfiles.layout.grouping.GroupingKeys.PARENT_NODE_ID_DPKEY are registered.

An instance of this class requires its graph to be grouped.

Parameters

graph:Graph

Returns
Boolean

See also

isGroupNode()method 
public function isGroupNode(node:Node):Boolean

Determines if the given node is a group node. Group nodes *may* have children. Normal nodes never have children.

Parameters

node:Node

Returns
Boolean
isNormalEdge()method 
public function isNormalEdge(e:Edge):Boolean

Determines if the given Edge is a normal edge, i.e. whether it does not cross any group node boundaries.

Parameters

e:Edge

Returns
Boolean
newGraphGrouping()method 
public static function newGraphGrouping(graph:Graph):GraphGrouping

Creates a new instance of Grouping. Grouping instances provide a convenient way for all kind of algorithms to traverse the node grouping hierarchy. The hierarchy is cached during the call to this constructor. It is build using the information bound to the graph using the DataProviders that are registered with the graph instance. Grouping instances hold a state that with the graph instance that should be disposed (dispose()) once the grouping instance is not needed anymore.

Parameters

graph:Graph

Returns
GraphGrouping

See also