sagemath/sage

Add package phitigra: Graph editor that works with Jupyter

Closed this issue · 21 comments

slel commented

This ticket is about providing the graph editor https://pypi.org/project/phitigra, which works in Jupyter (Jupyter Notebook and JupyterLab).

This is part of

  • #29889: Metaticket: Jupyter improvements for things that were in sagenb

Related:

CC: @boothby @jasongrout @qed777 @nthiery @nvcleemp @rbeezer @rkirov @rlmill @slel @williamstein @zerline @jcamp0x2a @jfraymond @dimpase @dcoudert

Component: user interface

Keywords: graph_editor

Author: Matthias Koeppe

Branch: aca5732

Reviewer: David Coudert

Issue created by migration from https://trac.sagemath.org/ticket/30540

slel commented
comment:1

I cc-ed a lot of people who have had historical involvement with this topic.

If you mind, email me to un-cc you (un-cc-ing yourself would have the
opposite effect of subscribing you forever to updates on this ticket).

slel commented

Description changed:

--- 
+++ 
@@ -14,3 +14,4 @@
 
 - [Sage Trac tickets about graph editor](https://trac.sagemath.org/query?order=id&desc=1&summary=~graph_editor&or&summary=~graph+editor&or&description=~graph_editor&or&description=~graph+editor)
 
+- [graph_editor source code in archived sagenb code repository](https://github.com/sagemath/sagenb/tree/b360a0172e15501fb0163d02dce713a561fee2af/sagenb/data/graph_editor)
slel commented
comment:2

And if I forgot someone who wanted to be cc-ed, it's easy: just cc yourself.

comment:3

Candidates could be francy, bqplot, networkx+matplotlib.
A promising one:

https://blog.jupyter.org/interactive-graph-visualization-in-jupyter-with-ipycytoscape-a8828a54ab63

comment:4

Some nice features would be:

  • ability to disable any automatic layouting: not as annoying as an editor that keeps moving vertices while you're trying to construct a complicated graph
  • ability to have a layout-only mode: if you have a graph, you might want to change the layout without accidentally changing the graph structure

Probably some more, but these are the first two I could think of.

slel commented
comment:5

Replying to @nvcleemp:

Some nice features would be:

  • ability to disable any automatic layouting: not as annoying as an editor that keeps moving vertices while you're trying to construct a complicated graph
  • ability to have a layout-only mode: if you have a graph, you might want to change the layout without accidentally changing the graph structure

Probably some more, but these are the first two I could think of.

The "CS academy" graph editor (not sure about the license -- I'm asking them)
has those features. There's a button "Force" to let some force reshape the graph,
and buttons "Draw", "Edit", "Delete", "Config" that stop the movement to let
the user edit the graph. There's also a text column on the left where one can
manually edit the graph vertices and edges.

slel commented

Description changed:

--- 
+++ 
@@ -10,8 +10,8 @@
 
 Related:
 
-- [Stack Overflow question 63803031: Graph drawing tool that gives graph6 code](https://stackoverflow.com/questions/63803031)
+- [Stack Overflow question 63803031: Graph drawing tool that gives graph6 code](https://stackoverflow.com/q/63803031)
 
-- [Sage Trac tickets about graph editor](https://trac.sagemath.org/query?order=id&desc=1&summary=~graph_editor&or&summary=~graph+editor&or&description=~graph_editor&or&description=~graph+editor)
+- [Sage Trac tickets about graph editor](https://trac.sagemath.org/query?order=id&desc=1&summary=~graph_editor&summary=~graph+editor&or&description=~graph_editor&description=~graph+editor)
 
 - [graph_editor source code in archived sagenb code repository](https://github.com/sagemath/sagenb/tree/b360a0172e15501fb0163d02dce713a561fee2af/sagenb/data/graph_editor)
comment:9

Setting new milestone based on a cursory review of ticket status, priority, and last modification date.

comment:10

Hello,

I just see this ticket.
Last year I started to (occasionally) develop a graph editor for sage using ipycanvas and ipywidgets, that can be found in the following repository:
https://gitlab.limos.fr/jfraymon/phitigra

It is not completely finished (and the code could/will be improved) but it is functional: one can draw a graph and export it, zoom in/out, change vertex colors, use layout algorithms, etc.

I did not make a ticket here to include it in sage because it depends on external libraries (ipycanvas and ipywidgets) and I thought it would be annoying to review (also it is still work in progress).

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

aca5732build/pkgs/phitigra: New

Description changed:

--- 
+++ 
@@ -1,8 +1,4 @@
-This ticket is about providing a graph editor that
-works in Jupyter (Jupyter Notebook or JupyterLab).
-
-Possibly in the form of a Jupyter widget, using any
-existing one if possible.
+This ticket is about providing the graph editor https://pypi.org/project/phitigra, which works in Jupyter (Jupyter Notebook and JupyterLab).
 
 This is part of
 

Author: Matthias Koeppe

Reviewer: David Coudert

comment:17

I tried to install phitigra and it works well with jupyter on safari/macOS 12.12.1. Quite easy to use to edit basic graphs.

comment:18

Thanks!

comment:20

Follow-up: #33639 Replace sage.graphs.graph_editor with a call to phitigra

Changed commit from aca5732 to none

comment:21

Great, thank you for this addition! I'm glad to see there is interest for my graph editor.