To Map A Brain: Graph Metrics for Obsidian
tl;dr
I built a plugin for Obsidian that identifies paths and network metrics between your notes. It's currently in beta on Github. Also, finding connections between your notes is a lot of fun and I recommend you do it even if not with this plugin.
I love graphs, networks, and systems. The stucturing and directionality of data is so immensely satisfying to me, which I take as explanation for my interest in software engineering and likely my many, many hours in Factorio and similar logistics games. I wanted to see the flow of my thoughts under the lens of network metrics and through the shortest paths from one note to another. The insights I gained were more valuable, and at the least quite interesting, than I expected.
See the breadth first-hand
The plugin at its core is quite simple: it shows you the paths between your notes. But not just any paths—it reveals the types of connections. Direct links. Backlinks. Tag connections. Embedded content links. It's like tracing your finger across a map and saying, "Here's how your thoughts connect, and this is the nature of each connection."
What makes this particularly fascinating is how it exposes the weird architecture of personal knowledge. I've been creating notes for years, often haphazardly, sometimes meticulously, but always with a vague sense that I was building something. There's a thought terrain composed of thousands of notes across all different topics and it's delightful to find a path from a dream I had years ago through a journal entry from last month, to a note about my learning experience with Haskell.
Naturally, this plugin isn't too useful for very small vaults. I've opted for mega-sized ones— I recommend you at least try to aggregate yours at some point— since I realized that everything in my lifeno matter how thematically different, has a connection to another thought.
A neural net but way less awesome
There's an old theory about six degrees of separation—the idea that all people are six or fewer connections away from each other. From what I've seen in my own repository, our thoughts might follow similar patterns.
When I ran the first analysis on my vault, I expected vast distances between disparate topics. Instead, I found that most of my notes were connected by four degrees or fewer. My notes on film criticism connected to my programming notes through a shared reference to visual patterns. My personal journal entries linked to a mini-essay on literary canon I wrote many years ago through a movie I like.
Another pleasing graph game: trying to navigate from one Wikipedia page to another using wikilinks.
What's particularly eerie is seeing "These two notes are separated by 4 degrees." It's a quantification of conceptual distance, a measurement of how far apart different parts of my thinking have drifted. I found myself analyzing the shortest path between my work on corporate aesthetics and my half-finished notes on website development. Three steps. Why three? What mental highways have I constructed without realizing it?
The plugin exposes "connector notes"—those central hubs that bridge different clusters of thought.
"Why couldn't I just count the edges in graph view?"
Everytime I make something, I have an internal skeptic who asks some variation of "Does making this actually matter? Does it achieve anything?" Often, I push through and stifle his fears (though sometimes I concede). This time, he pestered, "Obsidian already has a graph view. Can't you just count the hops between nodes? And who cares about network metrics?"
For the first question, technically yes. You could squint at the default graph, carefully trace paths with your finger on the screen, and manually count the hops between notes. In the same way you could count your calories with an abacus. But that misses the entire point.
As for "who cares": I do! That's what to remember on any personal project.
The default graph view shows you a sprawling visualization of your entire vault. It's beautiful, hypnotic even, and I find myself excitedly clicking on it often to see how its evolved since I last checked. But if you try finding the shortest path between two specific notes in that tangled web, it's like trying to find the shortest driving route between two cities by looking at a satellite photo of Earth at night.
What Graph Metrics does is fundamentally different. It doesn't so much visualize; it analyzes. It tells you not just that a path exists, but what specific notes form that path. It shows you not just that notes are connected, but how they're connected—whether by direct links, backlinks, tags, or embedded content.
More importantly, it reveals critical metrics that are invisible in the default graph:
- Which notes serve as key connectors between disparate clusters
- How densely interconnected a note's neighborhood is
- Which alternative paths exist beyond the shortest one
That's my defense for this plugin's existence. Though really, a simple "I wanted to" was probably sufficient.
Selfishly, for me. Unless you like it.
Is it an extraordinarily niche tool? Absolutely. It serves a narrow intersection of people who both maintain extensive note collections and care about the network properties of those notes. That's probably a tiny fraction of even Obsidian's user base. And the market for a Friday night mini side project (it's literally three Typescript files) probably isn't that substantial.
There's something beautiful about that—about building tools that serve our own curiosities first, and finding that a handful of others share those same curiosities. I wrote a mod for Factorio years ago that merely added enhanced versions of existing items— it was for a single co-op playthrough. I never expected anybody else to use it, but I received a message that I read years too late asking for an update: I am so sorry for never getting back to you, fellow player! But I was extremely happy that a stranger found my silly mod worthwhile.
You're talking about Factorio again. How does the plugin work?
Sorry!
When I first started designing the graph representation, I knew I needed something more nuanced than typical adjacency matrices or lists. Neither would capture the rich metadata about connections that makes the visualization truly useful.
At its core, the plugin uses what's called an EnhancedGraph
type (the 'Enhanced' being equivalent of naming your project files "new-main") - essentially a Record mapping node paths to Maps of their connections:
export type EnhancedGraph = Record<string, Map<string, ConnectionInfo>>;
export interface ConnectionInfo {
type: ConnectionType;
commonTags?: string[];
metadata?: {
title?: string;
tags?: string[];
excerpt?: string;
};
}
This structure allows the plugin to differentiate between a direct wiki-link, a backlink, a tag-based connection, or an embedded content link. It's this granularity that makes the visualization so useful - knowing how notes are connected often reveals more than simply that they're connected.
For smaller vaults, a standard breadth-first search works well (even better, in some cases, due to reduced overhead). But for larger vaults (with a very arbitrary cutoff at 500 notes/nodes), I implemented a bidirectional search that explores from both the start and end simultaneously:
if (graphSize < 500 || this.settings.algorithmPreference === 'original') {
return this.findShortestPathOriginal(graph, start, end);
} else {
return this.findShortestPathBidirectional(graph, start, end);
}
Another instance of my poor naming schema!
The bidirectional search maintains two separate "frontiers" that expand outward from both the start and end nodes. When these frontiers meet, it constructs the complete path by stitching together the two halves. This approach can reduce the search space exponentially compared to a unidirectional search—essential for maintaining the "six degrees or fewer" responsiveness that makes the tool actually usable.
Where it falls short
It's not perfect. I wish it had visualization modes beyond the text-based path displays. Sometimes I want to see a miniature graph of just the relevant notes rather than a linear path. And the clustering coefficient calculations (which measure how interconnected a note's neighbors are) can slow down with very large vaults. And frankly, I just don't know yet how to write fast Typescript. I felt gross at even needing a progress bar for a graph with relatively few nodes; I've been working in Haskell and C recently so my patience for compilation had to be translated to patience for runtime. Optimizations will come.
The centrality and clustering coefficient calculations use sampling techniques that keep computation feasible. For instance, when calculating betweenness centrality (which measures how often a node appears on shortest paths), it doesn't exhaustively check all possible node pairs, which would be O(n²) - instead, it takes a sample.
Should my notes exist as an archipelago?
What I find most fascinating isn't the plugin itself but what it reveals about my digital thinking. Some parts of my Obsidian vault exist as tightly connected clusters with no bridges between them. Islands of thought, separated by the empty sea of unconnected concepts.
Is that a problem? Not necessarily. My notes on film reviews probably don't need to connect deeply with my project management system. But seeing these archipelagos made me wonder: what potential connections am I missing? What unexpected insights might emerge from building bridges between these isolated domains?
I'm not suggesting we should consciously connect everything to everything else. That would be chaos. (I do it anyway). But there's something valuable about occasionally looking at the macro structure of our thinking and asking, "Is this isolation intentional or accidental?"
If you want...
If you care to try it and provide me with wisdom on how to improve its functionality, its speed, or to send me a picture of your cat (contact me), I'd be happy to hear it. It's currently in beta on Github; you can use BRAT to install it.
Either way, go take some notes!