camscortex

Graph Visualization

The graph view is one of Foam’s most powerful features. It transforms your collection of notes into a visual network, revealing connections between ideas that might not be obvious when reading individual notes. This guide will teach you how to use the graph view to explore, understand, and expand your knowledge base.

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.

The Show Graph command

  1. Press Ctrl+Shift+P / Cmd+Shift+P
  2. Type “Foam: Show Graph”
  3. Press Enter

You can set up a custom keyboard shortcut:

  1. Go to File > Preferences > Keyboard Shortcuts
  2. Search for “Foam: Show Graph”
  3. Assign your preferred shortcut

Graph Navigation

With the Foam graph visualization you can:

Filter View

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.

Graph filtering demo

Custom Graph Styles

The Foam graph will use the current VS Code theme by default, but it’s possible to customize it with the foam.graph.style setting.

Graph style demo

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,
    "fontFamily": "Sans-Serif",
    "lineColor": "#277da1",
    "lineWidth": 0.2,
    "particleWidth": 1.0,
    "highlightedForeground": "#f9c74f",
    "node": {
        "note": "#277da1",
    }
}

Style Nodes by Type

It 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:

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:

Style node by type

What’s Next?

With graph view mastery, you’re ready to explore advanced Foam features:

  1. [wikilinks] - Understand bidirectional connections
  2. [templates] - Use templates effectively to standardize your note creation
  3. [tags] - Organize your notes with tags
  4. [daily-notes] - Set up daily notes to establish capture routines