[ Index ]
 

Code source de PHP PEAR 1.4.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/Structures/Graph/ -> Node.php (sommaire)

This file contains the definition of the Structures_Graph_Node class

Poids: 338 lignes (11 kb)
Inclus ou requis: 6 fois
Référencé: 6 fois
Nécessite: 2 fichiers
 PEAR.php
 Structures/Graph.php

Définit 1 class

Structures_Graph_Node:: (15 méthodes):
  Structures_Graph_Node()
  getGraph()
  setGraph()
  getData()
  setData()
  metadataKeyExists()
  getMetadata()
  unsetMetadata()
  setMetadata()
  _connectTo()
  connectTo()
  getNeighbours()
  connectsTo()
  inDegree()
  outDegree()


Classe: Structures_Graph_Node  - X-Ref

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.

Structures_Graph_Node()   X-Ref
Constructor


getGraph()   X-Ref
Node graph getter

return: Structures_Graph    Graph where node is stored

setGraph(&$graph)   X-Ref
Node graph setter. This method should not be called directly. Use Graph::addNode instead.

param: Structures_Graph   Set the graph for this node.

getData()   X-Ref
Node data getter.

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

return: mixed    Data stored in node

setData($data)   X-Ref
Node data setter

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

return: mixed    Data to store in node

metadataKeyExists($key)   X-Ref
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.

param: string    Key to test
return: boolean    

getMetadata($key, $nullIfNonexistent = false)   X-Ref
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.

param: string  Key
param: boolean nullIfNonexistent (defaults to false).
return: mixed    Metadata Data stored in node under given key

unsetMetadata($key)   X-Ref
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.

param: string  Key

setMetadata($key, $data)   X-Ref
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.

param: string  Key
param: mixed   Data

_connectTo(&$destinationNode)   X-Ref
Pas de description

connectTo(&$destinationNode)   X-Ref
Connect this node to another one.

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

param: Structures_Graph Node to connect to

getNeighbours()   X-Ref
Return nodes connected to this one.

return: array   Array of nodes

connectsTo(&$target)   X-Ref
Test wether this node has an arc to the target node

return: boolean   True if the two nodes are connected

inDegree()   X-Ref
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: integer     In degree of the node

outDegree()   X-Ref
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: integer     Out degree of the node



Généré le : Sun Feb 25 14:08:00 2007 par Balluche grâce à PHPXref 0.7