[graph-tool] GraphView with lambda function

Gerion Entrup gerion.entrup at flump.de
Mon Jan 6 13:53:58 CET 2020


Hi,

the documentation describes that GraphView can be given a unary function
to filter vertices or edges.

I have tried that and it seems to fail. My GraphView has not the
expected vertices and edges.

However, my assumption is that the filter is only evaluated one time
(at initialization).

Let me make an example:

```
g = graph_tool.Graph()
a = graph_tool.GraphView(g, vfilt=...)

fill_the_graph(g)
do_stuff_with(a) # <- here a does not contain any data
```

>From the documentation, it seems that graph_tool constructs a property
from the filter function and uses this for filtering (therefore also
needing O(N)), but fill this property only on construction. Can you
mention this in the documentation as a hint or warning?

Maybe also a recalculate function for GraphView is meaningful that
evaluates the lambda function again.

Best,
Gerion
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.skewed.de/pipermail/graph-tool/attachments/20200106/6af63e7f/attachment.asc>


More information about the graph-tool mailing list