Méthode | Description | |
---|---|---|
find_sources ( Gliph\Graph\Digraph $graph, Gliph\Visitor\DepthFirstVisitorInterface $visitor ) : SplQueue | Finds source vertices in a Digraph, then enqueues them. | |
toposort ( Gliph\Graph\Digraph $graph, object | SplDoublyLinkedList $start = NULL ) : array | Performs a topological sort on the provided graph. | |
traverse ( Gliph\Graph\Digraph $graph, Gliph\Visitor\DepthFirstVisitorInterface $visitor, object | SplDoublyLinkedList $start = NULL ) | Perform a depth-first traversal on the provided graph. |
public static find_sources ( Gliph\Graph\Digraph $graph, Gliph\Visitor\DepthFirstVisitorInterface $visitor ) : SplQueue | ||
$graph | Gliph\Graph\Digraph | |
$visitor | Gliph\Visitor\DepthFirstVisitorInterface | |
Résultat | SplQueue |
public static toposort ( Gliph\Graph\Digraph $graph, object | SplDoublyLinkedList $start = NULL ) : array | ||
$graph | Gliph\Graph\Digraph | |
$start | object | SplDoublyLinkedList | The starting point(s) for the toposort. @see DepthFirst::traverse() |
Résultat | array | A valid topologically sorted list for the provided graph. |
public static traverse ( Gliph\Graph\Digraph $graph, Gliph\Visitor\DepthFirstVisitorInterface $visitor, object | SplDoublyLinkedList $start = NULL ) | ||
$graph | Gliph\Graph\Digraph | The graph on which to perform the depth-first search. |
$visitor | Gliph\Visitor\DepthFirstVisitorInterface | The visitor object to use during the traversal. |
$start | object | SplDoublyLinkedList | A vertex, or vertices, to use as start points for the traversal. There are a few sub-behaviors here: - If an SplDoublyLinkedList, SplQueue, or SplStack is provided, the traversal will deque and visit vertices contained therein. - If a single vertex object is provided, it will be the sole originating point for the traversal. - If no value is provided, DepthFirst::find_sources() is called to search the graph for source vertices. These are place into an SplQueue in the order in which they are discovered, and traversal is then run over that queue in the same manner as if calling code had provided a queue directly. This method *guarantees* that all vertices in the graph will be visited. |