GODPAPER | All Packages | All Classes | Index | Frames No Frames |
GraphNode

Package | de.polygonal.ds
Class | public class GraphNode
Inheritance | GraphNode Object

A graph node.

Public Properties

| Property | Defined 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

| Method | Defined 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
|  | getArc(target:GraphNode):GraphArc 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

arcs | property

`public var arcs:Array`

An array of arcs connecting this node to other nodes.

data | property |

`public var data:*`

The node's data being referenced.

marked | property |

`public var marked:Boolean`

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

See also

Graph.depthFirst
Graph.breadthFirst

numArcs | property |

`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.

Thu Jan 16 2014, 01:11 PM +08:00