rendered paste body function dfs($path, $to, $visited) { // current path, destination, current visited nodes
$from = $path->peekLastNodeId();
if ($from == $to) { // found a path
$this -> addPath($path);
} else { // find next linked node(s)
$links = $this -> edges_d[$from];
foreach ($links as $id => $dist) {
if ($visited[$id] != true) {
$visited[$id] = true;
$path->addNode(new Node($id, $dist, $this->edges_l[$from][$id]));
$this->dfs($path, $to, $visited);
$path->removeLastNode();
}
}
}
// backtrack
return;
}