Community Detection on Notes with Org-Roam and D3

Table of Contents

I just released https://github.com/peixian/org-roam-force-graph/, which is a tool to help map out notes stored in org-roam. It's released under a BSD 3 clause and there's an example at: https://wiki.malloc.dog/graph.html.

It incorporates cdlib, a community detection library in Python and uses the D3 force-simulations to try and tease out the shape of notes.

1. Why?

Currently, for org-roam users, there's a tool called org-roam-server that accomplishes similar goals. The problem I had with org-roam-server is that my notes are largely accessed through my personal wiki, and org-roam-server requires an active emacs process. Plus this was a good chance for me to actually learn some D3.

2. Interesting Finds

This is my current graph:

current-graph.png

The structure from the force diagram itself is already pretty clear:

  • giant block in the north is a mess of books/papers/topics relating to my grad school work
  • web at the south is all the notes related to computers
  • less dense block to the right is related to finance

What's interesting about the community detection is that it can detect things that the force diagram doesn't show you:

current-graph-iraq.png

Here, I've got all my notes with connections to Iraq highlighted. While most of them are the same color, the ones that are not are colored because the Leiden community detection algorithm put them into another group, in this case, the group of things relating to "foreign fighters".

What I like about this structure is that it's three dimensional: the physical 2D space of the force diagram is set using the links embedded into the graph, while community detection on top of the graph reveals structures that are hidden.

In the future I'm hoping to add some additional features, such as searching and auto prompting for similar notes to allow for better thinking on how notes relate to each other.

Posted: 2020-12-19
Filed Under: computer