[Lemon-user] How to know if a graph have already a node
Alpár Jüttner
alpar at cs.elte.hu
Mon Feb 14 17:03:36 CET 2011
Hi,
>
> 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.
Yes, I suggest doing this.
If your original IDs form a more-or-less continuous interval, then you
may also use std::vector<lemonNodeIndex>.
> 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 ...
That's fine. All your questions are warmly welcome here.
>
> 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)
It could be better, I admit. Our resources are limited, and of course
any help in improving the doc is great help for us. This is an open
source project anyway. The source code repository of both the library
both the Tutorial is available at http://lemon.cs.elte.hu/hg . Patches
are always very welcome.
> 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....
There is however at least some info about these topics on the next page
of the tutorial:
http://lemon.cs.elte.hu/pub/tutorial/a00010.html
Later on you find a section (I admit, an unfinished one) about maps:
http://lemon.cs.elte.hu/pub/tutorial/a00019.html
The reference guide give a quite detailed description of the Digraph
concept (with all the iterators and the default maps etc):
http://lemon.cs.elte.hu/pub/doc/1.2.1/a00106.html
> 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.
Yes, it would be nice. Should it be coherent with the current Tutorial,
it would be even better.
Regards,
Alpár
>
> 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
>
>
>
>
More information about the Lemon-user
mailing list