/org-roam-pygraph

Python library to build graphs out of org-roam collections

Primary LanguagePython

Your Zettelkasten, usable in Python

Notice: This library is deprecated in favor of orgroamtools, a more featureful and now-published library that accomplishes much of the same thing in as close to pure Python as I could make it. This repository is kept up for posterity.

images/COVER.svg

What is this?

Inspired by org-roam-ui, this repo provides a python library to convert org-roam collections into graphs workable in numerical python libraries like numpy and pytorch.

See a demo here.

Features

  • Adjacency matrix of the org-roam network (directed or undirected)
  • Adjacency matrix of network as pandas dataframe
  • Adjacency list of network
  • Distance matrix of network (directed or undirected)
  • Filter network by tags–exact match or regex–inclusive or exclusive

Prerequisites

  • A healthy org-roam2 database
  • Python 3.7+
  • scipy
  • pandas
  • numpy

Getting Started

Clone this repository where you want to use it.

git clone https://github.com/aatmunbaxi/org-roam-pygraph

It is recommended to use a Python virtual environment. If you opt to use one, initialize and enter it according to the documentation. In Unix-like operating systems, you can verify you are inside the virtual environment if the output of

which python

points to virtual environment you created.

Install the dependencies

python -m pip install -r requirements.txt

You can now create a file in the base of the git repo directory and start using the library by adding

from lib.RoamGraph import RoamGraph

to the imports (see example.py).

Or you can copy/move the git repo directory to another Python virtual environment.

Credits

  • org-roam-ui