次のような Python のグラフがあります。
# Each element is a tuple with coordinates (x,y,z).
# The index is the id of the vertex
vertexList = [(0,0,0),(1,0,0),(1,1,0),(0,1,0),
(0,0,1),(1,0,1),(1,1,1),(0,1,1)]
# Each element is a tuple with the vertex-ids and a weight (vertexId1, vertexId2, weight)
edgeList = [(0,1,1), (1,2,1), (2,3,1), (3,0,1),
(0,4,1),
(4,5,1), (5,6,1), (6,7,1), (7,4,1)]
graph = (vertexList, edgeList)
これは小さな例です。私が作成したアプリケーションは、約 100 個の頂点と 300 個のエッジを持つグラフを使用しています。
これをPythonで、できればUbuntuで利用可能なライブラリで視覚化したいと思います。3D ビジュアライゼーションでグラフを移動できれば素晴らしいと思います。
これまでに行ったこと
現時点ではUBIGRAPHを使用しています。視覚化と相互作用は非常に優れていますが、頂点の座標を指定できません。
def visulizeGraph(Graph):
vertexList, edgeList = Graph
server_url = 'http://127.0.0.1:20738/RPC2'
server = xmlrpclib.Server(server_url)
G = server.ubigraph;
G.clear()
for identifier, vertex in enumerate(vertexList):
G.new_vertex_w_id(identifier)
for vertex1, vertex2, weight in edgeList:
x1, y1, z1 = vertexList[vertex1]
x2, y2, z2 = vertexList[vertex2]
G.new_edge(vertex1, vertex2)
マットプロット
matplotlibを見つけましたが、非常に大きいです。私が好きなことをする例は見つかりませんでしたが、見逃したかもしれません。Ubuntuで利用できます。
vtk
matplot と同じ問題。実用的な例をいくつか教えていただければ、それが最善の解決策になるかもしれません。