Skip to content
Mark Farragher edited this page Jan 5, 2023 · 7 revisions

Home

Welcome to the obsidiantools wiki! This wiki gets more into the technical detail beyond the demo.

Slight differences from Obsidian app behaviour

Graph differences

These are some differences in how the NetworkX graph in this package appears versus the graph in the Obsidian app, which I don't want to change as I think these differences are more intuitive for graph analysis:

  • The graph will include 'self loops', but the Obsidian app does not show these. For example, if note foo has a wikilink [[foo#bar]], then the graph will show a foo->foo link, but the Obsidian app would not show a 'self loop'.
  • The package will show foo in backlinks_index / wikilinks_index keys, as 'note names', if both these conditions hold: i) foo file doesn't exist yet; ii) the only wikilinks in the vault to the note are via a header (e.g. [[foo#bar]]). In the Obsidian app, the graph will have the non-existent note labelled as foo#bar, but I think it's more intuitive to think of all the MD files in the graph as a notes, rather than having notes and note sections as graph node labels.
  • If note foo has many wikilinks to bar, the package's graph will include an edge (arrow) for each wikilink, whereas the Obsidian app will only show one arrow. For example, if foo has 4 links to bar, there will be 4 foo->bar edges stored in the graph.

The graph won't reflect the Obsidian app's graph if you use relative paths to notes in your wikilinks like [[.foo]] & [[..bar]]. That's a bit too complex for the package to cover. The package tries to capture behaviour of the 'Shortest path when possible' setting for new links.

Graph

The vault.graph will reflect these graph settings in the Obsidian app:

graph-settings

You can make a subgraph via these recipes to change the 'Existing files only' and 'Orphans' settings.

There is no way yet to include 'Tags' or 'Attachments' in the obsidiantools graph.

The philosophy of obsidiantools so far has been to focus on the notes themselves as entities in a graph. That way, it's possible to do graph analysis on your notes and do NLP analytics on your notes, complementing what you can do in the Obsidian app.

Subgraph

Create a list of graph nodes, nodes_list, and make an object of the subgraph via this snippet:

G = vault.graph.subgraph(nodes_list).copy()

Now, the nodes_list examples below can give you ideas of how to reflect changes to 'Existing files only' and 'Orphans' settings.

Untoggle orphans setting

nodes_list = list(set(vault.graph.nodes())
                  .difference(set(vault.isolated_notes)))

Toggle existing files only

nodes_list = list(set(vault.graph.nodes())
                  .difference(set(vault.nonexistent_notes)))