Search Results

Search found 2 results on 1 pages for 'stef89'.

Page 1/1 | 1 

  • Creating a program to find longest path

    - by stef89
    Hi everyone, I'm fairly new to programming and I'm having a few problems. Basically I have to make a function that will find the lengths of all the paths through a network diagram. I've been working on this for hours but I can't seem to get anywhere. Using recursion I can navigate through every path but I'm just unsure as to how I should record the lengths of the paths. Any help would be greatly appreciated. Thanks! $dependencies = array("","","","1","3","4,2"); $durations = array("5","3","4","11","9","10"); function tracePath($path,$dependencies,$durations,$returnArray=array()) { if($dependencies[$path] != "") { $currentTaskDependencies = preg_split("/[\s]*[,][\s]*/", $dependencies[$path]); for($i=0;$i<count($currentTaskDependencies);$i++) { tracePath($currentTaskDependencies[$i]-1,$dependencies,$durations,$returnArray[$i]); } } return $returnArray; } tracePath(6,$dependencies,$durations);

    Read the article

1