rendered paste body<?phpfunction shortPath($from, $to){ $queue = array($from); $active = 0; $prev = array(); while ( count($queue) > 0 ) { $active = array_shift($queue); $dbresult = mysql_query("SELECT `ven` FROM `vennetabel` WHERE `bruger` = $active"); while ($enven = mysql_fetch_assoc($dbresult)) { $enven = $enven['ven']; if (!empty($prev[$enven])) continue; $prev[$enven] = $active; array_push($queue,$enven); if ($enven == $to) return backTrack($from, $to, $prev); } } return "No path exists between $from and $to";}function backTrack($from, $to, $prev){ $output = array($to); $active = $to; while ($active != $from) { $active = $prev[$to]; array_unshift($output,$active); } return $output;}?>