Export Graph to a network graph format

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