title: How can I visualize a Graph in (interactive) 3D with Python?
body: <p>I have a Graph in Python like this one:</p>
  
  <pre><code># 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)
  </code></pre>
  
  <p>This is a small example. The application I wrote uses graphs with about 100 vertexes and 300 edges.</p>
  
  <p>I would like to visualize this with python, preferably with a library which is available for Ubuntu. It would be great if it were possible to move the graph in the 3D-visualisation.</p>
  
  <p><strong>What I've done so far</strong></p>
  
  <p>At the moment I use <a href="http://ubietylab.net/ubigraph/content/Docs/index.html" rel="nofollow">UBIGRAPH</a>. The visualization and interaction is very good, but I can't specify coordinates for the vertexes:</p>
  
  <pre><code>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)
  </code></pre>
  
  <p><strong>matplot</strong></p>
  
  <p>I've found <a href="http://matplotlib.sourceforge.net/index.html" rel="nofollow">matplotlib</a>, but its very big. I didn't find an example which does what I like, but I might have missed it. Its available for Ubuntu.</p>
  
  <p><strong>vtk</strong></p>
  
  <p>The same problem as with matplot. If you could give me some working examples it might be the best solution.</p>