Package: phitigra
PhitigraPhitigrais a graph editor widget forSageMathwhen using theJupyternotebook.Try thedemonotebook on mybinder!Note:for some unknown reason the above link stopped working.FeaturesWith phitigra one can:draw graphs using the mouse to add vertices and edgesmove the vertices positions, zoom in and outdraw undirected as well as directed graphschoose the color of vertices and edgesapply various layout algorithmseasily retrieve the drawn graph for use with SageMathrun step-by-step a custom script on the drawn graphchange and refresh the drawing with external functionsNon-featuresThe following are not supported:multigraphs: multiple edges will not be drawnlarge graphs: the rendering will be unpraticably slowDependenciesipywidgets, for user interactionipycanvas, for the drawingWith jupyter, you might need the followingjupyter nbextension enable --py widgetsnbextensionafter you install ipywidgets, and possibly more if using virtualenv and working in an activated virtual environment, seeipywidget's documentationfor full details.This is the first thing to check if the import of the package works fine but nothing shows when you try to display the widget.With jupyterlab, thejupyterlab_widgetspackage is also required for the widget to show.How to try it?On mybinder(Runs online, nothing to install.)Note:for some unknown reason the link below stopped working.
Clickingherewill open the demo notebook on mybinder in a new tab. Note that this uses thestableversion of phitigra (that from themasterbranch), which may differ from the one in thedevelopbranch.From a standalone SageMath installationThis assumes that SageMath is installed on your system. Seehttp://www.sagemath.orgfor install instructions.Stable versionThestableversion is onpypiso it can be installed as followssage -pip install --upgrade phitigraDevelopment versionClone the source from the repositorygit clone https://github.com/jfraymond/phitigra.gitInstall or upgrade with pip:sage -pip install --upgrade path/to/the/cloned/repositoryThat's it!To uninstall:sage -pip uninstall phitigraNote that the above commands should not be run from the repository directory, otherwisepipmightcomplain that it did not find files to uninstall.Usagefrom phitigra import GraphEditor
editor = GraphEditor(graphs.RandomGNP(10, 0.5))
editor.show()
# Now you can play with the graph!A copy of the currently drawn graph can be obtained with theget_graphfunction:G = editor.get_graph()
# Now G is a copy of the graph drawn in editor eThere are many more examples in the demo notebook.TestsAs with SageMath's code, tests and code quality checks can be started with the--toxoption (from the cloned directory):sage --tox src/phitigraBuilding the documentationFrom the package directorycd docs
sage -sh -c "make html"The main file of the documentation is then indocs/build/html/index.html.
A recent build of the documentation can be foundhere.What's newv0.2.6Minor change to adapt to the new ipycanvas; this version will not work with ipycanvas < 0.12.0v0.2.5Minor fixes in the documentationFixed an issue when building the documentationv0.2.4Show/hide edge labelsUser-defined vertex labelsExposing vertex positioning functionsRemoving theNextbuttonUpdating links after move to githubMore examples in the demo notebookv0.2.3Improved docPolished code, which now passes all testsChanged package structure to followspython guidelinesv0.2.2Single (major) change: renamingSimpleGraphEditorintoGraphEditor. Code written for previous versions is not compatible with this one, but can be easily fixed.v0.2.1Demo notebookBinder linkImproved update time when moving verticesMinor fixesv0.2.0Docstrings and doctests in (almost) all functionsHiding of internal objectsCleaning code