Is there any faster way to find the path with maximum attribute [duration] of vertices in a directed acyclic graph?

58 Views Asked by At

this code works in small networks (30 vertices) but for a 300 vertices network takes hours! Is there a faster way?

to calculate-duration
  ask act 0 [set color green]
  set pathlist [ ]
  loop [
  if all? deps [color = green] [stop]
  let path [0]
  let i 0
  while [i != count acts - 1][
  ask act i [set path lput [who] of one-of out-link-neighbors path]
   let j i
   set i last path
   ask turtle i [set color green]
   ask dep j i [set color green]
   ]
  let d 0
  foreach path [x -> set d d + ( [duration] of turtle x ) ]
  set path lput d path
  set pathlist lput path pathlist
  ]
0

There are 0 best solutions below