PHP Interface Trismegiste\Mondrian\Graph\Graph

A generic graph
Datei anzeigen Open project: trismegiste/mondrian Interface Usage Examples

Public Methods

Method Description
addEdge ( Vertex $source, Vertex $target ) Add a (un)directed edge if it does not already exist
addVertex ( Vertex $v ) Add a vertex to the graph without edge
getEdgeIterator ( Vertex $v ) : Iterator Get an iterator on edges for one vertex
getEdgeSet ( ) : array Get the edges set
getPartition ( ) Returns a list of subgraph
getSuccessor ( Vertex $v ) : null | array Get successors of a vertex
getVertexSet ( ) : array Get the vertices in the graph
searchEdge ( Vertex $source, Vertex $target ) : Edge Searches an existing (directed or not) edge between two vertices

Method Details

addEdge() public method

Add a (un)directed edge if it does not already exist
public addEdge ( Vertex $source, Vertex $target )
$source Vertex
$target Vertex

addVertex() public method

Add a vertex to the graph without edge
public addVertex ( Vertex $v )
$v Vertex

getEdgeIterator() public method

Get an iterator on edges for one vertex
public getEdgeIterator ( Vertex $v ) : Iterator
$v Vertex
return Iterator

getEdgeSet() public method

Get the edges set
public getEdgeSet ( ) : array
return array

getPartition() public method

Returns a list of subgraph
public getPartition ( )

getSuccessor() public method

Get successors of a vertex
public getSuccessor ( Vertex $v ) : null | array
$v Vertex
return null | array null if the vertex is not in this graph or an array of vertices

getVertexSet() public method

Get the vertices in the graph
public getVertexSet ( ) : array
return array

searchEdge() public method

Searches an existing (directed or not) edge between two vertices
public searchEdge ( Vertex $source, Vertex $target ) : Edge
$source Vertex
$target Vertex
return Edge