Structures_Graph
[ class tree: Structures_Graph ] [ index: Structures_Graph ] [ all elements ]

Class: Structures_Graph_Node

Source Location: /Structures_Graph-1.1.1/Structures/Graph/Node.php

Class Overview


The Structures_Graph_Node class represents a Node that can be member of a graph node set.


Author(s):

Methods


Inherited Variables

Inherited Methods


Class Details

[line 57]
The Structures_Graph_Node class represents a Node that can be member of a graph node set.

A graph node can contain data. Under this API, the node contains default data, and key index data. It behaves, thus, both as a regular data node, and as a dictionary (or associative array) node.

Regular data is accessed via getData and setData. Key indexed data is accessed via getMetadata and setMetadata.



[ Top ]


Method Detail

__construct (Constructor)   [line 78]

Structures_Graph_Node __construct( )

Constructor
  • Access: public

[ Top ]

connectsTo   [line 274]

boolean connectsTo( &$target)

Test wether this node has an arc to the target node
  • Return: True if the two nodes are connected
  • Access: public

Parameters:

   &$target   — 

[ Top ]

connectTo   [line 238]

void connectTo( Structures_Graph_Node &$destinationNode)

Connect this node to another one.

If the graph is not directed, the reverse arc, connecting $destinationNode to $this is also created.

  • Access: public

Parameters:

Structures_Graph_Node   &$destinationNode   —  Node to connect to

[ Top ]

getData   [line 119]

mixed &getData( )

Node data getter.

Each graph node can contain a reference to one variable. This is the getter for that reference.

  • Return: Data stored in node
  • Access: public

[ Top ]

getGraph   [line 90]

Structures_Graph &getGraph( )

Node graph getter
  • Return: Graph where node is stored
  • Access: public

[ Top ]

getMetadata   [line 171]

mixed &getMetadata( string $key, [boolean $nullIfNonexistent = false])

Node metadata getter

Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an associative array or in a dictionary. This method gets the data under the given key. If the key does not exist, an error will be thrown, so testing using metadataKeyExists might be needed.


Parameters:

string   $key   —  Key
boolean   $nullIfNonexistent   —  nullIfNonexistent (defaults to false).

[ Top ]

getNeighbours   [line 261]

array getNeighbours( )

Return nodes connected to this one.
  • Return: Array of nodes
  • Access: public

[ Top ]

inDegree   [line 312]

integer inDegree( )

Calculate the in degree of the node.

The indegree for a node is the number of arcs entering the node. For non directed graphs, the indegree is equal to the outdegree.

  • Return: In degree of the node
  • Access: public

[ Top ]

metadataKeyExists   [line 151]

boolean metadataKeyExists( string $key)

Test for existence of metadata under a given key.

Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an associative array or in a dictionary. This method tests whether a given metadata key exists for this node.

  • Access: public

Parameters:

string   $key   —  Key to test

[ Top ]

outDegree   [line 336]

integer outDegree( )

Calculate the out degree of the node.

The outdegree for a node is the number of arcs exiting the node. For non directed graphs, the outdegree is always equal to the indegree.

  • Return: Out degree of the node
  • Access: public

[ Top ]

setData   [line 134]

mixed setData( &$data)

Node data setter

Each graph node can contain a reference to one variable. This is the setter for that reference.

  • Return: Data to store in node
  • Access: public

Parameters:

   &$data   — 

[ Top ]

setGraph   [line 104]

void setGraph( Structures_Graph &$graph)

Node graph setter. This method should not be called directly. Use Graph::addNode instead.

Parameters:

Structures_Graph   &$graph   —  Set the graph for this node.

[ Top ]

setMetadata   [line 216]

void setMetadata( string $key, mixed &$data)

Node metadata setter

Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an associative array or in a dictionary. This method stores data under the given key. If the key already exists, previously stored data is discarded.

  • Access: public

Parameters:

string   $key   —  Key
mixed   &$data   —  Data

[ Top ]

unsetMetadata   [line 198]

void unsetMetadata( string $key)

Delete metadata by key

Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an associative array or in a dictionary. This method removes any data that might be stored under the provided key. If the key does not exist, no error is thrown, so it is safe using this method without testing for key existence.

  • Access: public

Parameters:

string   $key   —  Key

[ Top ]


Documentation generated on Mon, 11 Mar 2019 16:02:45 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.