# 3D / VR / AR Force-directed Graph

**URL:** <https://forum.babylonjs.com/t/3d-vr-ar-force-directed-graph/49886>\
**Category:** Demos and projects\
**Created:** [April 21, 2024, 9:48pm UTC](https://forum.babylonjs.com/t/3d-vr-ar-force-directed-graph/49886 "2024-04-21T21:48:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![apowers313](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/apowers313/32/38132_2.png) [@apowers313](https://forum.babylonjs.com/u/apowers313)\
**Post date:** [April 21, 2024, 9:48pm UTC](https://forum.babylonjs.com/t/3d-vr-ar-force-directed-graph/49886/1 "2024-04-21T21:48:25Z")

</div>

I made a [3D force-directed graph](https://github.com/apowers313/babylon-forcegraph) (inspired by the [Three.js 3D Force-Directed Graph](https://github.com/vasturiano/3d-force-graph)).

Basic demo running on an iPad:

[![](https://i.vimeocdn.com/video/1838040005-bb990f08425dcf13a43c11b29102da8bbdaddd7504c44f087a7b9b053f6b2bcd-d?f=webp "BabylonJS 3D Force-directed Graph Demo") ](https://vimeo.com/937464763)

AR / VR styles demo running on a Meta Quest 3:

[![](https://i.vimeocdn.com/video/1838030407-cd1d212ee22232ba08e70480a205f54efce1eb1c9aed1407b650f2ed0011b660-d?f=webp "BabylonJS Force-Directed Graph in VR / AR") ](https://vimeo.com/937459209)

Demos:

- [Basic](https://apowers313.github.io/babylon-forcegraph/examples/basic.html) ([source](https://github.com/apowers313/babylon-forcegraph/blob/master/examples/basic.html)): The simplest of demos.
- [Styles](https://apowers313.github.io/babylon-forcegraph/examples/styles.html) ([source](https://github.com/apowers313/babylon-forcegraph/blob/master/examples/styles.html)): Get a random style every time you reload the page.
- [Pretty](https://apowers313.github.io/babylon-forcegraph/examples/pretty.html) ([source](https://github.com/apowers313/babylon-forcegraph/blob/master/examples/pretty.html)): Custom node and skybox textures.
- [Loading JSON data](https://apowers313.github.io/babylon-forcegraph/examples/json_data.html) ([source](https://github.com/apowers313/babylon-forcegraph/blob/master/examples/json_data.html)): Example of loading nodes from a [JSON  
file](https://github.com/apowers313/babylon-forcegraph/blob/master/examples/data/miserables.json) that contains 77 nodes and 253 edges.
- [Expanding](https://apowers313.github.io/babylon-forcegraph/examples/expanding.html) ([source](https://github.com/apowers313/babylon-forcegraph/blob/master/examples/expanding.html)): Double click on a node to dynamically load the related nodes.
- [D3 Graph Engine](https://apowers313.github.io/babylon-forcegraph/examples/graph_engine.html) ([source](https://github.com/apowers313/babylon-forcegraph/blob/master/examples/graph_engine.html)): Layout using the [D3 graph engine](https://github.com/vasturiano/d3-force-3d). (Default engine is [ngraph](https://github.com/anvaka/ngraph.forcelayout))
- [Events](https://apowers313.github.io/babylon-forcegraph/examples/events.html) ([source](https://github.com/apowers313/babylon-forcegraph/blob/master/examples/pretty.html)): Example of catching events from graphs, nodes, and edges. Open up the JavaScript Developer Console to see the `console.log` messages when events are caught. Also prints graph statistics when the graph settles.
- [Large Graph](https://apowers313.github.io/babylon-forcegraph/examples/large.html) ([source](https://github.com/apowers313/babylon-forcegraph/blob/master/examples/large.html)): A graph with 1238 nodes and 2602 edges.

---

<div class="post-metadata">

**Author:** ![One\_Flag](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/one_flag/32/23226_2.png) [@One\_Flag](https://forum.babylonjs.com/u/One_Flag)\
**Post date:** [April 22, 2024, 9:18am UTC](https://forum.babylonjs.com/t/3d-vr-ar-force-directed-graph/49886/2 "2024-04-22T09:18:57Z")

</div>

Wow this is so cool! Thanks for sharing. 😍
