This class provides convenient and efficient access to the hierarchic graph structure.
Remarks
The grouping information is provided through IDataProviders registered with the graph with keys NODE_ID_DP_KEY, PARENT_NODE_ID_DP_KEY and GROUP_DP_KEY. It describes the hierarchy as a tree where a group node is the parent of the nodes that it contains.
Type Details
- yfiles module
- algorithms
- yfiles-umd modules
- All layout modules, view-layout-bridge
- Legacy UMD name
- yfiles.layout.GroupingSupport
Constructors
Creates a new LayoutGroupingSupport instance that represents the hierarchy of the graph.
Remarks
Parameters
A map of options to pass to the method.
- graph - Graph
- the graph instance from which the hierarchy information is obtained
Properties
Gets the Graph instance for which this LayoutGroupingSupport object provides hierarchy information.
Gets a YNode instance associated with the virtual root of the hierarchy tree.
Remarks
See Also
Methods
Disposes of all internal data structures held by this instance.
Remarks
Disposes of the INodeMap created to store hierarchy information for each node.
Remarks
Parameters
A map of options to pass to the method.
- graph - Graph
- the current graph
- infoMap - INodeMap
- the INodeMap which contains the hierarchy information for each node
Domain YNode the nodes of the graph Values Object an internal object that holds the hierarchy information
See Also
Returns the direct children of the given group node.
Remarks
Parameters
A map of options to pass to the method.
- parent - YNode
- the group node
Returns
- ↪YNodeList
- a set of child nodes of the given parent node
See Also
Sample Graphs
Returns all descendants of the given group node.
Remarks
All nodes in the subtree rooted at this group node are collected recursively.
If the virtual root of the hierarchy tree is passed, all nodes in the graph are returned.
Parameters
A map of options to pass to the method.
- parent - YNode
- the group node
Returns
- ↪YNodeList
- a set of nodes that belong to a subtree of the hierarchy tree rooted at the given parent
See Also
Sample Graphs
Returns all edges crossing the bounds of the given group node such that their targets are inside the group node while their sources lie outside the group node.
Returns all edges crossing the bounds of the given group node such that their sources are inside the group node while their targets lie outside the group node.
Returns the nearest common ancestor of the given nodes in the hierarchy structure.
Remarks
The nearest common ancestor is the local root of the smallest subtree in the hierarchy tree that contains both nodes. This group is the first node that contains these two nodes. If no such node exists, the virtual root is returned.
Common ancestors in special cases:
node1 == node2
: the parent ofnode1
/node2
node1 is parent of node2
: the parent ofnode1
node2 is parent of node1
: the parent ofnode2
Parameters
A map of options to pass to the method.
- node1 - YNode
- one of the two nodes whose common ancestor is determined
- node2 - YNode
- one of the two nodes whose common ancestor is determined
Returns
Sample Graphs
Returns the parent for the given node.
Remarks
Parameters
A map of options to pass to the method.
- node - YNode
- the node for which the parent is determined
Returns
- ↪YNode
- the parent of the given node or
null
for a top-level node
Throws
- Exception({ name: 'ArgumentError' })
- if the given node is
null
See Also
Returns an immediate child of the group node that represents the given node.
Remarks
Parameters
A map of options to pass to the method.
- node - YNode
- the node for which a representative is searched
- group - YNode
- the group node to which the representative should belong
Returns
- ↪YNode
- the representative or
null
if the node is not a descendant of the group
Throws
- Exception({ name: 'ArgumentError' })
- if the given node is
null
Sample Graphs
Determines whether or not the given node is a group node with children.
Remarks
Parameters
A map of options to pass to the method.
- node - YNode
- the potential parent
Returns
- ↪boolean
true
if the given node has children,false
otherwise
See Also
Initializes internal data structures.
Remarks
See Also
Determines whether or not the given node is a group node.
Remarks
Parameters
A map of options to pass to the method.
- node - YNode
- the potential group node
Returns
- ↪boolean
true
if the given node is a group node or isnull
,false
otherwise
See Also
Determines whether or not the given edge is a normal edge as opposed to an edge that crosses any group node bounds.
Remarks
Parameters
A map of options to pass to the method.
- edge - Edge
- the edge to check
Returns
- ↪boolean
true
if the given edge is normal,false
otherwise
See Also
Static Methods
Returns whether or not the given graph is flat.
Remarks
Parameters
A map of options to pass to the method.
- graph - Graph
- the input graph
Returns
- ↪boolean
true
if there are no groups or only empty groups in the graph,false
otherwise
See Also
Returns whether or not the given graph is grouped.
Remarks
Parameters
A map of options to pass to the method.
- graph - Graph
- the input graph
Returns
- ↪boolean
true
if the graph contains hierarchic information,false
otherwise