Interactive Graph Construction



I'm interested in constructing an interactive GUI graph generator, where I can add and delete vertices and edges.

I'm aware of this question, and this is but a quick follow-up to this answer. I would like to simply edit István Zachar's code to answer the following questions

  1. Is it possible to recover/paste the constructed graph? How does one do it (an undirected graph would be ok)?
  2. Could I easily toggle the graph between directed and undirected?
  3. Also, I wonder if it's possible to, given a graph, edit it with such a GUI construction.

I feel like it should be relatively easy to do it using this code, but I'm not yet very comfortable working DynamicModule. I wonder if there is a Manipulate version of this.

Any ideas?

sam wolfe

Posted 2020-03-17T22:39:53.823

Reputation: 2 357

I always wanted a good interactive graph drawing function for IGraph/M, but never had the time, and I am not deeply experienced with creating well-performing GUIs in Mathematica. – Szabolcs – 2020-03-18T08:29:40.927

1I pledge a bounty of 500 for any answer that is sufficiently usable, robust and responsive that it can be a basis of an IGraph/M function. I will not post the bounty right now because I do not want to add time pressure, but rest assured that it will be granted. The offer stands in the long term. If there are additional answers that bring tangible improvements, those will receive the bounty too. – Szabolcs – 2020-03-18T08:30:55.063

1Tip: Ideally, the function will output an object that is simply interpreted as a Graph when re-evaluated. Requirements: (1) Directed/undirected support (mixed graph not necessary). (2) Movable vertices (3) Possibility to add/remove edges/vertices (4) Keep usability in mind: try to build various small graphs with it. (5) Reasonably commented readable implementation (so others can build on it). – Szabolcs – 2020-03-18T08:40:58.047

Sam: I didn't want to hijack your question. I understand that your requirements are less stringent. So everyone: please do not hesitate to post simpler solutions that satisfy the OP's needs, if you have such a solution. The comment above just states the requirements for the bounty. – Szabolcs – 2020-03-18T08:44:06.250

No worries! I think your suggestions are great, and I am particularly interested in the directed/undirected support (I will edit my question). I think (2) and (3) are already doable with István's code, if you right-click on a vertex or edge, but this might not be exactly what you're looking for. – sam wolfe – 2020-03-18T09:57:56.950

No answers