Graph::__construct

public Graph::__construct($graph)

Instantiates the depth first search object.

Parameters

$graph: A three dimensional associated array, with the first keys being the names of the vertices, these can be strings or numbers. The second key is 'edges' and the third one are again vertices, each such key representing an edge. Values of array elements are copied over.

Example:

    $graph[1]['edges'][2] = 1;
    $graph[2]['edges'][3] = 1;
    $graph[2]['edges'][4] = 1;
    $graph[3]['edges'][4] = 1;
  

On return you will also have:

    $graph[1]['paths'][2] = 1;
    $graph[1]['paths'][3] = 1;
    $graph[2]['reverse_paths'][1] = 1;
    $graph[3]['reverse_paths'][1] = 1;
  

File

core/lib/Drupal/Component/Graph/Graph.php, line 40

Class

Graph
Directed acyclic graph manipulation.

Namespace

Drupal\Component\Graph

Code

public function __construct($graph) {
  $this->graph = $graph;
}
doc_Drupal
2016-10-29 09:17:31
Comments
Leave a Comment

Please login to continue.