C

TreeAnalysisResult

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

Gets whether or not the analyzed structure is a directed, rooted tree.
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.
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.
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.
readonlyfinal

See Also

Developer's Guide

Methods

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
Gets the depth of the node, that is, the length of the path between the root and node.
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
Gets all nodes that are descendants of root, including the edges that connect the descendants.
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

Subtree
A Subtree holding the descendant nodes of the given root and the edges connecting them.

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
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: INode
The nodes for which to find the nearest common ancestor.

Return Value

INode
The nearest ancestor of all given nodes or null if nodes is empty.

Throws

Exception ({ name: 'ArgumentError' })
If nodes contain null or 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.
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 null if nodes is empty.

Throws

Exception ({ name: 'ArgumentError' })
If nodes contain null or 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
Gets the parent node of the given tree node.
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 node or null if node is 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
Gets all nodes and edges of the subtree that has subtreeRoot as root.
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

Subtree
A Subtree holding the nodes and edges of the subtree rooted at the given subtreeRoot.

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