[Lemon-user] How to know if a graph have already a node

Pierre Moulon pmoulon at gmail.com
Mon Feb 14 16:27:20 CET 2011


Hi,

I'm adding node in a graph in the following manner.

I have a set of correspondences pair(a,b) associated with a weight.

So I want create a graph with those pair, so add arc between already
potentially existing node (a node 0 could be created and reused later).

I.E (considering the following pairs) :

pair(0,1) -> 0.6
pair(0,2) -> 0.2 // Here I have to set an arc between node 0 and 2. (0 have
already created).
pair(6,3) -> 0.3
pair(0,4) -> 0.6 // Here I have to set an arc between node 0 and 4. (0 have
already created).

I use "g.addArc(nodeA, nodeB);"

For sure my problem could be solved by building a map<mynodeIndex,
lemonNodeIndex> when I parse my pairs and so I could build safely the
connection graph.
I'm trying to understand how I could build lemon graph... I'm new to lemon,
it's why I ask for the "alrready existing node" question ...

I think lemon documentation is not sufficient (I want to say the basic C++
sample). (It's a pity because LEMON seems very very good)

We could not find in the doc a place where a very simple graph is
builded...and basic lemon concept are explained
This tutorial is insufficient to understand lemon :
http://lemon.cs.elte.hu/pub/tutorial/a00011.html

-> It do not show how use Map.
-> It do not show how iterate through Arc,Nodes...

-> It do not show the concept of in,out arc....

It's just suggestion...
If you want I could make a small samples and send it to you in the end of
the week to show what I expect... to see as a new user.

Regards,
Pierre M


2011/2/14 Alpár Jüttner <alpar at cs.elte.hu>

> On Mon, 2011-02-14 at 14:24 +0100, Pierre Moulon wrote:
> > Hi,
> >
> >
> > I want to know if we could know if a graph have already a node
> > register to the element we want to potentially re-add :
> >
> >
> > I have test the find (stl) function over the graph note iterator, but
> > it do not compiles :
> >
> >
> > using namespace lemon; //ask if the graph g already contain a node
> > nodeA.
> > graphType::NodeIt itA =
> > find<graphType::NodeIt,Node>( graphType::NodeIt(g), INVALID, nodeA);
> >
> >
> > Do you have a tip to give me ?
>
> Not sure what do you want to achieve. graphType::valid() will tell you
> whether or not a Node or Arc is a existing Node, but it is mainly for
> debugging purposes. In normal use of LEMON you typically don't want to
> use it, especially for iterators.
>
> Could you tell me what is real the problem you are trying solve?
>
> Regards,
> Alpar
>
> >
> >
> > Regards,
> > Pierre
> > _______________________________________________
> > 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/20110214/d74187f8/attachment.html>


More information about the Lemon-user mailing list