| Package | org.un.flex.graphLayout.data |
| Interface | public interface IGraph |
| Implementors | Graph |
| Property | Defined by | ||
|---|---|---|---|
| edges : Array [read-only]
An Array that contains all edges of the graph.
| IGraph | ||
| id : String [read-only]
The id (or name) of the graph
| IGraph | ||
| isDirectional : Boolean [read-only]
Indicator if the graph is directional or not.
| IGraph | ||
| nodes : Array [read-only]
An Array that contains all nodes of the graph.
| IGraph | ||
| nodeSortFunction : Function
Provide a method to sort nodes in a graph.
| IGraph | ||
| noEdges : int [read-only]
The number of edges in the graph.
| IGraph | ||
| noNodes : int [read-only]
The number of nodes in the graph.
| IGraph | ||
| walkingDirection : int
This determines the walking direction when building
a spanning tree.
| IGraph | ||
| Method | Defined by | ||
|---|---|---|---|
|
createNode(sid:String = "", o:Object = null):INode
Creates a graph node in the graph, optionally takes a string
id for the node and an object to associate the node with.
| IGraph | ||
|
Find an edge between two nodes.
| IGraph | ||
|
returns the current BFS tree of the graph, rooted in the given node,
optionally the tree is restricted to only contain currently visible
nodes.
| IGraph | ||
|
initFromXML(xml:XML, xmlnames:Array):void
Creates a graph from XML.
| IGraph | ||
|
Link two nodes together (i.e.
| IGraph | ||
|
A lookup to find a node by it's (int) id.
| IGraph | ||
|
nodeByStringId(sid:String):INode
A lookup to find a node by it's string id.
| IGraph | ||
|
purgeGraph():void
Remove all edges and nodes from the Graph.
| IGraph | ||
|
purgeTrees():void
Under certain circumstances all cached trees need
to be purged.
| IGraph | ||
|
removeEdge(e:IEdge):void
Removes an edge between two nodes.
| IGraph | ||
|
removeNode(n:INode):void
Removes a node from the graph.
| IGraph | ||
|
Unlink two nodes, effectively removing the edge between
them.
| IGraph | ||
| edges | property |
edges:Array [read-only]An Array that contains all edges of the graph.
Implementation public function get edges():Array
| id | property |
id:String [read-only]The id (or name) of the graph
Implementation public function get id():String
| isDirectional | property |
isDirectional:Boolean [read-only]Indicator if the graph is directional or not.
Implementation public function get isDirectional():Boolean
| nodes | property |
nodes:Array [read-only]An Array that contains all nodes of the graph.
Implementation public function get nodes():Array
| nodeSortFunction | property |
nodeSortFunction:Function [read-write]Provide a method to sort nodes in a graph. This can be used by GTree when building a spanning tree. The function must be compatible with a function to sort an Array.
The default value is null.
public function get nodeSortFunction():Function
public function set nodeSortFunction(value:Function):void
See also
| noEdges | property |
noEdges:int [read-only]The number of edges in the graph.
Implementation public function get noEdges():int
| noNodes | property |
noNodes:int [read-only]The number of nodes in the graph.
Implementation public function get noNodes():int
| walkingDirection | property |
walkingDirection:int [read-write]This determines the walking direction when building a spanning tree. Possible values are Graph.WALK_FORWARD Graph.WALK_BACKWARDS Graph.WALK_BOTH All make only sense in a directional graph. Forward means we follow edges in its regular direction from the root node. Backwards means, we follow edges back from the root node (e.g. the root is a sink with multiple sources) Both obviously means both. This property will be queried by GTree to determine the walking direction set.
Implementation public function get walkingDirection():int
public function set walkingDirection(value:int):void
| createNode | () | method |
public function createNode(sid:String = "", o:Object = null):INodeCreates a graph node in the graph, optionally takes a string id for the node and an object to associate the node with.
Parameterssid:String (default = "") — A unique string id for the node (if empty the numerical id will be used).
|
|
o:Object (default = null) — Dataobject to be associated with this node.
|
INode —
The created node object.
|
— if the string id was already used before (must be unique).
|
| getEdge | () | method |
public function getEdge(n1:INode, n2:INode):IEdgeFind an edge between two nodes.
Parametersn1:INode — The first node of the edge.
|
|
n2:INode — The second node of the edge.
|
IEdge —
The resulting edge or null if the nodes were not linked.
|
| getTree | () | method |
public function getTree(n:INode, restr:Boolean = false, nocache:Boolean = false):IGTreereturns the current BFS tree of the graph, rooted in the given node, optionally the tree is restricted to only contain currently visible nodes. The trees are cached, that means a tree is only created once and then stored in a map, unless the "nocache" flag is set! If the flag is set, then the tree will be created once and returned, the existing cache will not be touched or overwritten, this is useful if a full tree is needed for a specific purpose but the cache should not be overwritten or consulted.
Parametersn:INode — The root node of the tree.
|
|
restr:Boolean (default = false) — This flag specifies if the resulting tree should be restricted to currently visible nodes.
|
|
nocache:Boolean (default = false) — If set, always a new tree will be created and returned and the cache will be untouched.
|
IGTree —
The a GTree object that contains the tree.
|
| initFromXML | () | method |
public function initFromXML(xml:XML, xmlnames:Array):void
Creates a graph from XML.
The XML you provide should contain 2 kinds of elements
<Node id="xxx" anything-else..../>
and
<Edge fromID="xxx" toID="yyy"/>
You can have additional tags, and/or nest the tags any way you like; this will not have any effect. We create a graph where each Item corresponds to a single node. The item's id will come from the Node's id attribute (make sure this is unique). The item's data will be the Node, and will be of type XML. The <Edge> elements must come fterthe corresponding <Node> elements have appeared. The xmlnames array must have 4 elements:
xml:XML — an XML document containing Node and Edge elements.
|
|
xmlnames:Array — the XML element and attribute names to use when parsing an XML dataProvider.
|
| link | () | method |
public function link(node1:INode, node2:INode, o:Object = null):IEdgeLink two nodes together (i.e. create an edge). If the graph is NOT directional the same edge will be incoming and outgoing for both nodes. If the nodes are already linked, it will just return the existing edge between them.
Parametersnode1:INode — First node to be linked.
|
|
node2:INode — Second node to be linked.
|
|
o:Object (default = null) — Optional data object to be associated with the resulting edge.
|
IEdge —
The resulting edge.
|
— if any node is null.
|
| nodeById | () | method |
public function nodeById(id:int):INodeA lookup to find a node by it's (int) id.
Parametersid:int — The node's id.
|
INode —
The node if one was found, null otherwise.
|
| nodeByStringId | () | method |
public function nodeByStringId(sid:String):INodeA lookup to find a node by it's string id.
Parameterssid:String — The node's string id.
|
INode —
The node if one was found, null otherwise.
|
| purgeGraph | () | method |
public function purgeGraph():voidRemove all edges and nodes from the Graph.
| purgeTrees | () | method |
public function purgeTrees():voidUnder certain circumstances all cached trees need to be purged.
| removeEdge | () | method |
public function removeEdge(e:IEdge):voidRemoves an edge between two nodes.
Parameterse:IEdge — The edge to be removed.
|
— error if the edge was not part of the graph.
|
| removeNode | () | method |
public function removeNode(n:INode):voidRemoves a node from the graph. If the node is part of any edge, and error is thrown (i.e. edges must be removed/nodes unlinked first).
Parametersn:INode — The node object to be removed.
|
— error if the node is still part of any edge.
|
|
— error if the node to be removed cannot be found in the graph.
|
|
— error if there exists still a vnode associated with this node.
|
| unlink | () | method |
public function unlink(node1:INode, node2:INode):voidUnlink two nodes, effectively removing the edge between them.
Parametersnode1:INode — The first node to be unlinked.
|
|
node2:INode — The second node to be unlinked.
|
— error if the nodes were not linked before.
|