Represents the analysis result computed by TreeAnalysis.
Inheritance Hierarchy
Remarks
This class cannot be instantiated
See Also
Developer's Guide
Members
No filters for this type
Properties
If
true, the tree structure is directed and no edges were reversed (i.e. reversedEdges is empty). If false, the analyzed graph is an undirected tree where it was necessary to reverse some edges in order to view it as a directed tree rooted at root.readonlyfinal
See Also
Developer's Guide
Gets all leaf nodes of the tree.
Gets all leaf nodes of the tree.
Leaf nodes are nodes without outgoing edges.
readonlyfinal
Property Value
An IEnumerable<T> of leaf nodes in the tree.
See Also
Developer's Guide
Gets the edges that would need to be reversed in order to make the graph a directed, rooted tree.
Gets the edges that would need to be reversed in order to make the graph a directed, rooted tree.
Note that the direction that yields a directed tree is the one which is considered for other queries on this result. For example, when querying the getParent of a certain node and if the edge to the parent is a reversed one, then the direction in the original graph is actually such that the parent is a successor of the node.
readonlyfinal
See Also
Developer's Guide
Gets the root of the tree.
Gets the root of the tree.
readonlyfinal
See Also
Developer's Guide
Methods
Gets the child nodes of the given node in the tree.
Gets the child nodes of the given node in the tree.
If the edge connecting a child with
node is part of the reversedEdges, then the original edge direction is such that the child is actually a predecessor of node.final
Parameters
- node: INode
- The parent node to get children from.
Return Value
- ResultItemCollection<INode>
- An IEnumerable<T> of
node's children.
Throws
- Exception ({ name: 'ArgumentError' })
- If the given node was not part of the graph at the time the analysis was invoked via run
Complexity
O(|V|)
See Also
Developer's Guide
Nodes with the same depth are commonly drawn in the same layers in typical tree visualizations.
final
Parameters
- node: INode
- The node to determine the depth for.
Return Value
- number
- The distance between the root node and
node.
Throws
- Exception ({ name: 'ArgumentError' })
- If the given node was not part of the graph at the time the analysis was invoked via run
Complexity
O(1)
See Also
Developer's Guide
The result's nodes collection does not contain the given root node itself. If this is desired, use method getSubtree instead. Note that the result elements provided by this method do not yield a connected graph structure if the given root node has multiple direct child nodes.
final
Parameters
- root: INode
- The root node for which the descendants should be queried.
Return Value
Throws
- Exception ({ name: 'ArgumentError' })
- If the given node was not part of the graph at the time the analysis was invoked via run
Complexity
O(|V|)
See Also
Developer's Guide
Note that each node is considered to be its own ancestor so the returned node may be one of
nodes. Another way to look at this is to picture the result to be the root of the smallest subtree that contains all nodes.final
Parameters
- nodes: INode
- The nodes for which to find the nearest common ancestor.
Return Value
- INode
- The nearest ancestor of all given nodes or
nullifnodesis empty.
Throws
- Exception ({ name: 'ArgumentError' })
- If
nodescontainnullor if one of the nodes was not part of the graph at the time the analysis was invoked via run.
Complexity
O(|V|)
Determines the nearest common ancestor for the given nodes.
Determines the nearest common ancestor for the given nodes.
Note that each node is considered to be its own ancestor so the returned node may be one of
nodes. Another way to look at this is to picture the result to be the root of the smallest subtree that contains all nodes.final
Parameters
- nodes: IEnumerable<INode>
- The nodes for which to find the nearest common ancestor.
Return Value
- INode
- The nearest ancestor of all given nodes or
nullifnodesis empty.
Throws
- Exception ({ name: 'ArgumentError' })
- If
nodescontainnullor if one of the nodes was not part of the graph at the time the analysis was invoked via run.
Complexity
O(|V|)
See Also
Developer's Guide
If the edge connecting the node with its parent is part of the reversedEdges, then the original edge direction is such that the parent is a successor of the node.
final
Parameters
- node: INode
- The child node to determine the parent of.
Return Value
- INode
- The parent node of
nodeornullifnodeis the root of the tree.
Throws
- Exception ({ name: 'ArgumentError' })
- If the given node was not part of the graph at the time the analysis was invoked via run
Complexity
O(1)
See Also
Developer's Guide
The result contains the root node itself and the edges adjacent to it. To only get all descendants of the given node, use method getDescendants instead.
final
Parameters
- subtreeRoot: INode
- The subtree root node.
Return Value
Throws
- Exception ({ name: 'ArgumentError' })
- If the given node was not part of the graph at the time the analysis was invoked via run
Complexity
O(|V|)
See Also
Developer's Guide