'Is there a way to build an interactive node graph in JavaScript?

I'm looking to build an interactive node graph on a webpage where you can add nodes with various inputs and outputs and connect them together.

This is an example of what I'm looking to do:

enter image description here

I started to play around with vis.js but I'm not sure it will be able to do the above.

Any suggestions would be appreciated!



Solution 1:[1]

Generally, such broad questions in form of "is it possible to ...?" are frowned upon at StackOverflow, but the direct answer would be "yes, it is possible" and moreover, vis.js has an example of a manipulatable graph so I recommend you to read the manupulation methods docs and the manipulation module docs which describe methods like addNode, editNode, deleteNode etc.

However, you should note that all the interfaces are usually implemented outside the graph-containing canvas, in html (+js) because it's not trivial to put them inside canvas and, say, show attached to all nodes.

Solution 2:[2]

For those who (like me) trying to find js libraries for creating interactive graphs here is the list:

Click on images for better quality.

react-flow | demo

react-flow preview

vis-network | demo

vis-network preview

DAG-ToDo | demo

DAG-ToDo preview

flowy | demo

flowy preview

jsplumb | demo

jsplumb preview

react-diagrams | demo

react-diagrams preview

butterfly | demo

butterfly preview

Drawflow | demo

Drawflow preview

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 superpupervlad