[Lemon-user] How to find out if a node is part of a graph?

Philipp Bender philipp at rootiniert.de
Fri Dec 7 20:03:28 CET 2012


Hello,

this may be a very simple question, but I really don't know if, given a
graph and a node, find out if the node is part of the graph.

My use case is the following: I have an original graph, from this I
select a node called "source". Then, I apply a filter and filter out
nodes with a certain criterion, what I get then is a FilterNodes< ... >.

Now: I'd like to write a generic method taking a source node and a
graoh, and do something, let's day Dijkstra's algorithm. Therefore I
need a method to find out if the node belongs to the graph. I know I
could ask the filter which makes the FilterNodes out of my ListDigraph,
but this is way too "invasive".

Should be possible, shouldn't it? What I found out:

- FilterNodes conforms with the Digraph concept [1]
- but graph.valid(node) is only available for ListDigraphs [2]

Can someone help me with this?

Best regards, Philipp

[1] http://lemon.cs.elte.hu/pub/doc/latest/a00142.html
[2] http://lemon.cs.elte.hu/pub/doc/latest/a00205.html



More information about the Lemon-user mailing list