PHP Interface Gliph\Graph\Digraph

Inheritance: extends Gliph\Graph\Graph
Datei anzeigen Open project: sdboyer/gliph Interface Usage Examples

Public Methods

Method Description
arcsFrom ( $vertex ) : Generator Enumerates each out-arc from the provided vertex via a generator.
arcsTo ( $vertex ) : Generator Enumerates each in-arc from the provided vertex via a generator.
getCycles ( ) : array Returns the cycles in this graph, if any.
inDegreeOf ( object $vertex ) : integer Returns the in-degree (number of incoming edges) for the provided vertex.
isAcyclic ( ) : boolean Indicates whether or not this graph is acyclic.
outDegreeOf ( object $vertex ) : integer Returns the out-degree (count of outgoing edges) for the provided vertex.
predecessorsOf ( object $vertex ) : Generator Enumerates each predecessor vertex to the provided vertex via a generator.
successorsOf ( object $vertex ) : Generator Enumerates each successor vertex to the provided vertex via a generator.
transpose ( ) : Gliph\Graph\Digraph Returns the transpose of this graph.

Method Details

arcsFrom() public method

An arc is outbound from a vertex if that vertex is the 'tail' of the arc. Returns a generator that yields 2-tuple (array) where the first two values represent the vertex pair. Vertex order is guaranteed: the first vertex is the tail, and the second vertex is the head. 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).
See also: Digraph::arcsTo()
See also: Digraph::successorsOf()
See also: Graph::incidentTo() Note that, in set terms, g.incidentTo(x) == g.arcsFrom(x) ∪ g.arcsTo(x)
public arcsFrom ( $vertex ) : Generator
$vertex The vertex whose out-arcs should be visited.
return Generator A generator that yields out-arcs as values.

arcsTo() public method

An arc is inbound to a vertex if that vertex is the 'head' of the arc. Returns a generator that yields 2-tuple (array) where the first two values represent the vertex pair. Vertex order is guaranteed: the first vertex is the tail, and the second vertex is the head. 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).
See also: Digraph::arcsFrom()
See also: Digraph::predecessorsOf()
See also: Graph::incidentTo() Note that, in set terms, g.incidentTo(x) == g.arcsFrom(x) ∪ g.arcsTo(x)
public arcsTo ( $vertex ) : Generator
$vertex The vertex whose in-arcs should be visited.
return Generator A generator that yields in-arcs as values.

getCycles() public method

Returns the cycles in this graph, if any.
public getCycles ( ) : array
return array An array of arrays, each subarray representing a full cycle in the graph. If the array is empty, the graph is acyclic.

inDegreeOf() public method

In undirected graphs, in-degree and out-degree are the same.
public inDegreeOf ( object $vertex ) : integer
$vertex object The vertex for which to retrieve in-degree information.
return integer

isAcyclic() public method

Indicates whether or not this graph is acyclic.
public isAcyclic ( ) : boolean
return boolean

outDegreeOf() public method

In undirected graphs, in-degree and out-degree are the same.
public outDegreeOf ( object $vertex ) : integer
$vertex object The vertex for which to retrieve out-degree information.
return integer

predecessorsOf() public method

A vertex (B) is a predecessor to another vertex (A) if an arc points from B to A. In such an arc, B is considered the 'tail', A is considered the 'head', as it would be visually represented with an arrow: B -> A Note that, in set terms, g.adjacentTo(x) == g.successorsOf(x) ∪ g.predecessorsOf(x)
public predecessorsOf ( object $vertex ) : Generator
$vertex object The vertex whose predecessor vertices should be enumerated.
return Generator A generator that yields predecessor vertices as values.

successorsOf() public method

A vertex (B) is a successor to another vertex (A) if an arc points from A to B. In such an arc, A is considered the 'tail', B is considered the 'head', as it would be visually represented with an arrow: A -> B Note that, in set terms, g.adjacentTo(x) == g.successorsOf(x) ∪ g.predecessorsOf(x)
public successorsOf ( object $vertex ) : Generator
$vertex object The vertex whose successor vertices should be enumerated.
return Generator A generator that yields successor vertices as values.

transpose() public method

A transpose is identical to the current graph, except that its edges have had their directionality reversed. Transposed graphs are sometimes called the 'reverse' or 'converse'.
public transpose ( ) : Gliph\Graph\Digraph
return Gliph\Graph\Digraph