[Lemon-user] New User - Simple Questions

Jyujinkai Shikmia jyujinkai at gmail.com
Tue Aug 7 22:35:31 CEST 2012


Ok .. so there is addArc() (i thought this was something else)

g.addArc(); ... so in my example..

       A    B    C
A    0    1    0
B    1    0    5
C    0    0    0


g.addArc(A,B);
g.addArc(B,A);
g.addArc(B,C);

This is adding connection info that A connects to B and B connects to A 
and C and C connects to nothing.

I am still unsure how to add weight though.... to store distance.. so I 
can then use the shortest path stuff.

On 8/08/2012 6:07 AM, Jyujinkai Shikmia wrote:
> HI there...
>
> I am a hobby programmer and not the most experienced. I have been 
> looking at Lemon to drive the path finding for a hobby game project I 
> am using, but I am confused at how to enter my map data.
>
> My understanding of a "directed" graph is that you have a node, and it 
> can link or not link to another node and then you have a weight on it...
>
> Example...
>
>       A    B    C
> A    0    1    0
> B    1    0    5
> C    0    0    0
>
> In this... A is connected to B with a weight of 1, C is connected to 
> nothing.. so once you get to C you are stuck, and B connects to A wit 
> ha value of 1 and B connects to C with a value of 5....
>
> The tutorial say to do something like this...
>
> ListDigraph g;
> ListDigraph::Node A = g.addNode();
> ListDigraph::Node B = g.addNode();
> ListDigraph::Node C = g.addNode();
>
> So now I have a graph "g" with the three nodes... so um... now what? 
> Where / How do I add the connectivity information as well as the 
> weight values...
>
> Thanks in advance!
> --Jynks




More information about the Lemon-user mailing list