PHP Интерфейс Gliph\Graph\Graph

Показать файл Открыть проект

Открытые методы

Метод Описание
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.

Описание методов

adjacentTo() публичный Метод

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.
Результат Generator A generator that yields adjacent vertices as values.

degreeOf() публичный Метод

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.
Результат integer

edges() публичный Метод

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
Результат Generator A generator that produces a single value representing an edge on each iteration.

hasVertex() публичный Метод

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.
Результат boolean TRUE if the vertex is present, FALSE otherwise.

incidentTo() публичный Метод

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.
Результат Generator A generator that yields incident edges as values.

order() публичный Метод

Returns the number of vertices in the graph.
public order ( ) : integer
Результат integer

size() публичный Метод

Returns the number of edges in the graph.
public size ( ) : integer
Результат integer

vertices() публичный Метод

Returns a generator that loops through each vertex in the graph.
public vertices ( ) : Generator
Результат Generator A generator that yields vertices as values.