PHP Class Trismegiste\Mondrian\Graph\Digraph

Digraph is a directed graph with 0 or 1 directed edge between two vertices. Therefore, there are at maximum two edges between two vertices (the two directions)
Inheritance: implements Trismegiste\Mondrian\Graph\Graph
Mostra file Open project: trismegiste/mondrian Class Usage Examples

Protected Properties

Property Type Description
$adjacency SplObjectStorage The adjacencies list of one vertex is a hashmap Target vertex -> Edge

Public Methods

Method Description
__construct ( )
addEdge ( Vertex $source, Vertex $target ) Add a directed edge if it does not already exist
addVertex ( Vertex $v ) Add a vertex to the graph without edge Note : Idempotent method
getEdgeIterator ( Vertex $v ) {@inheritDoc}
getEdgeSet ( ) : Edge[] Get the edges set
getPartition ( ) {@inheritDoc}
getSuccessor ( Vertex $v ) : Vertex[] Returns successor(s) of a given vertex (a.k.a all vertices targeted by edges coming from the given vertex)
getVertexSet ( ) : Vertex[] Get the vertices in the graph
searchEdge ( Vertex $source, Vertex $target ) : Edge Searches an existing directed edge between two vertices

Method Details

__construct() public method

public __construct ( )

addEdge() public method

Add a 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 Note : Idempotent method
public addVertex ( Vertex $v )
$v Vertex

getEdgeIterator() public method

{@inheritDoc}
public getEdgeIterator ( Vertex $v )
$v Vertex

getEdgeSet() public method

Get the edges set
public getEdgeSet ( ) : Edge[]
return Edge[]

getPartition() public method

{@inheritDoc}
public getPartition ( )

getSuccessor() public method

Returns successor(s) of a given vertex (a.k.a all vertices targeted by edges coming from the given vertex)
public getSuccessor ( Vertex $v ) : Vertex[]
$v Vertex
return Vertex[] array of successor vertex

getVertexSet() public method

Get the vertices in the graph
public getVertexSet ( ) : Vertex[]
return Vertex[]

searchEdge() public method

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

Property Details

$adjacency protected_oe property

The adjacencies list of one vertex is a hashmap Target vertex -> Edge
protected SplObjectStorage $adjacency
return SplObjectStorage