Skip to content

Instantly share code, notes, and snippets.

View VictorienMarette's full-sized avatar

Victorien Marette VictorienMarette

View GitHub Profile
@Zulko
Zulko / graph_editor.py
Last active April 27, 2021 19:15
This function enables to manually draw a graph (nodes and edges) that can then be used in Python (with Networkx for instance)It's extremely simple: >>> nodes, edges, nodes_positions = graph_editor()
import matplotlib.pyplot as plt
import numpy as np
def graph_editor(grid=True, grid_N = 12):
"""
This function enables to draw a graph manually using
Matplotlib's interactive plotting capabilites.
In a first phase you are asked to place the nodes
(left-click to place a node, right-click to remove