class SS_DAG implements IteratorAggregate

A Directed Acyclic Graph - used for doing topological sorts on dependencies, such as the before/after conditions in config yaml fragments

Methods

__construct($data = null)

No description

additem($item)

Add another node/vertex

addedge($from, $to)

Add an edge from one vertex to another.

array
sort()

Sort graph so that each node (a) comes before any nodes (b) where an edge exists from a to b

getIterator()

No description

Details

at line 23
__construct($data = null)

Parameters

$data

at line 34
additem($item)

Add another node/vertex

Parameters

$item anything - The item to add to the graph

at line 48
addedge($from, $to)

Add an edge from one vertex to another.

When passing actual nodes (as opposed to indexes), uses array_search with strict = true to find

Parameters

$from integer|any The index in $data of the node/vertex, or the node/vertex itself, that the edge goes from
$to integer|any - The index in $data of the node/vertex, or the node/vertex itself, that the edge goes to

at line 64
array sort()

Sort graph so that each node (a) comes before any nodes (b) where an edge exists from a to b

Return Value

array
  • The nodes

Exceptions

Exception
  • If the graph is cyclic (and so can't be sorted)

at line 89
getIterator()