PHP Interface Gliph\Graph\Graph

Datei anzeigen Open project: sdboyer/gliph

Public Methods

Method Description
adjacentTo ( object $vertex ) : Generator Enumerates each vertex adjacent to the provided vertex via a generator.
degreeOf ( object $vertex ) : integer Returns the degree (number of incident edges) for the provided vertex.
edges ( ) : Generator Loops over each edge in the graph via a generator.
hasVertex ( object $vertex ) : boolean Indicates whether or not the provided vertex is present in the graph.
incidentTo ( $vertex ) : Generator Enumerates each edge incident to the provided vertex via a generator.
order ( ) : integer Returns the number of vertices in the graph.
size ( ) : integer Returns the number of edges in the graph.
vertices ( ) : Generator Returns a generator that loops through each vertex in the graph.

Method Details

adjacentTo() public method

A vertex is adjacent to another vertex if they share an edge. Edge direction, if any, does not matter. The generator yields only a value: the adjacent vertex.
public adjacentTo ( object $vertex ) : Generator
$vertex object The vertex whose adjacent vertices should be visited.
return Generator A generator that yields adjacent vertices as values.

degreeOf() public method

Returns the degree (number of incident edges) for the provided vertex.
public degreeOf ( object $vertex ) : integer
$vertex object The vertex for which to retrieve degree information.
return integer

edges() public method

Different graphs may represent the edge in different ways. A graph with a simple edge concept - e.g., no edge weighting or typing, etc. - may represent the edge as a 2-tuple (an indexed array with two elements). More complex edges may be represented as an object. If no additional information is provided by the method implementation's phpdoc, a 2-tuple should be assumed.
public edges ( ) : Generator
return Generator A generator that produces a single value representing an edge on each iteration.

hasVertex() public method

Indicates whether or not the provided vertex is present in the graph.
public hasVertex ( object $vertex ) : boolean
$vertex object The vertex object to check for membership in the graph.
return boolean TRUE if the vertex is present, FALSE otherwise.

incidentTo() public method

A vertex is incident to an edge if that edge connects to it. Edge direction, if any, does not matter. Returns a generator that yields 2-tuple (array) where the first two values represent the vertex pair. Vertex order is neither guaranteed nor implied, as edges are an unordered pair. If the graph has additional edge data (e.g., weight), additional elements are appended to the edge array as needed. (See implementation-specific documentation for more detail).
public incidentTo ( $vertex ) : Generator
$vertex The vertex whose incident edges should be visited.
return Generator A generator that yields incident edges as values.

order() public method

Returns the number of vertices in the graph.
public order ( ) : integer
return integer

size() public method

Returns the number of edges in the graph.
public size ( ) : integer
return integer

vertices() public method

Returns a generator that loops through each vertex in the graph.
public vertices ( ) : Generator
return Generator A generator that yields vertices as values.