<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
Assuming that the other variables are declared correctly, your code
should work. e.g:<br>
<br>
#include <lemon/smart_graph.h><br>
#include <lemon/dijkstra.h><br>
#include <stdio.h><br>
<br>
using namespace lemon;<br>
<br>
int main()<br>
{<br>
SmartDigraph g;<br>
SmartDigraph::ArcMap<int> length(g);<br>
SmartDigraph::NodeMap<int> dist(g);<br>
SmartDigraph::Node s = g.addNode();<br>
SmartDigraph::Node t = g.addNode();<br>
SmartDigraph::Arc a = g.addArc(s,t);<br>
length[a] = 1;<br>
Dijkstra<SmartDigraph> dijkstra(g, length);<br>
dijkstra.distMap(dist);<br>
dijkstra.init();<br>
dijkstra.addSource(s);<br>
dijkstra.start();<br>
printf("%i\n", dist[t]);<br>
return 0;<br>
}<br>
<br>
Note, that the "dijkstra" in the first example is different from the
"dijkstra" in the second, because the first is a function, and the
second is an instance of the Dijkstra class.<br>
<br>
More information:<br>
<a class="moz-txt-link-freetext" href="http://lemon.cs.elte.hu/pub/doc/1.1.1/a00437.html#ga6aa57523fe00e2b8fe2f5cd17dd15cea">http://lemon.cs.elte.hu/pub/doc/1.1.1/a00437.html#ga6aa57523fe00e2b8fe2f5cd17dd15cea</a><br>
<a class="moz-txt-link-freetext" href="http://lemon.cs.elte.hu/pub/doc/1.1.1/a00087.html">http://lemon.cs.elte.hu/pub/doc/1.1.1/a00087.html</a><br>
<br>
regards,<br>
Gábor<br>
<br>
On 01/04/2011 07:37 PM, Yongjia Song wrote:
<blockquote
cite="mid:AANLkTikAom=hXt-2xwWYNGYEefcwnnanyf0ZNi3qxLkK@mail.gmail.com"
type="cite">Hi all,<br>
<br>
I am a new user of lemon, and I could not figure out a way to use
dijkstra's algorithm appropriately.<br>
<br>
Is there any example file for that? I can see that the
documentation part of dijkstra's algorithm on the website could
not work. <br>
<br>
Basically, I use<br>
<br>
SmartDigraph g;<br>
SmartDigraph::ArcMap<int> cap(g)<br>
Dijkstra<SmartDigraph> dijkstra(g,cap)<br>
<br>
then I could not run either<br>
<pre class="fragment"> <a moz-do-not-send="true" class="codeRef" href="http://lemon.cs.elte.hu/pub/doc/1.1.1/a00437.html#ga6aa57523fe00e2b8fe2f5cd17dd15cea">dijkstra</a>(g, cap).distMap(dist).run(s,t);
or
<a moz-do-not-send="true" class="codeRef" href="http://lemon.cs.elte.hu/pub/doc/1.1.1/a00437.html#ga6aa57523fe00e2b8fe2f5cd17dd15cea">dijkstra</a>.distMap(dist);
dijsktra.init();
<a moz-do-not-send="true" class="codeRef" href="http://lemon.cs.elte.hu/pub/doc/1.1.1/a00437.html#ga6aa57523fe00e2b8fe2f5cd17dd15cea">dijkstra</a>.addSource(s);
<a moz-do-not-send="true" class="codeRef" href="http://lemon.cs.elte.hu/pub/doc/1.1.1/a00437.html#ga6aa57523fe00e2b8fe2f5cd17dd15cea">dijkstra</a>.start();
Thanks,
</pre>
<br>
-- <br>
Sincerely:<br>
Song Yongjia(宋永佳)<br>
<br>
Department of Industrial and Systems Engineering<br>
College of Engineering, University of Wisconsin-Madison<br>
3241 Mechanical Engineering Building<br>
1513 University Avenue, Madison, WI 53706<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Lemon-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Lemon-user@lemon.cs.elte.hu">Lemon-user@lemon.cs.elte.hu</a>
<a class="moz-txt-link-freetext" href="http://lemon.cs.elte.hu/mailman/listinfo/lemon-user">http://lemon.cs.elte.hu/mailman/listinfo/lemon-user</a>
</pre>
</blockquote>
<br>
</body>
</html>