Foam comes with a graph visualization of your notes.
To see the graph execute the Foam: Show Graph
command.
Your files, such as notes and documents, are shown as the nodes of the graph along with the tags defined in your notes. The edges of the graph represent either a link between two files or a file that contains a certain tag. A node in the graph will grow in size with the number of connections it has, representing stronger or more defined concepts and topics.
With the Foam graph visualization you can:
shift
pressed while selecting) nodes by clicking on them, to better understand the structure of your notesctrl
or cmd
If you only wish to view certain types of notes or tags, or want to hide linked attachment nodes then you can apply filters to the graph.
Foam: Show Graph
commandThe Foam graph will use the current VS Code theme by default, but it’s possible to customize it with the foam.graph.style
setting.
A sample configuration object is provided below, you can provide as many or as little configuration as you wish:
"foam.graph.style": {
"background": "#202020",
"fontSize": 12,
"lineColor": "#277da1",
"lineWidth": 0.2,
"particleWidth": 1.0,
"highlightedForeground": "#f9c74f",
"node": {
"note": "#277da1",
}
}
background
background color of the graph, adjust to increase contrastfontSize
size of the title font for each nodelineColor
color of the edges between nodes in the graphlineWidth
thickness of the edges between nodesparticleWidth
size of the particle animation showing link direction when highlighting a nodehighlightedForeground
color of highlighted nodes and edges when hovering over a nodeIt is possible to customize the style of a node based on the type
property in the YAML frontmatter of the corresponding document.
There are a few default node types defined by Foam that are displayed in the graph:
note
defines the color for regular nodes whose documents have not overridden the type
property.placeholder
defines the color for links that don’t match any existing note. This is a [[placeholder]] because no file with such name exists.
tag
defines the color for nodes representing #tags, allowing tags to be used as graph nodes similar to backlinks.
feature
shows an example of how you can use note types to customize the graph. It defines the color for the notes of type feature
For example the following backlinking.md
note:
---
type: feature
---
# Backlinking
...
And the following settings.json
:
"foam.graph.style": {
"background": "#202020",
"node": {
"note": "#277da1",
"placeholder": "#545454",
"tag": "#f9c74f",
"feature": "red",
}
}
Will result in the following graph: