1

I have a question regarding some of the parameters necessary to run Dijkstra's algorithm from the Lemon Graph Libraries (Lemon's Dijkstra's http://lemon.cs.elte.hu/pub/tutorial/a00009.html). To run the algorithm, one would write something like dijkstra(g, length).distMap(dist).run(s,t); where g is the graph, s is that starting node and t is the destination node. My question is what is length and dist, and how are they used. Thanks!

Artem Zankovich
  • 2,319
  • 20
  • 36
Qman
  • 377
  • 1
  • 4
  • 14
  • [one](http://lemon.cs.elte.hu/pipermail/lemon-user/2011-January/000324.html) and [two](http://lemon.cs.elte.hu/pub/doc/1.1.1/a00087.html#a58fc0895a271a1aa712f66aaf3425b12) – Digital Da Aug 13 '12 at 20:19
  • So to store data at each node I use a `NodeMap`? and to store the weights/distances at each arc, I use an `ArcMap`? If so, the weights will be stored in `length`, and I do not see a need for `dist`. What am I missing here? – Qman Aug 14 '12 at 13:00

1 Answers1

1

The way I read it, they both need to be maps, one to edge lengths (input) one to vertex distances(output),

Also check lgf_demo.cc and dijkstra_test.cc and note

Dijkstra& distMap ( DistMap & m ) [inline]

Sets the map that stores the distances of the nodes calculated by the algorithm. If you don't use this function before calling run() or init(), an instance will be allocated automatically. The destructor deallocates this automatically allocated map, of course.

Returns: (*this)


const DistMap& distMap ( ) const [inline]

Returns a const reference to the node map that stores the distances of the nodes calculated by the algorithm.

Precondition: Either run() or init() must be called before using this function.

so this is your output of Dijstra.

ntg
  • 12,950
  • 7
  • 74
  • 95