0

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?

Vladimir Vargas
  • 1,744
  • 4
  • 24
  • 48

1 Answers1

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