Ticket #2378 (new enhancement)

Opened 10 months ago

Last modified 2 weeks ago

graph and digraph animations

Reported by: jason Assigned to: jason
Priority: major Milestone: sage-wishlist
Component: graph theory Keywords:
Cc:

Description

We ought to have a way to create animations like these:

http://www.cs.sunysb.edu/~skiena/combinatorica/animations/

See the Mathematica function:

http://reference.wolfram.com/mathematica/Combinatorica/ref/AnimateGraph.html

Change History

03/03/2008 10:08:37 AM changed by jason

03/03/2008 10:08:48 AM changed by jason

  • owner changed from mabshoff to rlm.
  • component changed from Cygwin to graph theory.
  • milestone set to sage-2.10.3.

03/03/2008 10:09:06 AM changed by jason

  • summary changed from graph animations to graph and digraph animations.

03/03/2008 10:19:41 AM changed by jason

To do the above, I think it would be sufficient to add an option to graph.plot that would implement the "Highlight" functionality from Mma

09/09/2008 08:01:01 PM changed by rlm

  • owner changed from rlm to jason.

09/09/2008 08:14:37 PM changed by jason

  • milestone changed from sage-3.1.3 to sage-wishlist.

12/22/2008 10:31:06 AM changed by jason

Code for a highlight function:

normal_vertex_color='#fec7b8'
normal_edge_color = 'black'
def highlight(g,vertices=[],edges=[],**kwds):
    edges = [e[0:2] for e in edges]
    normal_edges = list(set(g.edges(labels=False)).difference(set([e[0:2] for e in edges])))
    normal_vertices = list(set(g.vertices()).difference(set(vertices)))
    return g.plot(vertex_colors={'red': vertices, normal_vertex_color: normal_vertices}, edge_colors={'red': edges, normal_edge_color: normal_edges},**kwds)
g=graphs.DodecahedralGraph()
highlight(g,[1,2],[(1,2),(2,6)],layout="spring")