I have a graph with some vertex and edges. I want to find which neighbors of a given vertex match a property value. I can do that with find_vertex(g, prop, match)
, but this would search in all the graph. Instead, I have neighbors = g.vertex(N).out_neighbors()
, and I would like to get the vertex that have a property value, something like find_vertex(neighbors, prop, match)
. How can I do this?
Asked
Active
Viewed 649 times
0

Vladimir Vargas
- 1,744
- 4
- 24
- 48
1 Answers
1
Why not
neighbors = g.vertex(N).out_neighbors()
[neigh for neigh in neighbors if g.vp[prop][neigh] == match]

Malik Koné
- 635
- 1
- 7
- 16
-
1I'm looking for a really fast way of doing this – Vladimir Vargas Jun 12 '19 at 01:17