Packagede.polygonal.ds
Classpublic class GraphNode
InheritanceGraphNode Inheritance Object

A graph node.



Public Properties
 PropertyDefined By
  arcs : Array
An array of arcs connecting this node to other nodes.
GraphNode
  data : *
The node's data being referenced.
GraphNode
  marked : Boolean
A flag indicating whether the node is marked or not.
GraphNode
  numArcs : int
[read-only] The number of arcs extending from this node.
GraphNode
Public Methods
 MethodDefined By
  
GraphNode(obj:*)
Creates a new graph node.
GraphNode
  
addArc(target:GraphNode, weight:Number):void
Adds an arc to the current graph node, pointing to a different graph node and with a given weight.
GraphNode
  
Finds the arc that points to the given node.
GraphNode
  
removeArc(target:GraphNode):Boolean
Removes the arc that points to the given node.
GraphNode
Property Detail
arcsproperty
public var arcs:Array

An array of arcs connecting this node to other nodes.

dataproperty 
public var data:*

The node's data being referenced.

markedproperty 
public var marked:Boolean

A flag indicating whether the node is marked or not. Used by the depthFirst and breadthFirst methods only.

See also

numArcsproperty 
numArcs:int  [read-only]

The number of arcs extending from this node.


Implementation
    public function get numArcs():int
Constructor Detail
GraphNode()Constructor
public function GraphNode(obj:*)

Creates a new graph node.

Parameters
obj:* — The data to store inside the node.
Method Detail
addArc()method
public function addArc(target:GraphNode, weight:Number):void

Adds an arc to the current graph node, pointing to a different graph node and with a given weight.

Parameters

target:GraphNode — The destination node the arc should point to.
 
weight:Number — The arc's weight.

getArc()method 
public function getArc(target:GraphNode):GraphArc

Finds the arc that points to the given node.

Parameters

target:GraphNode — The destination node.

Returns
GraphArc — A GraphArc object or null if the arc doesn't exist.
removeArc()method 
public function removeArc(target:GraphNode):Boolean

Removes the arc that points to the given node.

Parameters

target:GraphNode

Returns
Boolean — True if removal was successful, otherwise false.