npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

songline-math

v0.1.0

Published

Mathematics of navigable knowledge graphs inspired by Australian Aboriginal songlines — paths through information you can sing (traverse) to reach any destination.

Downloads

167

Readme

songline-math

Mathematics of navigable knowledge graphs inspired by Australian Aboriginal songlines.

Songlines are Australian Aboriginal navigation systems — songs that encode geography. This package implements the mathematics of navigable knowledge graphs: paths through information that you can sing (traverse) to reach any destination.

Installation

npm install songline-math

Quick Start

import { SonglineGraph } from "songline-math";

// Build a knowledge graph
const sg = new SonglineGraph();
sg.addWaypoint("home", [0, 0]);
sg.addWaypoint("mountain", [10, 0]);
sg.addWaypoint("river", [10, 5]);
sg.addWaypoint("ocean", [5, 10]);

sg.addVerse("home", "mountain", 1.0);
sg.addVerse("mountain", "river", 1.5);
sg.addVerse("river", "ocean", 2.0);
sg.addVerse("home", "ocean", 10.0); // long way around

// Navigate: "sing your way" from home to ocean
const path = sg.sing("home", "ocean");
console.log(path.path);   // ["home", "mountain", "river", "ocean"]
console.log(path.cost);   // 4.5
console.log(path.dreamtime); // false

// Build and register songs (paths through the graph)
sg.buildSong(["home", "mountain", "river"], "mountain-song");
sg.buildSong(["home", "ocean"], "coastal-song");

// Find corroborees — where multiple songlines converge
const hubs = sg.corroborees();
console.log(hubs); // convergence at "home"

// Dreamtime topology — persistent homology of knowledge space
const topology = sg.topology(5.0);
console.log(topology); // { b0: 1, b1: 0 }

// Evolve a tradition of songs
const tradition = sg.evolve("my-tradition", 10);
console.log(tradition.generation); // 10

Modules

Song (song)

Core data structures for songlines:

  • Waypoint: A node with coordinates in knowledge space
  • Verse: An edge encoding traversal instructions
  • Song: An ordered sequence of waypoints connected by verses
import { buildGraph, buildSongFromPath, reverseSong } from "songline-math";

const graph = buildGraph(waypoints, verses);
const song = buildSongFromPath(graph, ["A", "B", "C"], "my-song");
const reversed = reverseSong(song);

Navigation (navigation)

Pathfinding through knowledge graphs using songline algorithms:

  • singPath: Find paths preferring well-known territory (high-connectivity nodes)
  • dreamtimeTraversal: Always finds a path, even in disconnected graphs
  • navigability: Fraction of node pairs with paths between them
import { singPath, dreamtimeTraversal, navigability } from "songline-math";

const path = singPath(graph, "start", "end");
// If no normal path exists, automatically uses dreamtime

Corroboree (corroboree)

Song convergence and graph clustering:

  • findCorroborees: Find waypoints where multiple songs converge
  • clusterBySongs: Cluster nodes by shared songline membership
  • findHubs: Find high-degree knowledge hubs
  • modularity: Evaluate clustering quality
import { findCorroborees, clusterBySongs } from "songline-math";

const hubs = findCorroborees(songs);
const clusters = clusterBySongs(songs, 2);

Dreamtime (dreamtime)

Persistent homology on knowledge graphs:

  • bettiNumbers: β₀ (components) and β₁ (cycles) at a given scale
  • persistentCycles: Topological features that persist across scales
  • persistenceBarcode: Filtration evolution of topology
import { bettiNumbers, persistentCycles } from "songline-math";

const betti = bettiNumbers(graph, threshold);
const cycles = persistentCycles(graph, 20);

Tradition (tradition)

Living collections of evolving songlines:

  • createTradition: Initialize a tradition from songs
  • evolveGeneration: Mutate, recombine, decay, and select
  • computeFitness: Score songs by navigability
import { createTradition, evolveGeneration } from "songline-math";

let tradition = createTradition("my-trad", songs);
tradition = evolveGeneration(tradition, graph);

API: SonglineGraph

The unified SonglineGraph class combines all modules:

| Method | Description | |--------|-------------| | addWaypoint(id, coords) | Add a waypoint | | addVerse(from, to, weight) | Add a directed edge | | sing(source, target) | Navigate from source to target | | buildSong(path) | Build and register a song | | corroborees() | Find convergence hubs | | topology(threshold) | Compute Betti numbers | | persistentCycles() | Find persistent topological features | | evolve(id, generations) | Evolve a tradition | | navigabilityScore | Overall graph navigability (0–1) |

Concepts

  • Songline: A path through a knowledge graph, like a song that encodes geography
  • Waypoint: A node with coordinates in abstract knowledge space
  • Verse: An edge connecting waypoints with traversal cost
  • Corroboree: A convergence point where multiple songlines meet
  • Dreamtime: The metaphysical topology — persistent homology revealing true structure
  • Tradition: A living collection of songlines that evolve over generations

License

MIT