Graph editor widget¶
This module adds an interface to phitigra, a graph editor widget for
Jupyter and JupyterLab. The phitigra optional package should be installed
on your Sage installation.
AUTHORS:
- Radoslav Kirov (2009): initial editor for use with the old sage notebook 
- Jean-Florent Raymond (2022-04-12): replacement with the - phitigrapackage
- sage.graphs.graph_editor.graph_editor(graph=None, **display_options)[source]¶
- Return a graph editor widget. - The graph editor widget can be displayed with Jupyter or JupyterLab. It is provided by the - phitigraoptional package, see https://github.com/jfraymond/phitigra for details about the possible options (changing the width/height of the canvas, the default size and color of vertices, etc.).- INPUT: - graph– a graph to edit (default:- None)
- display_options– options for the widget
 - EXAMPLES: - sage: e = graph_editor() # optional - phitigra sage: e.show() # not tested - >>> from sage.all import * >>> e = graph_editor() # optional - phitigra >>> e.show() # not tested - Opening an existing graph: - sage: G = graphs.RandomGNP(10, 0.5) sage: e = graph_editor(G) # optional - phitigra sage: e.show() # not tested - >>> from sage.all import * >>> G = graphs.RandomGNP(Integer(10), RealNumber('0.5')) >>> e = graph_editor(G) # optional - phitigra >>> e.show() # not tested - Retrieving a copy of the drawn graph: - sage: G = graphs.RandomGNP(10, 0.5) sage: e = graph_editor(G) # optional - phitigra sage: H = e.get_graph() # optional - phitigra sage: H == G and not H is G # optional - phitigra True - >>> from sage.all import * >>> G = graphs.RandomGNP(Integer(10), RealNumber('0.5')) >>> e = graph_editor(G) # optional - phitigra >>> H = e.get_graph() # optional - phitigra >>> H == G and not H is G # optional - phitigra True - Using different display options: - sage: e = graph_editor(graphs.PetersenGraph(), width=300, height=300, # optional - phitigra ....: default_radius=12, default_vertex_color='orange', ....: default_edge_color='#666', show_vertex_labels=False) sage: e.show() # not tested - >>> from sage.all import * >>> e = graph_editor(graphs.PetersenGraph(), width=Integer(300), height=Integer(300), # optional - phitigra ... default_radius=Integer(12), default_vertex_color='orange', ... default_edge_color='#666', show_vertex_labels=False) >>> e.show() # not tested - Note - The editor does not support multigraphs.