An open API service indexing awesome lists of open source software.

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

Python library to build graphs out of org-roam collections
https://github.com/aatmunbaxi/org-roam-pygraph

org-mode org-roam org-roam-ui personal-knowledge-management python

Last synced: 6 months ago
JSON representation

Python library to build graphs out of org-roam collections

Awesome Lists containing this project

README

          

#+title: Your Zettelkasten, usable in Python
#+author: aatmunbaxi
#+created: Sat May 06, 2023

*Notice: This library is deprecated in favor of [[https://github.com/aatmunbaxi/orgroamtools][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.

#+caption: My org-roam database visualized with =networkx=
[[file:images/COVER.svg]]

* What is this?
Inspired by [[https://github.com/org-roam/org-roam-ui][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 [[file:demo.org][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.
#+begin_src sh
git clone https://github.com/aatmunbaxi/org-roam-pygraph
#+end_src

It is recommended to use a Python virtual environment.
If you opt to use one, initialize and enter it according to the [[https://docs.python.org/3/library/venv.html][documentation]].
In Unix-like operating systems, you can verify you are inside the virtual environment if the output of
#+begin_src shell
which python
#+end_src
points to virtual environment you created.

Install the dependencies
#+begin_src sh
python -m pip install -r requirements.txt
#+end_src

You can now create a file in the base of the git repo directory and start using the library by adding
#+begin_src python
from lib.RoamGraph import RoamGraph
#+end_src
to the imports (see [[file:example.py][example.py]]).

Or you can copy/move the git repo directory to another Python virtual environment.
* Credits
- =org-roam-ui=