| Package | org.un.flex.graphLayout.data |
| Class | public class GTree |
| Implements | IGTree |
It stores the predecessors of each node to allow the traversal and also the distance of each node to the root.
| Property | Defined by | ||
|---|---|---|---|
| distances : Dictionary [read-only]
The map that contains the distance for each node (keys are node objects,
values are integers that indicate the distance (in hops) from the root node
| GTree | ||
| maxDepth : int [read-only]
The maximum depth of the tree, which is the maximum distance
of any node from the root
| GTree | ||
| maxNumberPerLayer : uint [read-only]
| GTree | ||
| parents : Dictionary [read-only]
The map (Dictionary) that contains the parents for each node (keys are node
objects, with their parent node objects as values).
| GTree | ||
| restricted : Boolean [read-only]
Indicating flag if the returned tree is restricted to currently invisible nodes.
| GTree | ||
| root : INode
access to the current root node of the tree.
| GTree | ||
| XMLtree : XML [read-only]
Returns a nested XML representation of the tree.
| GTree | ||
| Method | Defined by | ||
|---|---|---|---|
|
Constructor to create a new GTree object, the tree will not immediately
be initialised, but this will happen as soon as any attributes or methods
are accessed, that require the tree to be initialised (late initialisation).
| GTree | ||
|
Checks if two nodes are siblings or not.
| GTree | ||
|
getChildIndex(n:INode):int
Each node is also the i'th child of it's parent.
| GTree | ||
|
getChildren(n:INode):Array
An array that contains all children of this node
in the tree in the order of each child's child index.
| GTree | ||
|
getDistance(n:INode):int
Get the distance of a particular node from the root.
| GTree | ||
|
This method returns the node, which is the i'th child
of a given (parent) node.
| GTree | ||
|
getLimitedNodes(limit:int):Dictionary
This method returns a map (Object) containing only
the nodes which are within a certain distance of the
root node.
| GTree | ||
|
getNoChildren(n:INode):int
The number of children of any node in the tree.
| GTree | ||
|
getNoSiblings(n:INode):int
Returns the number of siblings of a node, including the node itself
so basically this is the number of the children of the node's parents.
| GTree | ||
|
getNumberNodesWithDistance(d:uint):uint
This returns the number of nodes that have exactly
the specified distance.
| GTree | ||
|
initTree():Dictionary
This initialiases the (spanning) tree
using BFS (Breadth first search).
| GTree | ||
| distances | property |
distances:Dictionary [read-only]The map that contains the distance for each node (keys are node objects, values are integers that indicate the distance (in hops) from the root node
Implementation public function get distances():Dictionary
| maxDepth | property |
maxDepth:int [read-only]The maximum depth of the tree, which is the maximum distance of any node from the root
Implementation public function get maxDepth():int
| maxNumberPerLayer | property |
maxNumberPerLayer:uint [read-only]Implementation
public function get maxNumberPerLayer():uint
| parents | property |
parents:Dictionary [read-only]The map (Dictionary) that contains the parents for each node (keys are node objects, with their parent node objects as values).
Implementation public function get parents():Dictionary
| restricted | property |
restricted:Boolean [read-only]Indicating flag if the returned tree is restricted to currently invisible nodes.
Implementation public function get restricted():Boolean
| root | property |
root:INode [read-write]access to the current root node of the tree. If a new root node is set, this means the tree has to be recalculated.
Implementation public function get root():INode
public function set root(value:INode):void
| XMLtree | property |
XMLtree:XML [read-only]
Returns a nested XML representation of the tree.
It will only contain
public function get XMLtree():XML
| GTree | () | constructor |
public function GTree(root:INode, graph:IGraph, restrict:Boolean = false)Constructor to create a new GTree object, the tree will not immediately be initialised, but this will happen as soon as any attributes or methods are accessed, that require the tree to be initialised (late initialisation).
Parametersroot:INode — The root node of the tree.
|
|
graph:IGraph — The graph that this tree is a subset of.
|
|
restrict:Boolean (default = false) — A flag to indicate that the resulting tree should be restricted to currently invisible nodes.
|
| areSiblings | () | method |
public function areSiblings(n:INode, m:INode):BooleanChecks if two nodes are siblings or not.
Parametersn:INode — First node to check.
|
|
m:INode — Potential sibling of n.
|
Boolean — True if the nodes are siblings, false otherwise.
|
| getChildIndex | () | method |
public function getChildIndex(n:INode):intEach node is also the i'th child of it's parent. This index is called the child index. The child index of each node is stored and can be looked up by this method.
Parametersn:INode — The node lookup its child index.
|
int — The child index of this node.
|
| getChildren | () | method |
public function getChildren(n:INode):ArrayAn array that contains all children of this node in the tree in the order of each child's child index.
Parametersn:INode — The parent node.
|
Array — The array of children of the given node.
|
| getDistance | () | method |
public function getDistance(n:INode):intGet the distance of a particular node from the root.
Parametersn:INode — The node object for which the distance is requested.
|
int — The distance from the root in hops.
|
| getIthChildPerNode | () | method |
public function getIthChildPerNode(n:INode, i:int):INodeThis method returns the node, which is the i'th child of a given (parent) node. Note that 'i' starts with 0, i.e. the frist child is actually the 0th child.
Parametersn:INode — The parent node.
|
|
i:int — The child index of the desired child.
|
INode —
The node which is it the i'th child of node n.
|
| getLimitedNodes | () | method |
public function getLimitedNodes(limit:int):DictionaryThis method returns a map (Object) containing only the nodes which are within a certain distance of the root node.
Parameterslimit:int — The distance limit.
|
Dictionary — An object containing a map of node id's which are within the distance limit.
|
| getNoChildren | () | method |
public function getNoChildren(n:INode):intThe number of children of any node in the tree.
Parametersn:INode — parent node.
|
int — The number of its children.
|
| getNoSiblings | () | method |
public function getNoSiblings(n:INode):intReturns the number of siblings of a node, including the node itself so basically this is the number of the children of the node's parents. If the node has no parent, it is the root node and therefore the number of its sibling including itself is 1.
Parametersn:INode — The node for which its number of siblings is required.
|
int — The number of of siblings plus the node itself.
|
| getNumberNodesWithDistance | () | method |
public function getNumberNodesWithDistance(d:uint):uintThis returns the number of nodes that have exactly the specified distance.
Parametersd:uint — The distance from the root.
|
uint — The number of nodes in the tree with distance d.
|
| initTree | () | method |
public function initTree():DictionaryThis initialiases the (spanning) tree using BFS (Breadth first search).
ReturnsDictionary — The map that contains each node's parent node.
|