[Lemon-user] newbie question: ArcLookUp segfaults?!

Kovács Péter kpeter at inf.elte.hu
Fri May 28 10:10:46 CEST 2010


Dear Björn,

> Hi,
>
> i possibly like  to use lemon for network graphs, but i'm wondering about
> the following, i tried to write a simple program:
>
> ...
>
> What i'm wondering about is that when i use ArcLookUp instead of
> DynArcLookUp the program segfaults.
> I read the documentation, but it just says i should call refresh if the
> graph changed (but it does not from
> the creation of ArcLookUp til it's usage), and even when i use refresh it
> segfaults.

Without refresh(), it clearly cause segfault. However, it works fine for 
me if I use refresh(). Be aware to call refresh() _after_ the enter() 
calls in your set() function.

> DynArcLookUp may be what i'm looking for,

Yes, it is. And I suggest you to have a DynArcLookUp instance as a 
member variable in your class instead of creating new instances for all 
execution of set().

> however getting a segfault with
> ArcLookUp i'm wondering if i do something fundamentally wrong?!

I checked the code, but I don't find such problems.

> Second question, is there a more straightforwarded way to access nodes via
> a map, so to say the reverse
> of what a lemon-map is doing, than keeping the nodes in a std::map like i
> do it above?

lemon::CrossRefMap is just the tool you are looking for. It applies the 
same solution as you do, but for some practical aspects it uses 
std:::multimap instead of std::map internally. So it is not a better 
solution, just more convenient.

Regards,
Peter


> _______________________________________________
> 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