Skip to content

SkepticMystic/graph-analysis

Repository files navigation

Graph Analysis

Graph analysis adds the analysis view to Obsidian which implements a set of algorithms that computes useful relations between the notes in your vault! Our flagship algorithm is the Co-citations panel, that we describe as a 2nd order backlinks panel.

The Graph Analysis view shows a table of note names and numbers, each representing the value of some graph analysis algorithm on that note in relation to the current note.

e.g.

  • [[A]] is 0.9 Similar to [[B]]
  • [[A]] has a 0.6 chance of being connected to [[B]]
  • [[A]] is co-cited with [[B]] 6 times

Analysis Types

Graph Analysis currently has 4 different analysis types:

  1. Similarity
  2. Link Prediction
  3. Co-Citations
  4. Community Detection

Each implement different algorithms with different purposes.

Co-Citations

Co-Citations counts the number of time two notes are cited together in the same note and gives extra weight when the two notes are cited close together.

Think of co-citations as a 2nd-order backlinks panel: Instead of showing where something is cited, it shows why, or with whom or what it is cited!

For example, if [[C]] has [[A]] and [[B]] in its content, then [[A]] and [[B]] will each have a co-citation of one.

Each note with co-citations > 0 is given a drop down menu. Inside each drop down, you can see which note co-cites those two notes, and the sentence in which they are co-cited (if in the same sentence), otherwise just the sentence with the other link.

Example use case with daily notes

An example why this is useful is given by @HEmile:

I use a lot of daily notes, in which I journal and write about the news of the day. This makes the backlinks panel a bit boring: It only shows on what dates I wrote about some note. The Co-Citations algorithm shows me much more! For example, the Joe Biden note shows me I usually write about Biden together with Donald Trump. But if I want to know what I wrote about the relations between Joe Biden and China, I can just look in the co-citations panel and expand the relation to see the story!

Video Tutorial

This video gives a longer and in depth overview for why Co-Citations is so useful! Watch the video

Similarity

Similarity is a measure of how similar two notes are based on their connectedness in the graph (ie. note content is not considered). Currently, only the Jaccard Similarity measure is implemented.

Jaccard Similarity

Formula:

image

Source

Where

  • |x| is the number of neighbours the node x has (links going in or out).
  • |x & y| is the number of neighbours that both x and y have in common

Link Prediction

Link Prediction is a measure of the probability that two notes should be connected based on their other connections in the graph. The implemented Link Prediction algorithms are Adamic Adar and Common Neighbours.

Adamic Adar

Formula:

image

Source

Where:

  • N(x) is the number of neighbours of x

Common Neighbours

Formula:

image

Source

Where:

  • N(x) is the numbers of neighbours of x

Community Detection

These algorithms try to find groups of similar notes.

Label Propagation

Start by giving each node a unique label (its own name). Then, look at each node's neighbours, and change it's label to the most common among it's neighbours. Repeat this process iterations number of times.

At the end, show the nodes grouped by the last label they had.

Clustering Coefficient

Gives the ratio of the number of triangles the u is a part of, to the number of triangles it possibly could have been a part of:

image

Utility Classes

Each row in the graph analysis tables (or co-citations dropdowns) has a class: analysis-linked or analysis-not-linked, indicating if the current note is linked to the note in that row. This gives you the ability to style a table row based on whether it's connectedness.

For example, you can make linked notes have a lower opacity:

tr.analysis-linked {
  opacity: 0.3;
}

image

You could even go so far as to hide linked rows completely:

tr.analysis-linked {
  display: none;
}

Settings

In the analysis view, you have the option to choose between different Analysis Types, and different Algorithms within those types. You can set the default analysis type in the plugin settings.

There is also the option to hide Infinity and Zero values.

image

Documentation on Algorithms

You can read more about the implemented algorithms, or let us know which you want us to add, over here 👀. Information on co-citations can mostly be found on Wikipedia. In particular, we implement a variation of Co-citatition Proximity Analysis.

Buy Us a Coffee

SkepticMystic: ko-fi

Emile: ko-fi