Opens a graph editor in the Sage notebook.
INPUT:
EXAMPLES:
sage: g = graphs.CompleteGraph(3)
sage: graph_editor(g) # not tested
sage: graph_editor(graphs.HouseGraph()) # not tested
sage: graph_editor(graph_name='my_graph') # not tested
sage: h = graphs.StarGraph(6)
sage: graph_editor(h, replace_input=False) # not tested
Returns a string representation of a Graph instance usable by the graph_editor(). The encoded information is the number of vertices, their 2D positions, and a list of edges.
INPUT:
OUTPUT:
EXAMPLES:
sage: from sage.graphs.graph_editor import graph_to_js
sage: G = graphs.CompleteGraph(4)
sage: graph_to_js(G)
'num_vertices=4;edges=[[0,1],[0,2],[0,3],[1,2],[1,3],[2,3]];pos=[[0.5,0.0],[0.0,0.4999999999999999],[0.4999999999999999,1.0],[1.0,0.5000000000000001]];'
sage: graph_to_js(graphs.StarGraph(2))
'num_vertices=3;edges=[[0,1],[0,2]];pos=[[0.75,0.5],[1.0,0.0],[0.0,1.0]];'