skip to content

Poking at stats for my research notes

I wanna poke around at some stats about my files.

Interestingly, as I'm writing this, it'll produce new stats each time I update my Website. But I'm writing this on September 29th, 2025, and I started this research archive, with GnoponEmacs, on August 7th.

First, I was curious: how many nodes do I have, what's the mean number of links in each one, what's the max links in one nodes, and how many are isolatd.

(defun gpe/org-roam-link-stats ()
  "Return an alist of (node-id . link-count)."
  (mapcar
   (lambda (node)
     (cons (org-roam-node-id node)
           (length (org-roam-backlinks-get node))))
   (org-roam-node-list)))
(let* ((stats (gpe/org-roam-link-stats))
     (counts (mapcar #'cdr stats)))
(list
 (cons 'total-nodes (length stats))
 (cons 'mean-links (/ (apply #'+ counts) (float (length counts))))
 (cons 'max-links (apply #'max counts))
 (cons 'isolated-nodes (cl-count 0 counts))))

As of writing, 3783 nodes, 1.6 mean links per, max links in one node is 103, and 295 nodes are isolated.

Now I wanna look at the distribution of those links:

(let* ((stats (mapcar
               (lambda (node)
                 (cons (org-roam-node-id node)
                       (length (org-roam-backlinks-get node))))
               (org-roam-node-list)))
       (counts (mapcar #'cdr stats))
       (hist (make-hash-table :test 'equal)))
  (dolist (c counts)
    (puthash c (1+ (gethash c hist 0)) hist))
  (let (alist)
    (maphash (lambda (k v) (push (cons k v) alist)) hist)
    (concat "| Degree | Count |\n|-\n"
            (mapconcat
             (lambda (pair)
               (format "| %d | %d |" (car pair) (cdr pair)))
             (sort alist (lambda (a b) (< (car a) (car b))))
             "\n"))))

Backlinks

Created: 2025-10-04 Sat 17:55