GraphNode

A graph node.

Summary
GraphNodeA graph node.
Variables
dataThe node’s data being referenced.
arcsAn array of arcs connecting this node to other nodes.
markedA flag indicating whether the node is marked or not.
Functions
GraphNodeCreates a new graph node.
addArcAdds an arc to the current graph node, pointing to a different graph node and with a given weight.
removeArcRemoves the arc that points to the given node.
getArcFinds the arc that points to the given node.
Properties
numArcsThe number of arcs extending from this node.

Variables

data

public var data: *

The node’s data being referenced.

arcs

public var arcs: Array

An array of arcs connecting this node to other nodes.

marked

public var marked: Boolean

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

See Also

* @see Graph#breadthFirst

Functions

GraphNode

public function GraphNode(obj: *)

Creates a new graph node.

Parameters

objThe data to store inside the node. 

addArc

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

targetThe destination node the arc should point to.
weigthThe arc’s weight. 

removeArc

public function removeArc(target: GraphNode):Boolean

Removes the arc that points to the given node.

Returns

True if removal was successful, otherwise false. 

getArc

public function getArc(target: GraphNode):GraphArc

Finds the arc that points to the given node.

Parameters

param target The destination node. 

Returns

A GraphArc object or null if the arc doesn’t exist. 

Properties

numArcs

public function get numArcs():int

The number of arcs extending from this node.

public var data: *
The node’s data being referenced.
public var arcs: Array
An array of arcs connecting this node to other nodes.
public var marked: Boolean
A flag indicating whether the node is marked or not.
public function GraphNode(obj: *)
Creates a new graph node.
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.
public function removeArc(target: GraphNode):Boolean
Removes the arc that points to the given node.
public function getArc(target: GraphNode):GraphArc
Finds the arc that points to the given node.
public function get numArcs():int
The number of arcs extending from this node.
public function depthFirst(node: GraphNode,
visit: Function):void
Performs an iterative depth-first traversal starting at a given node.
Close