How I tested a graph-view idea by adjusting my local install

Hey there!

tldr; I wanted to test-drive a small (graph-view) idea I had before making an official feature request, so I started poking around my local install to make it work. As a result, my graph-view works better for me now than before :slight_smile:

Background

I wanted the graph view to adjust the size of nodes based only on the amount of backlinks to that note. Currently, node size is based on outgoing links and backlinks. Hereā€™s how itā€™s currently working and Google BackRub approach for reference.

Process

To change the javascript to test out this feature, I extracted my local installation, edited the lines of code I figured would achieve my result, repackaged the installation and reloaded my running Obsidian app.

After the intitial set up, the workflow is good enough to poke around and test things out quickly.

Result

It works! Yay! My graph-view now renders nodes based on their backlinks only.

Hereā€™s a before and after picture to illustrate with a sample data vault:

Before with default rendering where the ā€œIndex Noteā€ has the same size as the ā€œAuthority Noteā€:

ā€¦and after editing where only the ā€œAuthority Noteā€ has more weight because of its backlinks:

Iā€™m very happy with how it helps me view the graph. When running it against my personal vault, the topography changes for the better for me. Far less noise from index notes. It helps me discover what notes have, over time, become the real ā€œauthoritiesā€ or important topics in my mind-space. That wasnā€™t possible before.

Hereā€™s the workflow in detail for MacOs:

Detailed workflow

  1. Install development dependencies (MacOS)
# Install asar for extracting and re-packaging app
$ brew install npm
$ npm install -g asar js-beautify
$ cd ~/Library/Application\ Support/obsidian
# Note: Your version number may very well differ
$ cp obsidian-0.8.2.asar obsidian-0.8.2.asar.bak
# Extract source
$ asar extract obsidian-0.8.2.asar obsidian-0.8.2
# Beautify obfuscated/minimized js for easier editing
$ js-beautify obsidian-0.8.2/app.js -o obsidian-0.8.2/app.js
  1. Open obsidian-0.8.2/app.js or other files with an editor of your choice.
  2. Make the edits you want to make.
  3. Repackage the app after youā€™ve made your change:
$ asar pack obsidian-0.8.2 obsidian-0.8.2.asar
  1. Then, in Obsidian, reload the app with āŒ˜ R.
  2. Check out how your changes work.
  3. Rinse and repeat from step 3 to step 6

Note: After updating to a newer version, existing changes will be lost unless you start tracking versions somehow on your own.

Hope this is interesting and still counts as a (maybe even nifty) hack.

13 Likes

This is a truly amazing discovery. I agree with you that the backlinks should be criterion for the size of a node. Everyone has their own wishes and ways of using their notes, but to detect important topic in oneā€™s collection of notes/zettelkasten this is it.

I have long been wondering what I could get out of the graph view, how it could help me make better use of the links and what they mean. Now the penny has dropped.

Many thanks and I sincerely hope the devs will take your discovery and its implication into consideration.

2 Likes

Is there an easy way to add this on a Windows installation?

In any case, this looks like any excellent toggle to add to the official Graph view feature.

3 Likes

Totally. For me, best-case itā€™s a discovery tool and in worst-case a nice-to-have toy. Iā€™ll put together a more formal feature request this week.

1 Like

Hi @icebear! I truly donā€™t know much about Windows, Iā€™m sorry.

But the steps probably remain the same. Locate the actual installation and look for obsidian-YOUR-VERSION.asar, get that unpacked, edit and repack in the same location.

I saw your post about the different toggles and I very much agree with you there. It should be possible to switch/combine between size based on outbound and backlinks, word count, directory etc.

Yes please !!

To add to the best-case discovery scenario: The backlinks-based, less-noisy version of the graph-view has helped me discover:

The 1. "Elephants in the Room"

The ā€œelephants in the roomā€, the ā€œblind spotsā€ that live in the space between notes that I either choose to ignore or underestimate.

I can ā€œaskā€ the graph:

  • What am I missing?
  • Whatā€™s NOT in this picture?
  • What note or idea or topic SHOULD be huge but isnā€™t?
  • What am I actively NOT taking note of?

2. The "Pretend-Authorities"

These are heavily backlinked notes that I thought mattered but arenā€™t really important.

I can ā€œaskā€ the graph:

  • Is this really important to me?
  • Does this truly deserve the ā€œair-timeā€ itā€™s getting?

I then remove and clean up those backlinks to down-regulate the notesā€™ relevance.

Hope this makes sense.

Alexis

4 Likes

Alexis, this makes a lot of sense and certainly helps me see more clearly how I can use the graph to contribute to my thinking, if only we eventually get offered the option, somehow, to make the graph view backlinks based.

Once again, my congrats on this excellent discovery, and thanks for helping me see the the forest for the trees, which is what my graph view really looks like.

2 Likes

Hi Klaas! Same to you, thank you for thinking out loud and thinking this through with me.

Iā€™m trying to ā€œlearn in publicā€ by posting comments. (Usually Iā€™ve got major ā€œdigital social anxietyā€ so your kind words help me a lot.)

2 Likes

No need for ā€œdigital social anxietyā€, your wording is fine. In fact, I like the way you state things and explain things. Continue the way youā€™re going, youā€™re doing great !!

1 Like

Thank you @Klaas, will do!

1 Like

@akaalias
Thx for this great thread!
I will definitely try this out.

Grtz,
Rik

1 Like

@akaalias: not quite the same, but this could be a step in the right direction, albeit without a graph.

1 Like

This seems like a great way to improve the graph that I have been looking for!

Howeverā€¦ what does this and step 3.) mean? :slight_smile:

I can open the graph.json in VSC, but there is no mention of backlinks. Could you maybe give an example of the lines that need to be edited?

The OP made another post where he mentioned the exact lines he touched to get this result. He mentioned it in his first post. Here is a link to it againā€¦ Graph nodes size should also depend on word count in addition to no of links - #5 by akaalias

PS: It would be great to get a toggle to switch this setting on or off.

1 Like

This is embarrassingā€¦ I didnā€™t click the link because I misunderstood ā€œhow itā€™s currently workingā€ to mean the default setting of Obsidian being contrasted with Google BackRub. So thank you very much for taking the time to point out the obvious! :upside_down_face:

Also +1 for having this implemented as a feature.