Neighbourhood Graph

approvedunreviewed

by agilesmagile

Interactive D3.js force-directed graph showing the current note's neighbourhood in a sidebar panel. Nodes connected by shared tags and backlinks.

★ 2 stars↓ 1,329 downloadsUpdated 6mo agoMIT

Neighbourhood Graph

An Obsidian plugin that shows the current note's neighbourhood as an interactive force-directed graph in a sidebar panel. Navigate your vault by exploring connections between notes, shared tags, and backlinks.

Neighbourhood graph in the sidebar, with colour groups and size by relevance

What it does

Opens as a right-sidebar panel. As you navigate between notes, the graph recentres on the active note and shows:

  • The focus note highlighted with an amber glow, largest node
  • Neighbour notes connected via shared tags or backlinks, sized by relevance
  • Shared tag nodes (diamond shapes) representing tags that connect notes
  • Typed edges when Excalibrain is installed. Related notes get distinct line styles

Hover any node to highlight its connections. At depth 2, secondary connections also light up, revealing the structure around any note in the neighbourhood.

Hovering a node highlights its direct and secondary connections

Interactions

ActionBehaviour
Hover nodeHighlights direct connections (and secondary connections at depth 2)
Hover edgeShows the relationship type if the edge is a typed Excalibrain relationship
ClickRecentres the graph on that note
Double-clickOpens the note in the editor and recentres
DragRepositions a node
ScrollZoom in and out

Installation

From the community plugin directory

  1. Settings > Community plugins > Browse
  2. Search "Neighbourhood Graph"
  3. Install and enable

Manual install

  1. Download main.js, manifest.json, and styles.css from the latest release
  2. Create a folder at <your vault>/.obsidian/plugins/neighbourhood-graph/
  3. Copy all three files into that folder
  4. Settings > Community plugins > reload and enable Neighbourhood Graph

Settings

There are two places to configure the plugin:

Floating panel (gear icon on the graph)

Quick access to the controls you reach for most often.

SettingDescriptionDefault
Highlight depthTiers of connections highlighted on hover. 1 = direct only. 2 = direct + secondary.2 hops
Max neighboursCap on displayed notes. Most strongly connected shown first.30
Size by relevanceHow much node size varies by connection strength. 0 = uniform, 10 = dramatic.5
Max node sizeMaximum radius in pixels of the largest neighbour node. Reduce for a compact sidebar.10

Physics sliders. Four controls for tuning the layout: line colour, line thickness, spread (repulsion), and link pull (clustering). Changes apply live as you drag. The graph is not rebuilt.

Plugin settings tab (Settings > Neighbourhood Graph)

SettingDescriptionDefault
Highlight depthSame as the floating panel.2 hops
Max neighboursSame as the floating panel.30
Max node sizeMaximum node radius. Reduce for compact sidebars; increase for full-panel views.10
Show path in tooltipDisplay the vault-relative folder path when hovering a note node.On
Default node colourColour used for notes not matching any colour group. Falls back to your theme's accent colour.Theme accent

Colour groups

Assign colours to notes by query. Three query types are supported:

  • path:people/ matches notes whose path starts with people/
  • tag:#project matches notes carrying the #project tag
  • Plain text matches against the note title

First matching rule wins. Groups are collapsible in the settings tab once at least one exists. Use the Import button to copy colour groups directly from Obsidian's built-in graph view.

The floating settings panel, with import from graph view

Excalibrain integration

If Excalibrain is installed, this plugin reads its typed relationship fields from note frontmatter to draw distinct edge styles and weight connections more accurately.

RelationshipEdge styleDefault frontmatter fields
Parent / childSolid lineParent, Parents, Children, Child, up, down
FriendDashed lineFriends, Friend, similar, supports, alternatives
OpposesDotted lineopposes, disadvantages, cons
Previous / nextDash-dot linePrevious, Next, Before, After

The plugin detects three states:

  • Not installed: plain edges only. The settings tab explains how to get Excalibrain
  • Installed, not yet opened: uses Excalibrain's built-in English field names
  • Installed and configured: reads your saved Excalibrain settings automatically

Toggle the integration on or off with the Use Excalibrain relationships toggle in the settings tab. When active, typed links receive a strength bonus so they rank higher in the neighbourhood.

Hover any typed edge to see the relationship label ("parent of", "friend", "opposes", etc.) in a tooltip.

Typed edges: solid parent, dashed friend, dotted opposes, dash-dot previous and next

The legend in the top-left of the graph panel shows edge style swatches that reflect your current line colour and thickness settings, so the key always matches the graph.

How it works

The plugin reads Obsidian's metadata cache for tags, resolved links, and frontmatter links. No custom frontmatter is required for basic use. Neighbours are scored by connection strength:

  • Shared tags between the focus note and a neighbour
  • Direct wikilinks (outbound and inbound)
  • Bidirectional links score higher
  • Well-connected hub notes rank higher (logarithmic scaling)
  • Excalibrain-typed relationships receive an additional strength bonus

The top N neighbours (configurable) are shown. Node size reflects relevance to the focus note. Scaling is anchored to the displayed set, so the size range is always fully used, however many notes are capped.

Works well with

Graph Label Above moves node labels above nodes in Obsidian's full graph view, so an enlarged mouse pointer does not hide them. A natural companion if you use both graphs.

Development

Screenshots in docs/ are generated, not hand-captured. npm run screenshots builds the plugin into the demo sandbox vault, launches Obsidian with a remote debugging port, drives it over the Chrome DevTools Protocol, and writes each shot from a fixed focus note. Change the SHOTS list in scripts/screenshots.mjs to add or retune a shot.

Licence

MIT

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.