2013-11-26 47 views
1

我有一個代表,例如,一個論壇主題以下玩具圖:情節樹狀圖與根節點在頂部

import igraph as ig 
g = ig.Graph(n = 12, directed=True) 
g.add_edges([(1,0),(2,1), (3,2), (4,3), 
      (5,1), 
      (6,2), (7,6), (8,7), 
      (9,0), 
      (10,0), (11,10)]) 
g.vs["label"] = ["A", "B", "A", "B", "C", "F", "C", "B", "D", "C", "D", "F"] 
ig.plot(g, layout="kk") 

然而,似乎是沒有的佈局,將根頂點(ID 0,標籤A)頂部並向下增長。

我錯過了什麼嗎?

+0

萊因戈爾德,蒂爾福德? http://igraph.sourceforge.net/doc/python/igraph.Graph-class.html#layout_reingold_tilford –

+0

對,這樣做可以完成工作,對不起,我沒有看到文檔中的參數: 'layout = g .layout_reingold_tilford(mode =「in」,root = 0)' – alberto

回答