Obsidian graph to gephi

Hi folks - I’ve seen a couple of threads requesting or asking for some ways of getting the graph out of obsidian into something else for visualization or analysis. I’d like to do this too; it seems to me that network metrics like centrality or modularity (community detection) would be useful to know - how do my notes/ideas cluster? which ideas hold everything together?

I managed a bit of a kludgy way to do this this morning; I imagine someone could probably turn this into a single python script (alternatively, maybe there’s a way to calculate centrality/modularity as a plugin for obsidian). Anyway, here goes -

1 - find the json file in obsidian/ObsidianCache that represents the vault I’m interested in
2 - use jq to get the note title and the note links; something like .metadata[] | [.frontmatter.title, .links] gets me most of the way there
3 - convert the result to csv
4 - manually clean things up so I have two columns, source and target; save as csv
5 - import into gephi

Anyway, ta da - my little vault in obsidian, and now in gephi:

1 Like

Thanks for this workflow. It seems manageable for small amounts of data. What about importing Gephi data in Obsidian? Any thoughts or examples even out there?

I think many of us would benefit from a reusable graph representation.

Perhaps we can maintain one script that serializes to the most important graph formats.

For example jgraph , that has bindings in Python. This would allow us to serialize our graph into:

  • GraphML
  • Dot
  • GEXF
  • Json
  • GML
  • CSV
  • Dimacs
  • Graph6/Sparse6

The tricky part, I think, is to replicate Obsidian’s autogeneration of internal links, (the shortest path when possible heuristic)

Another option is to extend something that already exists,

AFAIK There is already an exporter to markdown in Rust (Obsidian-export - A rust library and CLI to export an Obsidian vault to regular Markdown) and an exporter to Cypher in Python (Neo4j Graph View Plugin (v0.2.1): Advanced Graph View in Obsidian using Neo4j).

Nice! An alternative workflow is to use the Neo4j Graph View plugin:

  1. Use the plugin to upload your vault into the neo4j graph database format
  2. Export from neo4j to gephi using the streaming plugin

(Thanks for the ping @cristian!)

2 Likes

do you mean, use the pattern of linkages from a network & turn the network nodes into notes?

If the script exports the current pattern of linkages in a network format, then the autogeneration shouldn’t be an issue? But I confess, I am only a week into Obsidian, so I don’t know the issues at all.

Cool, I’ll give that an explore! I do find neo4j a bit intimidating; it’s been on my list of things to explore, so I guess I’ll move it up a few notches now.

1 Like

I feel the same, there are so many things to explore! I believe the Personal Information Management ‘thing’ will be huge.

Is there a exist plugin or script allow convert obsidian to gephi ?

I talk about how I did it in more depth here, towards the end of the piece: https://electricarchaeology.ca/2020/12/30/knowledge-management/

No one script yet, just a series of moves. I intend to try to put it all together into a single python script. Eventually.

3 Likes

Hi, Thank you for sharing.
I recently stumbled on Noda(https://noda.io), a visualization network in VR. Thought it would be super cool to see my Obsidian graph in it.
Noda support importing CSV file, so I’m piggy beg on your method. However, I can NOT find the obsidian/ObsidianCache file you mentioned.
Also maybe I’m using Mac, could you be a bit more specific on where it is? Is it in the value? or is it in the System Application Library file?
Really appreciated it.

Same issue. Can’t find the cache folder on Mac.
Edit: Never mind, I found it.
These are locations, where Obsidian stores preferences and cache:

/Users/username/Library/Preferences/md.obsidian.plist
/Users/username/Library/Application Support/obsidian
1 Like