libSmalldb
v0.7
|
Depth First Search & friends.
Public Member Functions | |
onNode (callable $callback) | |
Call $func when entering the node. More... | |
onArrow (callable $callback) | |
Call $func when inspecting next nodes, before enqueuing them. More... | |
start ($start_nodes) | |
Start DFS from $startNodes. More... | |
Static Public Member Functions | |
static | DFS (Graph $g) |
static | BFS (Graph $g) |
Public Attributes | |
const | DFS_STRATEGY = 1 |
const | BFS_STRATEGY = 2 |
onNode | ( | callable | $callback | ) |
Call $func when entering the node.
$callback | function($current_node_id) |
onArrow | ( | callable | $callback | ) |
Call $func when inspecting next nodes, before enqueuing them.
Nodes are inspected always, even when they have been seen before, but once seen nodes are not enqueued again.
$callback | function($current_node_id, $next_node_id, $next_node_seen, $arrow_id) |
start | ( | $start_nodes | ) |
Start DFS from $startNodes.
$startNodes | List of starting nodes or their IDs. |
$nextNodes | Map $current_node_id -> list of [ $next_node_id, $arrow_id ]. |