Skip to content

Instantly share code, notes, and snippets.

@mjbommar
Created January 17, 2010 21:05
Show Gist options
  • Save mjbommar/279584 to your computer and use it in GitHub Desktop.
Save mjbommar/279584 to your computer and use it in GitHub Desktop.
'''
Created on Jan 17, 2010
@author: mjbommar
'''
from GraphMovie import GraphMovie
import igraph
if __name__ == "__main__":
'''
Create the GraphMovie object.
'''
m = GraphMovie()
'''
Create the first graph.
'''
edges = [(0,1),(1,2),(1,3)]
g = igraph.Graph(edges)
for i,v in enumerate(g.vs):
v['label'] = str(i)
m.addGraph(g)
'''
Now add an edge.
'''
edges.append((4,1))
g = igraph.Graph(edges)
for i,v in enumerate(g.vs):
v['label'] = str(i)
m.addGraph(g)
'''
Now add a few edges!
'''
edges.extend([(5,2),(6,5),(7,5),(8,5),(8,7),(9,8)])
g = igraph.Graph(edges)
for i,v in enumerate(g.vs):
v['label'] = str(i)
m.addGraph(g)
'''
Now process the layouts, render the frames, and generate the movie.
'''
m.doMovieLayout()
m.renderMovie()
@digitaldust
Copy link

thanks for this, however it looks like I have an error running your example:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-165-a7d0fa28739d> in <module>()
      4 for i,v in enumerate(g.vs):
      5     v['label'] = str(i)
----> 6 m.addGraph(g)

~/Documents/GraphMovie.py in addGraph(self, graph, frameLabel)
    116             self.labelSequence.append(frameLabel)
    117         else:
--> 118             self.labelSequence.append(str(len(self.graphSequence)))
    119 
    120     def interpolateLayout(self, lastLabels, lastLayout, g):

AttributeError: 'map' object has no attribute 'append'

is there anything I did wrong? thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment