PHP 클래스 Gliph\Traversal\DepthFirst

파일 보기 프로젝트 열기: sdboyer/gliph 1 사용 예제들

공개 메소드들

메소드 설명
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.

메소드 상세

find_sources() 공개 정적인 메소드

Finds source vertices in a Digraph, then enqueues them.
public static find_sources ( Gliph\Graph\Digraph $graph, Gliph\Visitor\DepthFirstVisitorInterface $visitor ) : SplQueue
$graph Gliph\Graph\Digraph
$visitor Gliph\Visitor\DepthFirstVisitorInterface
리턴 SplQueue

toposort() 공개 정적인 메소드

Performs a topological sort on the provided graph.
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()
리턴 array A valid topologically sorted list for the provided graph.

traverse() 공개 정적인 메소드

Perform a depth-first traversal on 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.