[Lemon-user] New User - Simple Questions

Balázs Dezső deba.mf at gmail.com
Tue Aug 7 22:38:23 CEST 2012


You can create an ArcMap on the graph:
ListDigraph::ArcMap<int> w(g);

And you can set distances:
ListDigraph::Arc AB = g.addArc(A,B);
w[AB] = 1;

Balazs
On Aug 7, 2012 10:35 PM, "Jyujinkai Shikmia" <jyujinkai at gmail.com> wrote:

> 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
>
> _______________________________________________
> Lemon-user mailing list
> Lemon-user at lemon.cs.elte.hu
> http://lemon.cs.elte.hu/mailman/listinfo/lemon-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lemon.cs.elte.hu/pipermail/lemon-user/attachments/20120807/c5ff3070/attachment.html>


More information about the Lemon-user mailing list