![]() |
Bearsampp 2026.9.23
|
Public Member Functions | |
| __construct () | |
| _connectTo (&$destinationNode) | |
| connectsTo (&$target) | |
| connectTo (&$destinationNode) | |
| & | getData () |
| & | getGraph () |
| & | getMetadata ($key, $nullIfNonexistent=false) |
| getNeighbours () | |
| inDegree () | |
| metadataKeyExists ($key) | |
| outDegree () | |
| setData (&$data) | |
| setGraph (&$graph) | |
| setMetadata ($key, &$data) | |
| unsetMetadata ($key) | |
Data Fields | |
| $_arcs = array() | |
| $_data = null | |
| $_graph = null | |
| $_metadata = array() | |
| _connectTo | ( | & | $destinationNode | ) |
@access private
Definition at line 223 of file Node.php.
Referenced by connectTo().
| connectsTo | ( | & | $target | ) |
Test wether this node has an arc to the target node
Definition at line 274 of file Node.php.
References getNeighbours().
Referenced by inDegree().
| connectTo | ( | & | $destinationNode | ) |
Connect this node to another one.
If the graph is not directed, the reverse arc, connecting $destinationNode to $this is also created.
| Structures_Graph_Node | Node to connect to @access public |
Definition at line 238 of file Node.php.
References _connectTo(), and STRUCTURES_GRAPH_ERROR_GENERIC.
| & getData | ( | ) |
| & getGraph | ( | ) |
Node graph getter
Definition at line 90 of file Node.php.
References $_graph.
| & getMetadata | ( | $key, | |
| $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.
| string | Key |
| boolean | nullIfNonexistent (defaults to false). |
Definition at line 171 of file Node.php.
References STRUCTURES_GRAPH_ERROR_GENERIC.
| getNeighbours | ( | ) |
Return nodes connected to this one.
Definition at line 261 of file Node.php.
References $_arcs.
Referenced by connectsTo().
| 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.
Definition at line 312 of file Node.php.
References $result, connectsTo(), and outDegree().
| metadataKeyExists | ( | $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.
| string | Key to test |
Definition at line 151 of file Node.php.
| 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.
Definition at line 336 of file Node.php.
References $_arcs.
Referenced by inDegree().
| setData | ( | & | $data | ) |
Node data setter
Each graph node can contain a reference to one variable. This is the setter for that reference.
Definition at line 134 of file Node.php.
Referenced by PEAR_Downloader\sortPackagesForInstall().
| setGraph | ( | & | $graph | ) |
| setMetadata | ( | $key, | |
| & | $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.
| string | Key |
| mixed | Data @access public |
Definition at line 216 of file Node.php.
| unsetMetadata | ( | $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.
| string | Key @access public |
Definition at line 198 of file Node.php.
| $_arcs = array() |
@access private
Definition at line 66 of file Node.php.
Referenced by getNeighbours(), and outDegree().
| $_graph = null |