![](/img/trans.png)
[英]python igraph: nodes and edges color according to a number associated to the node
[英]Access nodes with edges to a certain node of interest in igraph python
我有一個名為g
的igraph
圖對象,帶有一些邊。 我想讓所有節點都具有某個節點的邊緣
g = Graph.Tree(10, 2)
print g
IGRAPH U--- 10 9 --
+ edges:
0--1 0--2 1--3 1--4 2--5 2--6 3--7 3--8 4--9
如果我選擇 node 1
,那么我應該返回一個其他節點的列表,這些節點的邊到節點1
(圖是無向的)。 輸出應如下所示:
[0, 3, 4]
這正是neighbors
方法所做的。
g.neighbors(1)
Out[12]: [0, 3, 4]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.