[Lemon-user] Edge/Node validity check

Alpár Jüttner alpar at cs.elte.hu
Mon Nov 26 12:49:33 CET 2007


Hi,

> The suggested feature could be implemented, but it would cause a little 
> runtime performance loss.

Using SmartGraph, it is very easy to check it by checking if the id of a
node is in the range [0..maxid], with no performance loss.

For ListGraph, my suggestion would be to set the source of an edge to
INVALID when it is deleted. It would cause very little performance loss
and then the validity could be checked in constant time.

> The other problem is that, if the node would become 
> invalid and then a new node is added to the graph, then the previously 
> invalidated item becomes valid.

It is not a problem for me. I don't want to make a fool proof semantic
check, but I must make sure that a user cannot crash the Python
interpreter by a pure python code when using LEMON.

Alpar

> It may not cause problem in your program, but 
> it has very bad semantics. Therefore the official lemon suggestion is that, 
> if a node deleted from the graph and the Node object is pointed to that, then 
> the node object cannot be used until a new valid node assigned to it.
> 
> Best, Balazs
> 
> On Monday 26 November 2007 12.17.17 Alpár Jüttner wrote:
> > Hi,
> >
> > Is there any way to check if a Node or an Edge points to a valid
> > Node/Edge of a graph?
> >
> > I started to work on a Python language binding for lemon. The node/edge
> > validity check would be very important for implementing this)
> >
> > Regards,
> > Alpar
> >
> >
> > _______________________________________________
> > Lemon-user mailing list
> > Lemon-user at lemon.cs.elte.hu
> > http://lemon.cs.elte.hu/mailman/listinfo/lemon-user
> 
> 
> _______________________________________________
> 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