Export Graph to a network graph format

It would be great if you could make a feature where it was possible to export the graph to a Network Graph format.
Either Graphviz (dot), GraphML or even better to a RDS format like JSON-LD.

And let the export be somehow customizable, so that the user can map their Tag’s, Keywords, Headers, Body of text and other information to the corresponding fields/objects in the export format.

11 Likes

I think this once the Markdown conversion tool is ready this would be a great plugin or 3rd party script.

Agree, this would be really neat.

(Aside: I removed the “ Wishlist No. 1 - ” from the title, hope that’s okay. We’re trying to avoid this kind of competing for attention in feature requests!)

1 Like

Hah! Gotta admire the mind for both having a top 10 and forgetting 90% of it. That’s why we have apps like Obsidian, I suppose.

1 Like

Would be great to export the graph statistics to a .CSV format as well. Many softwares can import .csv files and than make other types of operations with it. Like Gephi, a specialized software to produce graph visualizations with outstanding plugin capabilities.

OR, I wonder if would be possible to transform the graph links into a new note with a table, where the #hashtags are the category columns, and the notes are the lines, and in some way, a extra line in the end with the total number of notes linked to that hashtag.

1 Like

I’ve seen some discussions about this on the discord, and I’m curious if this has been implemented already in a plugin or script. Re-surfacing this thread in case someone has an update.

Update found this related thread:

Hello @amanqa, one could transform the obsidian graph into a well known graph library, to afterward generate the desired graph.

I played a little with a python library called networkx, to read my obsidian vault prototype_05/obsidian_graph.py at master · cristianvasquez/prototype_05 · GitHub.

When you have the networkx object you can export it to some graph formats GML, GraphML, matrix etc, Reading and writing graphs — NetworkX 2.5 documentation

1 Like

I’ve built a new Python package obsidiantools that integrates closely with NetworkX. With Python becoming the main language for the science community, for things like graph analysis, I think it’ll be worthwhile for there to be more integration with NetworkX.

Cristian’s link on the file IO options for NetworkX is handy reference… NetworkX is a very powerful part of the Python data stack.

This is the code you need to get a NetworkX graph G:

import obsidiantools.api as otools

vault = otools.Vault(<VAULT_DIRECTORY>).connect()
G = vault.graph  # networkx graph

This is how a basic vault looks like visualised in my package demo through Matplotlib:

With NetworkX you can also make subgraphs to filter the notes. I have some markdown file readers in the backend but they’re not exposed in the main API yet until I think more about the design I’d want (maybe have plaintext notes stored in JSON).

1 Like