Recreating your Graph View in Mathematica, and some other cool tools!

Edit 1: this tool seems to work for some, but not for others. I’ll keep working on it to figure it out :slight_smile:

Edit 2: I’ve redone alot of the code, so it should work more smoothly now. I don’t think diacritics should be a problem anymore.

I have recently been playing around with Mathematica, a programming language created by Stephen Wolfram. It has many builtin functions to analyse graphs, so I thought it would be cool to have my Obsidian graph in Mathematica.
I have created a small web app where users can upload a .zip file of their vault’s root folder, and get some insight into their knowledge base!

By following this link Wolfram App (you may need to create a free account), you will be taken to the app. You will see a screen like this:

In it, you can upload the zip file of your vault first. If you’re not sure how to zip a folder, simply right click on your vault folder, click send to, and then click compressed (zipped) folder. This will create a copy of your vault, and zip it.

Optionally, you can also ask for the shortest path between two notes! In this example, I am highlighting to shortest path between my 000 Home note, and my current daily note 2021-01-15 DN. Just enter them as plaintext, no quotes or anything.

Now you can click submit. The computation may take a few moments, especially for larger vaults. The results for this example are:

My recreated graph view:

As compared to my actual graph view:

An adjacency matrix of your graph. Think of this as a fingerprint of your vault.

A community graph, in which Mathematica’s algorithms find clusters in your graph

And the part I like the most, the shortest path between any two connected notes!

Play around with it, and please feel free to share your results! I am also open to suggestion for features which I might integrate when I have time. Thank you for taking the time to read this :slight_smile:

9 Likes

I don’t feel like uploading my whole vault, can I also do this with only one folder of my vault?
Because when I try it like that it doesn’t work.

1 Like

Yes, you can upload a zip file of any subfolders in your vault and it should still work.
I see a few people are having a problem with it. When I’m with my pc again I’ll try get it working

Having spoken with some people on the Discord, it seems that the issue is on Mathematica’s side. The free Wolfram account only allows for very limited cloud computation times. So it should still work on smaller vaults, but not on larger ones unless the user has a paid account.
This is a shame. I will try speed up the code and get back to you

Might it be because I use non-standard characters in my links?
Because your Regex posted on the discord didn’t work for me.
To find all the links in my vault and exclude block references and headings I need this Regex:
\[\[([§\w\döäüßâèéêàæëÿçüûîôùïœ\s\.]+)[\^#]?(?:.*)?\]\]
The g and i flags are enabled.

There is a solution to make this Regex prettier, but it doesn’t work in the browser curiously enough…

Public update: The Regex discussion has moved to a private chat.

Very good point, I didn’t even consider diacretics. Thank you for this, as soon as I’m able I will update the regex in the code

@SkepticMystic Great Post! Does this still work in version 12.2? Also, are you able to write mathematica code in obsidian? Doesn’t look like it support matheimatica syntax in markdown code blocks… Is there a plugin you use or recommend?

Hey topgun! I haven’t looked at this code in months, I’d be surprised if the cloud hosted version still works :sweat_smile:
But, I have recently written a Templater snippet which does something very similar, all using javascript! All you have to do is copy paste the code into an Obsidian note, then run it as a Templater template. It will create an adjacency matrix of your vault as an image in your root folder, similar to this:

1 Like

Hey this is cool stuff! Is the Mathematica code downloadable? It would be nice to run this locally. The Templates snippet is neat, but I’d also like to play with the Mathematica graphs.

Hey @SkepticMystic,
As a complement to my comment on the AdjacencyMatrix plugin github rep, i just stumbled here as well.
As the cloud Wolfram Mathematica App is down, do you think you could share either the wolfram code here, or under a Wolfram CDF player format, eventually ?
Thanks a lot, have a nice One & see you around !
Damien

@Code @dyab unfortunately, I haven’t had a Mathematica subscription in a long time, so my Cloud files have expired.

Ok @SkepticMystic thanks for the answer about that !
Would you please have some clues about what has been asked here by any chances ?
At least, could you indicate me where to look in the code when you build the adjacency matrix, for instance, if you do not have time to properly edit it by yourself ?

Sure thing, I’ve replied on the issue :slight_smile:

1 Like

Thanks a lot @SkepticMystic ! \°/

I guess that the Adjacency Matrix Maker has to be installed, enabled, runned… and then the snippet to be executed in the console so that the JSON export works, am i correct ?

Meanwhile i managed how to open the Obsidian console thanks to this wonderful forum :wink:

Have a good one, i let you know in the github once i would have done a proper test !

You don’t have to have Adjacency Matrix Maker installed for that snippet to work!
Simply paste into the console, and run it.
The problem is exporting that JSON object to a JSON file, you may need to research how to do that

1 Like

Ok thanks a lot Ross @SkepticMystic for the precisions ! I will investigate that then, as well as the difference between a JSON object vs a JSON file at the first place ! :wink:

Do you have the mathematica source code? The cloud deploy seems to no longer be working. Thanks!