# \[RFC\] Interactive Visualization and Explorer Tool

**URL:** <https://org-roam.discourse.group/t/rfc-interactive-visualization-and-explorer-tool/87>\
**Category:** Graphing Capabilities\
**Created:** [May 8, 2020, 7:04am UTC](https://org-roam.discourse.group/t/rfc-interactive-visualization-and-explorer-tool/87 "2020-05-08T07:04:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Memex](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Memex](https://org-roam.discourse.group/u/Memex)\
**Post date:** [May 8, 2020, 7:04am UTC](https://org-roam.discourse.group/t/rfc-interactive-visualization-and-explorer-tool/87/1 "2020-05-08T07:04:43Z")

</div>

Few weeks ago I started to build an interactive graph visualizer and integrated note browser (see a demo [here](https://orgroam.slack.com/archives/CV20S23C0/p1588161804087200?thread_ts=1587141004.382000&cid=CV20S23C0)). At first it was just a personal project and curiosity. However, the community showed appreciation and interest in the tool, and graphing capabilities of org-roam became a central discussion topic with many ingenious proposals. Right now I think it is a good idea to consider building it at full scale, and that’s why I need your comments on a few things.

### Architecture

There are a few possible ways to organize the codebase.

At its core, what I am doing is just taking a JSON file (relationships between nodes and edges) and some HTML files (org-publish of the entire org-roam directory) and displaying them in a webpage using a http-server.

Now, I think this much should be a package separated from org-roam (primarily because this is not written in Elisp).

However, I am not sure what to do about the conversion of the SQL database to a JSON file part. This can be done in any language (and to do it incrementally, I think we should do it from Emacs, but I am not sure about scalability and performance). If we are doing it in Emacs using Elisp, should this be part of `org-roam` codebase? If not using Elisp, what other option do we have?

Also, as I am displaying backlinks below each file in the note browser, `org-publish` needs to be force called on file X each time I reference file X in any other file. I am not sure if this will cause performance issues since AFAIK `org-publish` is synchronous in nature. Would love to know if someone has a better idea.

### Modularity and Other Graphing Features

Clustering and centrality measures seem to be the most sought after features. I think it is possible to achieve these using something like igraph where we add extra information in the JSON file. However, I am not sure if this can be done incrementally, as it would most possibly require computation using the entire database (which is compute-expensive). What are our options then?

### Packaging

Right now, I am using a shell script that generates the JSON database and starts an http-server. This is complicated to setup cause you have to manually modify some parts of your Emacs dotfile as well. What would be the most user-friendly option for packaging this entire thing?

I welcome all of your comments, questions, and suggestions.

---

<div class="post-metadata">

**Author:** ![jethro](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@jethro](https://org-roam.discourse.group/u/jethro)\
**Post date:** [May 8, 2020, 7:15am UTC](https://org-roam.discourse.group/t/rfc-interactive-visualization-and-explorer-tool/87/2 "2020-05-08T07:15:49Z")

</div>

> [@Memex](#):
>
> Now, I think this much should be a package separated from org-roam (primarily because this is not written in Elisp).

This is fine, we’ll be rearchitecting Org-roam in a way that should help with integration with other graphing backends.

> [@Memex](#):
>
> However, I am not sure what to do about the conversion of the SQL database to a JSON file part. This can be done in any language (and to do it incrementally, I think we should do it from Emacs, but I am not sure about scalability and performance). If we are doing it in Emacs using Elisp, should this be part of `org-roam` codebase? If not using Elisp, what other option do we have?

We should have JSON output from within Org-roam, it’s not too big an issue, will at least be as performant as the current graphviz output.

> [@Memex](#):
>
> Also, as I am displaying backlinks below each file in the note browser, `org-publish` needs to be force called on file X each time I reference file X in any other file. I am not sure if this will cause performance issues since AFAIK `org-publish` is synchronous in nature. Would love to know if someone has a better idea.

This is probably not a good idea. You can use Emacs to run a batch script to run `org-publish` instead, rather than blocking the main Emacs instance.

By the way, there’s a graphing server already open-sourced in the wild: [GitHub - org-roam/org-roam-server: A Web Application to Visualize the Org-Roam Database](https://github.com/goktug97/org-roam-server/)

I think an exchange of ideas/collaboration on this front could be fruitful.

---

<div class="post-metadata">

**Author:** ![tecosaur](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/tecosaur/32/9_2.png) [@tecosaur](https://org-roam.discourse.group/u/tecosaur)\
**Post date:** [May 8, 2020, 7:29am UTC](https://org-roam.discourse.group/t/rfc-interactive-visualization-and-explorer-tool/87/3 "2020-05-08T07:29:00Z")

</div>

A quick question from me, @Memex why couldn’t a standalone HTML file work? We can run scripts, fetch local files, etc.

---

<div class="post-metadata">

**Author:** ![Memex](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Memex](https://org-roam.discourse.group/u/Memex)\
**Post date:** [May 8, 2020, 8:30am UTC](https://org-roam.discourse.group/t/rfc-interactive-visualization-and-explorer-tool/87/4 "2020-05-08T08:30:00Z")

</div>

@tecosaur I am not an expert in web development but seems like loading other HTML files in an iframe is much easier using a server.

@jethro Wow. This project makes me question whether I should continue with my efforts or not. While I can think of some reasons why even having two different implementations of graphing would be a good idea, I’m not sure if net productivity would be worth that.

---

<div class="post-metadata">

**Author:** ![tecosaur](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/tecosaur/32/9_2.png) [@tecosaur](https://org-roam.discourse.group/u/tecosaur)\
**Post date:** [May 8, 2020, 9:00am UTC](https://org-roam.discourse.group/t/rfc-interactive-visualization-and-explorer-tool/87/5 "2020-05-08T09:00:54Z")

</div>

> [@jethro](#):
>
> By the way, there’s a graphing server already open-sourced in the wild: [GitHub - org-roam/org-roam-server: A Web Application to Visualize the Org-Roam Database](https://github.com/goktug97/org-roam-server/)

This looks great! I’m always a fan of extending a good existing solution (when one exists) over doing everything from scratch 😃

---

<div class="post-metadata">

**Author:** ![mpick](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@mpick](https://org-roam.discourse.group/u/mpick)\
**Post date:** [May 10, 2020, 4:16pm UTC](https://org-roam.discourse.group/t/rfc-interactive-visualization-and-explorer-tool/87/6 "2020-05-10T16:16:58Z")

</div>

Maybe this could go into #dev:graph ?

Just adding to the conversation : it seems like [Obsidian](https://obsidian.md/) beta uses G6 or similar. It’s beautiful, interactive, useful.  
They make the node size proportional to the number of links to/from other nodes, and it seems to work well.

Clicking a node title simply opens it for now.

 ![Obsidian_graph](https://global.discourse-cdn.com/free1/uploads/orgroam/original/1X/6c123bb6074aa304ad3a796b9a069c205ad4b8db.png)

When the mouse hovers over a node title :

 ![Obsidian_graph_hover](https://global.discourse-cdn.com/free1/uploads/orgroam/original/1X/f75908ea8390874ee31f4b49094dc6697e553ef0.png)

---

<div class="post-metadata">

**Author:** ![mpick](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@mpick](https://org-roam.discourse.group/u/mpick)\
**Post date:** [May 14, 2020, 2:13pm UTC](https://org-roam.discourse.group/t/rfc-interactive-visualization-and-explorer-tool/87/7 "2020-05-14T14:13:55Z")

</div>

Edit : from a discussion in Obsidian’s Discord, it’s [https://d3js.org/](https://d3js.org/) not G6.
