Directed Graphs

I’ve been thinking about directed graphs lately and wanted to see how they could look in BabylonJS. I looked up the concept of directed graphs and how they relate to physics, so I think this could be done as well using a physics engine and I may explore that next. I ended up using dagre - it is a directed graph layout that unfortunately relies on pixels. It does show where nodes go and how edges can be drawn. Put up a demo and source code:
https://brianzinn.github.io/babylonjs-directed-graph/

Wondering if anybody has explored building directed graphs in BabylonJS? I would like to model connected graphs and wanted to see what I could come up with quickly. Useful for visualizing workflows, network models, connections, etc.

4 Likes

Love it already :slight_smile: I can see a ton of applications

This shortest path finder uses a direct graph with weighted edges https://www.babylonjs-playground.com/#7YCXAI#2

1 Like

Thanks for sharing @JohnK - haven’t done shortest path stuff since uni, but cool to work through a working 3D example :slight_smile: Dagre supports weighted edges as well - higher weighted edges will generally be made shorter and straighter than lower weight edges. I think it can be visualized in the physical world as a stronger force of attraction between nodes connected with higher weighted edges. There are lots of applications in games with path finding - really interesting field.