How to prevent https:// links from showing up in org-roam-graph?

Hello, I use org-roam-graph in place of org-roam-ui because its much more lean and utility oriented. The problem I am having is how to not show certain things in them, every https link I create inside a node is rendered and it clutters the graph, please share a code snippet if possible how to disable showing them. Would be also good to disable showing dailies and only non-dailies nodes?

It seems there is an undocumented variable called org-roam-graph-link-hidden-types whose original value is “file” I modified the variable to “file” “https” as such

(setq org-roam-graph-link-hidden-types '(“file” “https”))

It works !!!


To answer my second question - how to exclude dailies from org-roam-graph.
This pull request achieves just that Add exclude patterns to org-roam-graph by braun-steven · Pull Request #2400 · org-roam/org-roam · GitHub

Including the patch for anyone interested. Exclude Patterns may be folder names also, the original author did not document it - but it works !

From a038c20c1e2ccd2c05679d3bbef68f41770da016 Mon Sep 17 00:00:00 2001
From: Steven Braun <>
Date: Sun, 26 Nov 2023 12:26:34 +0100
Subject: [PATCH] Add exclude patterns to org-roam-graph

Define org-roam-graph-exclude-patterns which allows to filter the graph nodes by title/filenames.
 extensions/org-roam-graph.el | 78 ++++++++++++++++++++++--------------
 1 file changed, 49 insertions(+), 29 deletions(-)

diff --git a/extensions/org-roam-graph.el b/extensions/org-roam-graph.el
index dde693c065..cd77529e8e 100644
--- a/extensions/org-roam-graph.el
+++ b/extensions/org-roam-graph.el
@@ -175,44 +175,64 @@ CALLBACK is passed the graph file as its sole argument."
                      (progn (funcall callback temp-graph)
                             (run-hook-with-args 'org-roam-graph-generation-hook temp-dot temp-graph))))))))
+(defcustom org-roam-graph-exclude-patterns '()
+  "List of patterns to exclude from the Org-roam graph.
+Nodes with file names or titles matching any pattern in this list will be excluded."
+  :type '(repeat string)
+  :group 'org-roam)
 (defun org-roam-graph--dot (&optional edges all-nodes)
   "Build the graphviz given the EDGES of the graph.
 If ALL-NODES, include also nodes without edges."
   (let ((org-roam-directory-temp org-roam-directory)
         (nodes-table (make-hash-table :test #'equal))
         (seen-nodes (list))
+        (excluded-nodes (list)) ;; List to store IDs of excluded nodes
         (edges (or edges (org-roam-db-query [:select :distinct [source dest type] :from links]))))
-    (pcase-dolist (`(,id ,file ,title)
-                   (org-roam-db-query [:select [id file title] :from nodes]))
-      (puthash id (org-roam-node-create :file file :id id :title title) nodes-table))
-    (with-temp-buffer
-      (setq-local org-roam-directory org-roam-directory-temp)
-      (insert "digraph \"org-roam\" {\n")
-      (dolist (option org-roam-graph-extra-config)
-        (insert (org-roam-graph--dot-option option) ";\n"))
-      (insert (format " edge [%s];\n"
-                      (mapconcat (lambda (var)
-                                   (org-roam-graph--dot-option var nil "\""))
-                                 org-roam-graph-edge-extra-config
-                                 ",")))
-      (pcase-dolist (`(,source ,dest ,type) edges)
-        (unless (member type org-roam-graph-link-hidden-types)
-          (pcase-dolist (`(,node ,node-type) `((,source "id")
-                                               (,dest ,type)))
-            (unless (member node seen-nodes)
-              (insert (org-roam-graph--format-node
-                       (or (gethash node nodes-table) node) node-type))
-              (push node seen-nodes)))
-          (insert (format "  \"%s\" -> \"%s\";\n"
-                          (xml-escape-string source)
-                          (xml-escape-string dest)))))
-      (when all-nodes
+    ;; Function to check if a string matches any of the exclude patterns
+    (cl-flet ((matches-exclude-pattern (s)
+                                       (seq-some (lambda (pattern)
+                                                   (string-match pattern s))
+                                                 org-roam-graph-exclude-patterns)))
+      ;; First, identify nodes to exclude
+      (pcase-dolist (`(,id ,file ,title)
+                     (org-roam-db-query [:select [id file title] :from nodes]))
+        (if (or (matches-exclude-pattern file)
+                (matches-exclude-pattern title))
+            (push id excluded-nodes) ;; Add to excluded list
+          (puthash id (org-roam-node-create :file file :id id :title title) nodes-table))) ;; Add to nodes table
+      (with-temp-buffer
+        (setq-local org-roam-directory org-roam-directory-temp)
+        (insert "digraph \"org-roam\" {\n")
+        (dolist (option org-roam-graph-extra-config)
+          (insert (org-roam-graph--dot-option option) ";\n"))
+        (insert (format " edge [%s];\n"
+                        (mapconcat (lambda (var)
+                                     (org-roam-graph--dot-option var nil "\""))
+                                   org-roam-graph-edge-extra-config
+                                   ",")))
+        ;; Process edges, excluding those connected to excluded nodes
+        (pcase-dolist (`(,source ,dest ,type) edges)
+          (unless (or (member source excluded-nodes)
+                      (member dest excluded-nodes)
+                      (member type org-roam-graph-link-hidden-types))
+            (insert (format "  \"%s\" -> \"%s\";\n"
+                            (xml-escape-string source)
+                            (xml-escape-string dest)))))
+        ;; Process nodes, excluding those in the excluded list
         (maphash (lambda (id node)
-                   (unless (member id seen-nodes)
+                   (unless (member id excluded-nodes)
                      (insert (org-roam-graph--format-node node "id"))))
-                 nodes-table))
-      (insert "}")
-      (buffer-string))))
+                 nodes-table)
+        (insert "}")
+        (buffer-string)))))
 (defun org-roam-graph--connected-component (id distance)
   "Return the edges for all nodes reachable from/connected to ID.

Currently - my hidden types/folders are as follows

(setq org-roam-graph-link-hidden-types '("file"                        ; dont render links to files
					 "http"                        ; - http links
					 "https"                       ; - https links
					 "fuzzy")                      ; - links to image files, tables etc

      org-roam-graph-exclude-patterns '("notes"                        ; do not render anything in the notes folder
					"journal")                     ; do not render anything in the journal folder