我需要幫助,因爲我不擅長編程。Python,networkx
如何繪製具有n個節點和E邊的給定圖的平面圖(如果可以在平面中繪製圖,那麼不存在邊交叉)。然後翻轉邊緣以得到另一個平面圖形(for循環,直到我們獲得所有可能性)。
在此先感謝,我感謝您的幫助。
PY
>>>#visualize with pygraphviz
A=pgv.AGraph()
File "<stdin>", line 6
A=pgv.AGraph()
^
SyntaxError: invalid syntax
>>> A.add_edges_from(G.edges())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'A' is not defined
>>> A.layout(prog='dot')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'A' is not defined
>>> A.draw('planar.png')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'A' is not defined
歡迎StackOverflow上的平面子圖L(一networkx圖形對象)。這是一個問答網站。請查看常見問題解答:http://stackoverflow.com/faq – NPE 2012-02-07 09:07:13
您是否需要繪製一個平面圖形,該圖形「視覺上」看起來是平面的? – 2012-02-07 11:00:53
相關問題:[有沒有平面度測試的在線算法?](http://stackoverflow.com/questions/1605002/are-there-any-online-algorithms-for-planarity-testing) – 2012-02-07 14:29:46