Python 如何在graph_工具中找到具有属性值的相邻顶点

Python 如何在graph_工具中找到具有属性值的相邻顶点,python,graph-tool,Python,Graph Tool,我有一个有一些顶点和边的图。我想找出给定顶点的哪些邻域与属性值匹配。我可以用find_vertexg、prop、match来实现这一点,但这将在所有图形中搜索。相反,我有neighbories=g.vertexN.out_neighbories,我想得到具有属性值的顶点,比如find_vertexneighbories,prop,match。我该怎么做呢?为什么不呢 neighbors = g.vertex(N).out_neighbors() [neigh for neigh in neigh

我有一个有一些顶点和边的图。我想找出给定顶点的哪些邻域与属性值匹配。我可以用find_vertexg、prop、match来实现这一点,但这将在所有图形中搜索。相反,我有neighbories=g.vertexN.out_neighbories,我想得到具有属性值的顶点,比如find_vertexneighbories,prop,match。我该怎么做呢?

为什么不呢

neighbors = g.vertex(N).out_neighbors()
[neigh for neigh in neighbors if g.vp[prop][neigh] == match]

我正在寻找一种快速的方法