Hi,

On 10/14/2012 01:36 AM, mstcamus wrote:
> Hi everyone,
> 
> Does anyone have a way to use the find_edge() function to match edges based
> on whether the parameter property contains a value as opposed to a complete
> match? E.g., whether edges contain '2008' as opposed to something like 'Thu
> May 15 06:07:27 UTC 2008'. I looked at the source code in the latest git
> version, and it looks I'm limited to a direct match (for strings), but I
> wonder if anyone has any suggestions for how we can improve this code to
> match based on a substring? Could be handy.


The find_edge/vertex() functions have a limited functionality, which is
meant to improve the performance of the typical case of finding a
particular vertex/edge. For more complicated cases, one can usually whip
up an equivalent python expression which would do the trick... For
instance, what you are suggesting can performed with:

    edges = [e for e in g.edges() if "2008" in prop[e]]

Cheers,
Tiago

-- 
Tiago de Paula Peixoto <[email protected]>

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
graph-tool mailing list
[email protected]
http://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to