gograph

package module
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 0 Imported by: 0

README

GoGraph

A Go module for graph persistence, manipulation, and fast search, designed to scale from in-memory graphs to graphs that exceed RAM.

Status

Current release: v0.10.0. This is the project's thirteenth release, published at a pre-1.0 baseline: under Semantic Versioning a 0.y.z version signals that the public API is not yet stable and may change without a major bump while the module matures toward 1.0.0. v0.10.0 is a pre-1.0 MINOR release, and an entirely Cypher query-planner and execution-engine cycle. Its headline is a new planner statistics and cardinality-estimation foundation — an exact relationship count-store maintained in O(delta) on the commit fan-out and recomputed at reopen, plus off-write-path statistics (HyperLogLog NDV, exact MCV, equi-depth histograms) that now drive statistics-backed cardinality estimates in EXPLAIN / PROFILE. On top of the exact count-store sit result-identical, cost-gated reordering peepholes (min-cardinality multi-label anchor scan, single-edge anchor-swap, disjoint-component reorder), a deepening of the columnar / vectorised read path (columnar aggregation, Expand as a chunk producer, columnar hash-join with late materialisation), and a broadening of automatic intra-query parallelism to min / max / count aggregation with a byte-identical-to-serial combine. The release is purely additive — it removes no exported identifier and no behaviour — so the documented public-API surface is unaffected. The five major subsystems below are functional and tested under race, lint, and soak gates. The two compliance invariants are already in force at this version: the module is 100 % openCypher TCK-compliant at the execution level (3 897/3 897 scenarios, 16 006/16 006 steps) and 100 % ACID-compliant; every change is gated by the project's local validation pipeline (build, vet, race, lint, govulncheck, TCK conformance, and the deterministic crash-injection battery), run via make ci/make release-preflight before it lands. The module uses the conventional Go path github.com/FlavioCFOliveira/GoGraph and is fetchable with go get github.com/FlavioCFOliveira/GoGraph@v0.10.0. See CHANGELOG.md and release-notes/v0.10.0.md for the full release narrative.

Core graph (graph/)
  • github.com/FlavioCFOliveira/GoGraph/graph — generic node identifiers and the Graph[N, W] contract.
  • github.com/FlavioCFOliveira/GoGraph/graph/adjlist — mutable, sharded adjacency-list backend with copy-on-write snapshots and lock-free reads.
  • github.com/FlavioCFOliveira/GoGraph/graph/csr — immutable Compressed Sparse Row view for read-mostly analytics.
  • github.com/FlavioCFOliveira/GoGraph/graph/generation — atomic pointer swap for snapshot rotation across readers/writers.
  • github.com/FlavioCFOliveira/GoGraph/graph/lpg — Labelled Property Graph model (vertex and edge labels, typed properties; PropertyValue covers string, int64, float64, bool, time.Time, []byte, and list ([]PropertyValue)).
  • github.com/FlavioCFOliveira/GoGraph/graph/lpg/schema — optional type schema with Validate.
  • github.com/FlavioCFOliveira/GoGraph/graph/indexManager coordinating named indexes and fanning out Change events to subscribers.
  • github.com/FlavioCFOliveira/GoGraph/graph/index/label — Roaring-bitmap inverted label index.
  • github.com/FlavioCFOliveira/GoGraph/graph/index/hash — sharded hash exact-match property index.
  • github.com/FlavioCFOliveira/GoGraph/graph/index/btree — order-preserving B+ tree range property index (backs the Cypher range-predicate index seek).
  • github.com/FlavioCFOliveira/GoGraph/graph/query — fluent MATCH-style pattern engine.
  • github.com/FlavioCFOliveira/GoGraph/graph/io/csv · graph/io/graphml · graph/io/dot · graph/io/jsonl — interchange formats for CSV, GraphML, DOT, and JSON Lines.
  • github.com/FlavioCFOliveira/GoGraph/ds — disjoint-set (union-find) primitive.
  • github.com/FlavioCFOliveira/GoGraph/search — traversal and path-finding algorithms (BFS, iterative DFS, Dijkstra, Bellman-Ford, A*, bidirectional BFS, Yen k-shortest, topological sort (Kahn), Tarjan SCC, biconnected components, Eulerian path, APSP).
  • github.com/FlavioCFOliveira/GoGraph/search/centrality — Brandes betweenness, PageRank (parallel pull-formulation over a reverse-CSR on large graphs, bit-identical to the serial path), personalised PageRank.
  • github.com/FlavioCFOliveira/GoGraph/search/community — Leiden, label propagation.
  • github.com/FlavioCFOliveira/GoGraph/search/flow — Dinic, Edmonds-Karp, push-relabel, Stoer-Wagner, min-cost max-flow.
  • github.com/FlavioCFOliveira/GoGraph/search/extern — semi-external BFS and PageRank over Tier 2 csrfile readers.
Storage and persistence (store/)
  • github.com/FlavioCFOliveira/GoGraph/store/wal — Write-Ahead Log with CRC32C framing.
  • github.com/FlavioCFOliveira/GoGraph/store/snapshot — atomic on-disk snapshot directories.
  • github.com/FlavioCFOliveira/GoGraph/store/txn — single-writer transactional API (Begin/Commit/Rollback).
  • github.com/FlavioCFOliveira/GoGraph/store/checkpoint — background WAL → snapshot folder.
  • github.com/FlavioCFOliveira/GoGraph/store/recovery — snapshot + WAL replay on open.
  • github.com/FlavioCFOliveira/GoGraph/store/csrfile — mmap-backed Tier 2 CSR file format, writer, reader, Reinterpret zero-copy helper, deterministic fixture generator.
  • github.com/FlavioCFOliveira/GoGraph/store/bulk — high-throughput bulk loader bypassing the WAL.
Cypher engine (cypher/)
  • github.com/FlavioCFOliveira/GoGraph/cypher — openCypher-compatible parser, planner, and execution engine; WAL-durable writes via NewEngineWithStore.
  • github.com/FlavioCFOliveira/GoGraph/cypher/parser · cypher/ast · cypher/sema · cypher/ir · cypher/plan · cypher/exec — parser-to-execution pipeline with plan-cache, EXPLAIN/PROFILE, and dbhits accounting.
  • github.com/FlavioCFOliveira/GoGraph/cypher/funcs · cypher/procs — built-in functions and procedures.
  • github.com/FlavioCFOliveira/GoGraph/cypher/tck — openCypher TCK harness (parser 100 %, execution 100 % — 3 897/3 897 scenarios; see docs/tck/DIVERGENCES.md).
Bolt server (bolt/)
  • github.com/FlavioCFOliveira/GoGraph/bolt/proto · bolt/packstream — Bolt v5 protocol and PackStream encoding (v5.0–v5.6 preferred; v4.4 fallback).
  • github.com/FlavioCFOliveira/GoGraph/bolt/server — TCP server compatible with neo4j-go-driver v5 and cypher-shell, with TLS certificate hot-reload and graceful shutdown.

Subsystem references: docs/persistence.md (WAL, snapshots, recovery) · docs/tier2.md (csrfile) · docs/io.md (interchange formats) · docs/algorithms.md (algorithms catalogue) · docs/cypher.md (Cypher engine) · docs/bolt.md (Bolt server).

Examples

The examples/ directory contains 25 runnable demonstrations. See examples/README.md for the full categorized index with per-example links and run commands.

Basics
  • 01_basic — Dijkstra on a small European routing graph.
  • 02_property_graph — labels + typed properties + indexed query.
  • 03_advanced_algorithms — BFS, Dijkstra, Brandes betweenness, and PageRank composed over one CSR snapshot.
Persistence and out-of-core
  • 04_persistence — WAL transactions + recovery.
  • 05_out_of_core — Tier 2 csrfile + mmap + semi-external PageRank.
  • 17_transactional_log — WAL + background checkpointer + crash-recovery walk-through.
  • 18_oocore_pipeline — CSV → CSR → csrfile → mmap → semi-external BFS + PageRank.
  • 21_typed_recovery — generic recovery.Open[N, W] over an (int64, float64) graph with typed properties; round-trips through a v2 snapshot.
Cypher and Bolt
  • 22_cypher — Cypher execution engine social-graph demo: label scan with ORDER BY, WHERE filter, relationship pattern, and CREATE — values printed in human-readable form.
  • 23_bolt_server — Bolt v5 server round-trip: a real neo4j-go-driver v5 client runs a Cypher query over the wire, then the server shuts down cleanly with no goroutine leak.
  • 24_social_network_cli — interactive CLI over a persistent LPG social network (WAL + recovery + Cypher queries).
  • 25_software_house_api — multi-layer LPG REST API over a software-house domain (Code/Work/People entities).
Interchange
  • 06_csv_import — CSV read / write + JSON Lines.
  • 07_graphml_roundtrip — GraphML read / write + DOT.
Algorithms
  • 08_pagerank — PageRank on a directed authority web, ranking pages from most to least important with distinct ranks.
  • 09_leiden — community detection on two cliques + bridge.
  • 10_dimacs9_routing — DIMACS 9 synthetic road network + a concrete Dijkstra SSSP query with a reconstructed shortest path.
  • 14_routing_alternatives — Dijkstra, Yen k-shortest, and A* with a coordinate-based Euclidean heuristic that expands fewer nodes for the same optimal cost.
  • 15_task_assignment — Hungarian (cost-minimising) + Hopcroft-Karp (cardinality).
  • 16_centrality_analytics — Brandes betweenness + label propagation.
Real-world recipes
  • 11_social_network — labels + PageRank + Leiden + friend-of-friend recommendations.
  • 12_build_dependency — topological sort + Tarjan SCC for circular-dependency detection.
  • 13_network_reliability — Hopcroft-Tarjan SPOF analysis + max-flow with the limiting min-cut bottleneck, both over the same network.
  • 19_pattern_query — multi-hop MATCH-style queries combining labels and property predicates.
  • 20_concurrent_reads — multiple algorithms run concurrently over a shared immutable CSR.

Run any example with go run ./examples/<NAME>/.

Getting Started

package main

import (
	"fmt"

	"github.com/FlavioCFOliveira/GoGraph/graph/adjlist"
	"github.com/FlavioCFOliveira/GoGraph/graph/csr"
	"github.com/FlavioCFOliveira/GoGraph/search"
)

func main() {
	a := adjlist.New[string, int64](adjlist.Config{Directed: true})
	a.AddEdge("Lisbon", "Madrid", 624)
	a.AddEdge("Lisbon", "Paris", 1737)
	a.AddEdge("Madrid", "Paris", 1274)
	a.AddEdge("Madrid", "Rome", 1969)
	a.AddEdge("Paris", "Rome", 1422)

	c := csr.BuildFromAdjList(a)
	src, _ := a.Mapper().Lookup("Lisbon")

	d, err := search.Dijkstra(c, src)
	if err != nil {
		panic(err)
	}
	for _, city := range []string{"Madrid", "Paris", "Rome"} {
		id, _ := a.Mapper().Lookup(city)
		dist, _ := d.Distance(id)
		fmt.Printf("Lisbon -> %s : %d km\n", city, dist)
	}
}

Workflow

The project follows a strict Specify -> Implement -> Test -> Document workflow. Sprint planning lives in the local rmp CLI roadmap. The Makefile ci target runs the full validation pipeline:

make ci

The pipeline runs go mod tidy, gofmt, go vet, go build, the short test layer under the race detector (go test -race), golangci-lint run, and the coverage gate (cover-gate), which enforces ≥ 85 % aggregate and ≥ 75 % per-package statement coverage. Every change must pass it before being committed.

Performance

Benchmarks (Apple M4, Go 1.26.3):

Operation Throughput
Mapper.Intern (hot key) 17 ns/op, 0 allocs
adjlist.HasEdge (hot cache) 49 ns/op, 0 allocs
csr.NeighboursByID 10.6 ns/op, 0 allocs
csr.BuildFromAdjList of 10^7 edges 51 ms
search.BFS on 10^7-node chain 38 ms, 1.25 MB peak, 0 allocs/call after warmup
search.Dijkstra on 1M-node / 4M-edge random graph 320 ms
search.BellmanFord on 16K-vertex / 64K-edge 1.8 ms

Measured on: 2026-05-22 against commit 1a2f00e, Apple M4 (10-core), Go 1.26.3, macOS 25.4.0 (darwin/arm64). Reproduce: make bench BENCH_PATTERN=. BENCH_COUNT=5 (see docs/profiling.md for the sample workflow). Per-run variance is captured by benchstat and the headline numbers above are the median of five runs at -count=5. Hardware deltas should be reported in CHANGELOG.md alongside any number that regresses beyond the local benchstat regression gate (scripts/bench_gate.sh), which is run locally to compare a candidate against its baseline before the change lands.

The v0.3.1 performance cycle lifts the write, analytics, and query paths without regressing the single-threaded figures above: group commit raises concurrent write throughput ≈ 118× at 256 goroutines (with zero single-thread regression), parallel PageRank runs 1.7–2.4× on large graphs (bit-identical results), and a range-predicate B+tree index seek is ≈ 114× on selective indexed ranges. See docs/benchmarks/v0.3.1.md for the full per-release report and concurrency sweeps.

Module Layout

graph/                    — core types: NodeID, Graph[N,W] contract, sharded Mapper
graph/adjlist             — mutable copy-on-write adjacency list (writer-side)
graph/csr                 — immutable Compressed Sparse Row snapshot (reader-side)
graph/generation          — refcount-protected Publisher for atomic snapshot rotation
graph/lpg                 — labelled property graph (labels + typed properties)
graph/lpg/schema          — declarative type schema with Validate
graph/index               — Manager fanning out Change events to subscribers
graph/index/label         — Roaring-bitmap inverted label index
graph/index/hash          — sharded hash exact-match property index
graph/index/btree         — order-preserving range property index
graph/query               — fluent MATCH-style pattern engine
graph/io/csv              — edge-list CSV reader and writer
graph/io/graphml          — GraphML XML reader and writer
graph/io/dot              — Graphviz DOT writer
graph/io/jsonl            — JSON Lines reader and writer

search/                   — traversal and path-finding over CSR (BFS, DFS, Dijkstra,
                            Bellman-Ford, A*, BiBFS, Yen, APSP, BCC, Eulerian, ...)
search/centrality         — Brandes betweenness, PageRank, personalised PageRank
search/community          — Leiden, label propagation
search/extern             — semi-external BFS/PageRank over a Tier 2 reader
search/flow               — Dinic, Edmonds-Karp, push-relabel, Stoer-Wagner, MCMF

store/wal                 — versioned, CRC32C-checksummed Write-Ahead Log
store/snapshot            — atomic snapshot directories with manifest and per-file CRC
store/txn                 — single-writer transactions (Begin/Commit/Rollback)
store/checkpoint          — background WAL → snapshot folder goroutine
store/recovery            — snapshot + WAL replay on open
store/csrfile             — mmap'd Tier 2 CSR file format (versioned, 64-byte aligned)
store/bulk                — high-throughput bulk ingestion bypassing the WAL

ds/                       — supporting data structures (Union-Find, ...)

bench/ldbc                — LDBC SNB SF1 / SF10 benchmark harness
bench/dimacs9             — DIMACS 9 USA-road SSSP benchmark
bench/rmat                — RMAT power-law graph generator
bench/soak                — 4-hour mixed-workload reliability soak harness
bench/comparison          — cross-library performance comparison vs NetworkX

internal/metrics          — observability API hook (Backend, IncCounter, ObserveLatency, Time)
internal/stress           — concurrency stress test suite (CI under -race)
internal/shapegen         — graph shape generators (trivial, classic, random models, adversarial)
internal/invariants       — graph invariant checkers (connected, DAG, bipartite, distance bound)
internal/testfs           — FS fault-injection wrapper (ENOSPC, partial write, fsync delay)
internal/crashinject      — subprocess crash-injection harness (SIGKILL breakpoints)
internal/subproc          — cross-process test helper (re-exec, mode dispatch)
internal/goldens          — golden-file assertion helper with -update and atomic write

See [docs/test-battery.md](docs/test-battery.md) for the production-readiness
test battery guide and the add-new-shape recipe.

examples/                 — 25 runnable example programs (see "Examples" section)

Labelled Property Graph + Query Example

g := lpg.New[string, int64](adjlist.Config{Directed: true})
g.SetNodeLabel("alice", "Person")
g.SetNodeLabel("alice", "Admin")
g.SetNodeProperty("alice", "age", lpg.Int64Value(30))
g.AddEdge("alice", "bob", 1)

c := csr.BuildFromAdjList(g.AdjList())
e := query.New(g, c)

for _, n := range e.Match().Vertex(
    query.WithLabel[string, int64]("Admin"),
    query.WithProperty[string, int64]("age", lpg.Int64Value(30)),
).Collect() {
    fmt.Println(n)
}

Security

Vulnerability reports follow the process documented in SECURITY.md. Use GitHub Security Advisories or the private email listed there — please do not open a public issue for a suspected vulnerability.

License

GoGraph is distributed under the MIT License.

Documentation

Overview

Package gograph is a Go module for graph persistence, manipulation, and fast search.

The library scales from small in-memory graphs to graphs too large to fit in RAM, while remaining idiomatic, allocation-conscious, and safe under high load and high concurrency.

Subpackages provide the building blocks:

  • graph — core types, generic node identifiers, and graph interfaces.
  • graph/adjlist — mutable adjacency-list backend.
  • graph/csr — immutable compressed sparse row view for analytics.
  • graph/lpg — labelled property graph model (labels, typed properties).
  • graph/index — secondary indexes (label bitmap, hash, B+ tree).
  • graph/io — importers and exporters (CSV, GraphML, DOT, JSON Lines).
  • search — traversal and path-finding algorithms.
  • search/centrality, search/community, search/flow — analytics suites.
  • store — durable persistence (WAL, snapshots, mmap'd CSR).

Subpackages are added incrementally per the project roadmap; the present package documents the top-level module only.

Common tasks and their entrypoints

The following map points each common task at the function or type that starts it. Every link resolves to an exported symbol; follow it for the full signature and contract.

Build a labelled property graph:

  • [lpg.New] constructs a Graph[N, W]; add nodes, labels, typed properties, and edges through its methods.

Run a Cypher query:

  • [cypher.NewEngine] wraps an in-memory lpg.Graph[string, float64].
  • [cypher.Engine.Run] executes a query string with typed parameters.

Run durable, WAL-backed Cypher queries:

  • [cypher.NewEngineWithStore] binds the engine to a [txn.Store], so writes are journalled and survive a crash.

Pass parameters to a query:

  • [cypher.Engine.RunAny] accepts plain Go values as parameters.
  • [cypher.BindParams] converts a map of Go values into the typed parameter map that [cypher.Engine.Run] expects.

Find a shortest path (weighted):

  • [search.Dijkstra] for non-negative edge weights.
  • [search.AStar] when an admissible heuristic is available.

Traverse without weights:

  • [search.BFS] for breadth-first order and unweighted distances.
  • [search.DFS] for depth-first order.

Compute analytics:

  • [centrality.PageRank] for influence ranking.
  • [community.Leiden] (or [community.LabelPropagation]) for community detection; pair with [community.DefaultLeidenOptions].
  • [flow.MaxFlow] / [flow.MinCostMaxFlow] for network-flow problems.

Import and export graphs:

  • CSV: [csv.ReadInto] and [csv.Write].
  • GraphML: [graphml.ReadInto] / [graphml.ReadWithProps] and [graphml.Write] / [graphml.WriteWithProps].
  • JSON Lines: [jsonl.ReadInto] / [jsonl.ReadWithProps] and [jsonl.Write] / [jsonl.WriteWithProps].
  • DOT (export only): [dot.Write].

Persist and recover:

  • [wal.Open] opens a write-ahead log for appending frames.
  • [snapshot.WriteSnapshotFull] writes a full CSR-plus-labels snapshot to a directory.
  • [recovery.Open] reconstructs a graph from a snapshot and its WAL.

Serve the Bolt protocol:

  • [server.NewServer] starts a Bolt v5 server backed by a [cypher.Engine].

NodeID space, MaxNodeID, and live nodes

The graph.Mapper interns user keys into compact NodeIDs using a 256-way sharded layout; the shard index occupies the top byte of each NodeID. As a result MaxNodeID() typically rounds up well above the number of distinct keys, and analytical algorithms that allocate per-NodeID buffers (rank vectors, community-ID slices) produce slices of length MaxNodeID() with sentinel values in the "ghost" slots. Use graph/csr.CSR.LiveMask, LiveNodes, or LiveCount to iterate only the meaningful results.

See docs/maxnodeid.md for a worked example and recipes for translating live NodeIDs back to user keys via Mapper.Resolve.

Directories

Path Synopsis
bench
dimacs9
Package dimacs9 implements the harness that drives GoGraph against the DIMACS 9th Implementation Challenge shortest-paths workload.
Package dimacs9 implements the harness that drives GoGraph against the DIMACS 9th Implementation Challenge shortest-paths workload.
ldbc
Package ldbc implements the harness GoGraph uses against the LDBC Social Network Benchmark workloads.
Package ldbc implements the harness GoGraph uses against the LDBC Social Network Benchmark workloads.
rmat
Package rmat implements the RMAT (Recursive MATrix) generator of Chakrabarti, Zhan & Faloutsos (SDM 2004), used to produce power-law-shaped synthetic graphs that match the degree distributions observed in real-world social / web networks.
Package rmat implements the RMAT (Recursive MATrix) generator of Chakrabarti, Zhan & Faloutsos (SDM 2004), used to produce power-law-shaped synthetic graphs that match the degree distributions observed in real-world social / web networks.
soak command
cypher_rw.go — Cypher RW mixed-workload harness for the soak binary.
cypher_rw.go — Cypher RW mixed-workload harness for the soak binary.
bolt
packstream
Package packstream implements the PackStream binary serialisation format used by the Bolt protocol.
Package packstream implements the PackStream binary serialisation format used by the Bolt protocol.
proto
Package proto implements the Bolt v5 wire protocol message types, handshake negotiation, and chunked framing.
Package proto implements the Bolt v5 wire protocol message types, handshake negotiation, and chunked framing.
server
Package server implements the Bolt v5 TCP server for the GoGraph Cypher engine.
Package server implements the Bolt v5 TCP server for the GoGraph Cypher engine.
cmd
crashinject-helper command
Command crashinject-helper is the child process spawned by the crashinject harness during crash-injection tests.
Command crashinject-helper is the child process spawned by the crashinject harness during crash-injection tests.
fmtfixture command
Command fmtfixture regenerates the frozen on-disk fixtures used by the rolling-upgrade compatibility tests in store/wal, store/snapshot, and store/csrfile.
Command fmtfixture regenerates the frozen on-disk fixtures used by the rolling-upgrade compatibility tests in store/wal, store/snapshot, and store/csrfile.
sim command
Command sim runs the GoGraph deterministic simulation testing (DST) harness.
Command sim runs the GoGraph deterministic simulation testing (DST) harness.
sim-xrelease-helper command
Command sim-xrelease-helper is the prior-release subprocess driver for the DST cross-release harness (internal/sim).
Command sim-xrelease-helper is the prior-release subprocess driver for the DST cross-release harness (internal/sim).
Package cypher provides the public query engine API for the GoGraph Cypher executor.
Package cypher provides the public query engine API for the GoGraph Cypher executor.
ast
Package ast defines the Abstract Syntax Tree (AST) for openCypher 9.
Package ast defines the Abstract Syntax Tree (AST) for openCypher 9.
exec
Package exec implements the Volcano-style executor for the Cypher query engine.
Package exec implements the Volcano-style executor for the Cypher query engine.
explain
Package explain renders Cypher execution plans as human-readable text (EXPLAIN mode) and instruments them with per-operator execution statistics (PROFILE mode).
Package explain renders Cypher execution plans as human-readable text (EXPLAIN mode) and instruments them with per-operator execution statistics (PROFILE mode).
expr
Package expr defines the runtime value model for the Cypher executor.
Package expr defines the runtime value model for the Cypher executor.
funcs
Package funcs implements the built-in Cypher function registry.
Package funcs implements the built-in Cypher function registry.
ir
Package ir defines the logical plan intermediate representation (IR) for the Cypher query compiler.
Package ir defines the logical plan intermediate representation (IR) for the Cypher query compiler.
parser
Package parser translates the ANTLR4-generated Cypher parse tree into the typed AST defined in github.com/FlavioCFOliveira/GoGraph/cypher/ast.
Package parser translates the ANTLR4-generated Cypher parse tree into the typed AST defined in github.com/FlavioCFOliveira/GoGraph/cypher/ast.
parser/gen
Package gen contains the ANTLR4-generated lexer and parser for openCypher 9.
Package gen contains the ANTLR4-generated lexer and parser for openCypher 9.
procs
Package procs defines the procedure registry for the Cypher executor.
Package procs defines the procedure registry for the Cypher executor.
sema
Package sema implements the scope-analysis pass for openCypher queries.
Package sema implements the scope-analysis pass for openCypher queries.
tck
Package tck records the conformance evolution of the GoGraph Cypher engine against the openCypher Technology Compatibility Kit.
Package tck records the conformance evolution of the GoGraph Cypher engine against the openCypher Technology Compatibility Kit.
Package ds provides small generic data-structure primitives that support gograph's algorithms but do not themselves model a graph.
Package ds provides small generic data-structure primitives that support gograph's algorithms but do not themselves model a graph.
examples
01_basic command
Example 01_basic — build a weighted directed transport network, freeze it to an immutable CSR snapshot, and run a single-source Dijkstra shortest-paths query with route reconstruction.
Example 01_basic — build a weighted directed transport network, freeze it to an immutable CSR snapshot, and run a single-source Dijkstra shortest-paths query with route reconstruction.
02_property_graph command
Example 02_property_graph — build a labelled property graph (LPG) with an optional type schema, then run label- and property-indexed MATCH-style queries and read the typed properties back out.
Example 02_property_graph — build a labelled property graph (LPG) with an optional type schema, then run label- and property-indexed MATCH-style queries and read the typed properties back out.
03_advanced_algorithms command
Example 03_advanced_algorithms — runs four algorithms over one shared, immutable CSR snapshot: BFS, Dijkstra, exact Brandes betweenness centrality, and PageRank — and reports per-algorithm evidence.
Example 03_advanced_algorithms — runs four algorithms over one shared, immutable CSR snapshot: BFS, Dijkstra, exact Brandes betweenness centrality, and PageRank — and reports per-algorithm evidence.
04_persistence command
Example 04_persistence — the full GoGraph durability path on a real directory, driven at a configurable, reproducible scale.
Example 04_persistence — the full GoGraph durability path on a real directory, driven at a configurable, reproducible scale.
05_out_of_core command
Example 05_out_of_core — Tier 2 external memory: build a scale-free web graph, persist its CSR adjacency as an on-disk csrfile, re-open it by mmap, and run semi-external PageRank directly over the mapped region.
Example 05_out_of_core — Tier 2 external memory: build a scale-free web graph, persist its CSR adjacency as an on-disk csrfile, re-open it by mmap, and run semi-external PageRank directly over the mapped region.
06_csv_import command
Example 06_csv_import — an interchange round-trip benchmark for the edge-list serialisers: generate a seeded follower graph as CSV in memory, parse it back with csv.ReadIntoCtx, then re-serialise the resulting graph as CSV with csv.WriteCtx and as newline-delimited JSON (JSON Lines) with jsonl.WriteCtx, measuring each leg.
Example 06_csv_import — an interchange round-trip benchmark for the edge-list serialisers: generate a seeded follower graph as CSV in memory, parse it back with csv.ReadIntoCtx, then re-serialise the resulting graph as CSV with csv.WriteCtx and as newline-delimited JSON (JSON Lines) with jsonl.WriteCtx, measuring each leg.
07_graphml_roundtrip command
Example 07_graphml_roundtrip — a GraphML interchange round-trip over a realistic, seeded link graph.
Example 07_graphml_roundtrip — a GraphML interchange round-trip over a realistic, seeded link graph.
08_pagerank command
Example 08_pagerank — runs PageRank over a seeded, scale-free directed web and reports the most authoritative pages, most to least important.
Example 08_pagerank — runs PageRank over a seeded, scale-free directed web and reports the most authoritative pages, most to least important.
09_leiden command
Example 09_leiden — modularity-optimising community detection with community.Leiden over a realistic, seeded planted-partition graph.
Example 09_leiden — modularity-optimising community detection with community.Leiden over a realistic, seeded planted-partition graph.
10_dimacs9_routing command
Example 10_dimacs9_routing — build a deterministic synthetic road network with the DIMACS 9 harness, freeze it into an immutable CSR snapshot, run a concrete single-source shortest-paths query (search.Dijkstra) that reconstructs a route, and measure search performance with a distribution of random probe queries.
Example 10_dimacs9_routing — build a deterministic synthetic road network with the DIMACS 9 harness, freeze it into an immutable CSR snapshot, run a concrete single-source shortest-paths query (search.Dijkstra) that reconstructs a route, and measure search performance with a distribution of random probe queries.
11_social_network command
Example 11_social_network — an end-to-end social-network workload over a labelled property graph (LPG): PageRank influence ranking, Leiden community detection, a manual friend-of-friend recommendation walk, and a structural-analytics pass (k-core, triangles, diameter, reachability), all over ONE seeded, scale-parametrised social graph.
Example 11_social_network — an end-to-end social-network workload over a labelled property graph (LPG): PageRank influence ranking, Leiden community detection, a manual friend-of-friend recommendation walk, and a structural-analytics pass (k-core, triangles, diameter, reachability), all over ONE seeded, scale-parametrised social graph.
12_build_dependency command
Example 12_build_dependency — model a software build-dependency graph, derive a valid build order with search.TopologicalSort (Kahn's algorithm), and detect a circular dependency with search.TarjanSCC.
Example 12_build_dependency — model a software build-dependency graph, derive a valid build order with search.TopologicalSort (Kahn's algorithm), and detect a circular dependency with search.TarjanSCC.
13_network_reliability command
Example 13_network_reliability — a suite of resilience analyses over ONE synthetic communication backbone, derived from a single capacitated edge list:
Example 13_network_reliability — a suite of resilience analyses over ONE synthetic communication backbone, derived from a single capacitated edge list:
14_routing_alternatives command
Example 14_routing_alternatives — compare three flavours of shortest-path computation on ONE seeded coordinate routing graph: classical single-source Dijkstra, Yen's k-shortest loopless paths for ranked alternatives, and A* driven by a coordinate-based Euclidean heuristic that expands fewer nodes than Dijkstra for the same optimal cost.
Example 14_routing_alternatives — compare three flavours of shortest-path computation on ONE seeded coordinate routing graph: classical single-source Dijkstra, Yen's k-shortest loopless paths for ranked alternatives, and A* driven by a coordinate-based Euclidean heuristic that expands fewer nodes than Dijkstra for the same optimal cost.
15_task_assignment command
Example 15_task_assignment — two bipartite assignment algorithms side by side over one seeded, scale-parametrised worker/task instance: search.Hungarian computes the globally cheapest one-to-one assignment over the full cost matrix, and search.HopcroftKarp computes the largest matching once a feasibility rule prunes the edges.
Example 15_task_assignment — two bipartite assignment algorithms side by side over one seeded, scale-parametrised worker/task instance: search.Hungarian computes the globally cheapest one-to-one assignment over the full cost matrix, and search.HopcroftKarp computes the largest matching once a feasibility rule prunes the edges.
16_centrality_analytics command
Example 16_centrality_analytics — runs a suite of analytics over one shared, immutable CSR snapshot: exact Brandes betweenness centrality, four complementary whole-graph centralities (closeness and harmonic, distance-based; eigenvector and Katz, spectral/walk-based), and label-propagation community detection — with deterministic tie-breaking, and reports per-analysis evidence.
Example 16_centrality_analytics — runs a suite of analytics over one shared, immutable CSR snapshot: exact Brandes betweenness centrality, four complementary whole-graph centralities (closeness and harmonic, distance-based; eigenvector and Katz, spectral/walk-based), and label-propagation community detection — with deterministic tie-breaking, and reports per-analysis evidence.
17_transactional_log command
Example 17_transactional_log — a durable financial ledger: a WAL-backed store with a background checkpointer that folds the log into a self-sufficient on-disk snapshot, plus recovery after a simulated crash.
Example 17_transactional_log — a durable financial ledger: a WAL-backed store with a background checkpointer that folds the log into a self-sufficient on-disk snapshot, plus recovery after a simulated crash.
18_oocore_pipeline command
Example 18_oocore_pipeline — the full out-of-core (Tier 2) pipeline: generate a directed web-link graph as a CSV edge list, ingest it through the CSV reader, freeze it into a CSR snapshot, persist that snapshot as an on-disk csrfile, re-open the file by mmap, and run semi-external BFS plus PageRank directly over the mapped region.
Example 18_oocore_pipeline — the full out-of-core (Tier 2) pipeline: generate a directed web-link graph as a CSV edge list, ingest it through the CSV reader, freeze it into a CSR snapshot, persist that snapshot as an on-disk csrfile, re-open the file by mmap, and run semi-external BFS plus PageRank directly over the mapped region.
19_pattern_query command
Example 19_pattern_query — the fluent graph/query pattern API at scale.
Example 19_pattern_query — the fluent graph/query pattern API at scale.
20_concurrent_reads command
Example 20_concurrent_reads — the lock-free read contract of a frozen CSR snapshot, exercised by many concurrent readers.
Example 20_concurrent_reads — the lock-free read contract of a frozen CSR snapshot, exercised by many concurrent readers.
21_typed_recovery command
Example 21_typed_recovery — durable recovery of a typed (int64, float64) graph through the canonical recovery.Open[N, W] path.
Example 21_typed_recovery — durable recovery of a typed (int64, float64) graph through the canonical recovery.Open[N, W] path.
22_cypher command
Example 22_cypher — the GoGraph Cypher engine, the module's flagship (100% openCypher TCK compliant at the execution level), driven over a realistic, seeded social graph.
Example 22_cypher — the GoGraph Cypher engine, the module's flagship (100% openCypher TCK compliant at the execution level), driven over a realistic, seeded social graph.
23_bolt_server command
Example 23_bolt_server drives the GoGraph Bolt v5 server end to end: it starts the embedded bolt/server over an in-memory labelled property graph, connects the official neo4j-go-driver/v5 as a real client, runs a battery of Cypher queries over driver sessions, and shuts everything down cleanly with no goroutine left behind.
Example 23_bolt_server drives the GoGraph Bolt v5 server end to end: it starts the embedded bolt/server over an in-memory labelled property graph, connects the official neo4j-go-driver/v5 as a real client, runs a battery of Cypher queries over driver sessions, and shuts everything down cleanly with no goroutine left behind.
24_social_network_cli command
Package main implements `24_social_network_cli`, an example one-shot CLI that demonstrates how to build, persist and query a labelled property graph for a social-network domain using GoGraph.
Package main implements `24_social_network_cli`, an example one-shot CLI that demonstrates how to build, persist and query a labelled property graph for a social-network domain using GoGraph.
25_software_house_api command
Command 25_software_house_api is a persistent REST WebAPI that demonstrates how to build, query and mutate a multi-layer Labeled Property Graph (LPG) with GoGraph in a production-shaped service.
Command 25_software_house_api is a persistent REST WebAPI that demonstrates how to build, query and mutate a multi-layer Labeled Property Graph (LPG) with GoGraph in a production-shaped service.
26_social_scale_bench command
Example 26_social_scale_bench — a large-scale social-network benchmark for query performance and resource consumption.
Example 26_social_scale_bench — a large-scale social-network benchmark for query performance and resource consumption.
27_concurrent_txn command
Example 27_concurrent_txn — transactional ISOLATION and ATOMICITY of the WAL-backed Cypher engine, certified under concurrency and the race detector.
Example 27_concurrent_txn — transactional ISOLATION and ATOMICITY of the WAL-backed Cypher engine, certified under concurrency and the race detector.
28_negative_weights command
Example 28_negative_weights — single-source shortest paths over a graph with NEGATIVE edge weights, using Bellman-Ford where Dijkstra cannot, and cross-checking the result against Johnson's all-pairs reweighting.
Example 28_negative_weights — single-source shortest paths over a graph with NEGATIVE edge weights, using Bellman-Ford where Dijkstra cannot, and cross-checking the result against Johnson's all-pairs reweighting.
29_all_pairs command
Example 29_all_pairs — compute all-pairs shortest paths (APSP) over one shared, immutable CSR snapshot with all three APSP algorithms the module ships — search.DijkstraAPSP, search.FloydWarshall, and search.JohnsonAPSP — cross-check that the three distance matrices are bit-identical, and derive the classical graph metrics (radius, diameter, per-node eccentricity) from the result.
Example 29_all_pairs — compute all-pairs shortest paths (APSP) over one shared, immutable CSR snapshot with all three APSP algorithms the module ships — search.DijkstraAPSP, search.FloydWarshall, and search.JohnsonAPSP — cross-check that the three distance matrices are bit-identical, and derive the classical graph metrics (radius, diameter, per-node eccentricity) from the result.
30_min_spanning_tree command
Example 30_min_spanning_tree — minimum-cost backbone design over one shared, immutable CSR snapshot: it builds a seeded, scale-parametrised geographic site network, then computes its minimum spanning tree with BOTH of GoGraph's MST algorithms — Prim (search.PrimMST) and Kruskal (search.KruskalMST) — and cross-checks them against each other as a correctness oracle.
Example 30_min_spanning_tree — minimum-cost backbone design over one shared, immutable CSR snapshot: it builds a seeded, scale-parametrised geographic site network, then computes its minimum spanning tree with BOTH of GoGraph's MST algorithms — Prim (search.PrimMST) and Kruskal (search.KruskalMST) — and cross-checks them against each other as a correctness oracle.
31_metrics_observability command
Example 31_metrics_observability — GoGraph's observability surface, driven end-to-end over a realistic, seeded service-mesh call graph.
Example 31_metrics_observability — GoGraph's observability surface, driven end-to-end over a realistic, seeded service-mesh call graph.
32_euler command
Example 32_euler — Eulerian circuits over a route-inspection network, using Hierholzer's algorithm on both an undirected and a directed graph.
Example 32_euler — Eulerian circuits over a route-inspection network, using Hierholzer's algorithm on both an undirected and a directed graph.
33_generation_swap command
Example 33_generation_swap — the read-mostly MVCC snapshot-swap pattern of graph/generation, under concurrent readers.
Example 33_generation_swap — the read-mostly MVCC snapshot-swap pattern of graph/generation, under concurrent readers.
34_bolt_transactions command
Example 34_bolt_transactions — the Bolt v5 write and transaction surface, driven end to end with the official neo4j-go-driver against GoGraph's embedded Bolt server.
Example 34_bolt_transactions — the Bolt v5 write and transaction surface, driven end to end with the official neo4j-go-driver against GoGraph's embedded Bolt server.
Package graph defines the core types and interfaces shared by every backend in the gograph module.
Package graph defines the core types and interfaces shared by every backend in the gograph module.
adjlist
Package adjlist provides a mutable, sharded adjacency-list backend for the gograph module.
Package adjlist provides a mutable, sharded adjacency-list backend for the gograph module.
csr
Package csr provides an immutable Compressed Sparse Row (CSR) view of a graph for read-mostly analytical workloads.
Package csr provides an immutable Compressed Sparse Row (CSR) view of a graph for read-mostly analytical workloads.
generation
Package generation publishes immutable graph snapshots (typically csr.CSR views) under a refcount-protected pointer so readers can observe a consistent generation while a new one is being prepared in the background.
Package generation publishes immutable graph snapshots (typically csr.CSR views) under a refcount-protected pointer so readers can observe a consistent generation while a new one is being prepared in the background.
index
Package index coordinates the secondary indexes attached to a labelled property graph.
Package index coordinates the secondary indexes attached to a labelled property graph.
index/btree
Package btree provides an order-preserving property index over a constraints.Ordered value type, answering range predicates against the NodeIDs that carry each value.
Package btree provides an order-preserving property index over a constraints.Ordered value type, answering range predicates against the NodeIDs that carry each value.
index/count
Package count holds the derived, non-durable relationship count-store that backs exact cardinality estimates for the Cypher planner (design docs/count-store-design.md, task #2082).
Package count holds the derived, non-durable relationship count-store that backs exact cardinality estimates for the Cypher planner (design docs/count-store-design.md, task #2082).
index/hash
Package hash provides a sharded hash index from arbitrary comparable property values to the set of NodeIDs that carry them, represented as a 64-bit Roaring bitmap.
Package hash provides a sharded hash index from arbitrary comparable property values to the set of NodeIDs that carry them, represented as a 64-bit Roaring bitmap.
index/label
Package label provides a Roaring-bitmap-backed inverted index from label identifiers to the NodeIDs that carry them.
Package label provides a Roaring-bitmap-backed inverted index from label identifiers to the NodeIDs that carry them.
index/stats
Package stats holds the best-effort, approximate planner statistics that back the Cypher optimiser's cardinality estimates for single-column predicates (design docs/statistics-design.md, tasks #2097 / #2098).
Package stats holds the best-effort, approximate planner statistics that back the Cypher optimiser's cardinality estimates for single-column predicates (design docs/statistics-design.md, tasks #2097 / #2098).
io/csv
Package csv reads and writes graphs as edge lists in CSV format.
Package csv reads and writes graphs as edge lists in CSV format.
io/dot
Package dot writes graphs in the Graphviz DOT format (https://graphviz.org/doc/info/lang.html).
Package dot writes graphs in the Graphviz DOT format (https://graphviz.org/doc/info/lang.html).
io/graphml
Package graphml reads and writes graphs in the GraphML XML dialect (http://graphml.graphdrawing.org/).
Package graphml reads and writes graphs in the GraphML XML dialect (http://graphml.graphdrawing.org/).
io/jsonl
Package jsonl reads and writes graphs in newline-delimited JSON (NDJSON / JSON Lines) format.
Package jsonl reads and writes graphs in newline-delimited JSON (NDJSON / JSON Lines) format.
lpg
Package lpg implements the Labelled Property Graph model on top of the github.com/FlavioCFOliveira/GoGraph/graph/adjlist mutable adjacency-list backend.
Package lpg implements the Labelled Property Graph model on top of the github.com/FlavioCFOliveira/GoGraph/graph/adjlist mutable adjacency-list backend.
lpg/schema
Package schema declares the optional type schema for a labelled property graph: which labels exist, which property keys exist, which lpg.PropertyKind each property carries, and which properties each label requires.
Package schema declares the optional type schema for a labelled property graph: which labels exist, which property keys exist, which lpg.PropertyKind each property carries, and which properties each label requires.
query
Package query provides a fluent, type-safe programmatic API for expressing MATCH-style pattern queries against a labelled property graph snapshot.
Package query provides a fluent, type-safe programmatic API for expressing MATCH-style pattern queries against a labelled property graph snapshot.
internal
clock
Package clock provides a minimal, injectable wall-clock abstraction so that time-dependent code paths — the checkpoint cadence (store/checkpoint) and the Bolt session/connection deadlines (bolt/server) — can be driven by a deterministic fake clock under test (notably the deterministic simulation testing harness in internal/sim) instead of reading real wall time.
Package clock provides a minimal, injectable wall-clock abstraction so that time-dependent code paths — the checkpoint cadence (store/checkpoint) and the Bolt session/connection deadlines (bolt/server) — can be driven by a deterministic fake clock under test (notably the deterministic simulation testing harness in internal/sim) instead of reading real wall time.
concurrencydoc
Package concurrencydoc holds the CI doc-scan gate that enforces the CLAUDE.md mandate: "Every exported type carries a godoc clause stating whether it is safe for concurrent use; ambiguity is a defect."
Package concurrencydoc holds the CI doc-scan gate that enforces the CLAUDE.md mandate: "Every exported type carries a godoc clause stating whether it is safe for concurrent use; ambiguity is a defect."
crashinject
Package crashinject provides a subprocess-based crash-injection harness for deterministic crash-safety testing of WAL, snapshot, and checkpoint write paths.
Package crashinject provides a subprocess-based crash-injection harness for deterministic crash-safety testing of WAL, snapshot, and checkpoint write paths.
crashpoint
Package crashpoint holds the production-callable half of the crash-injection machinery: the Breakpoint hook and the environment variables that drive it.
Package crashpoint holds the production-callable half of the crash-injection machinery: the Breakpoint hook and the environment variables that drive it.
goldens
Package goldens provides a uniform golden-file assertion helper for tests that compare byte-for-byte output against stored fixtures.
Package goldens provides a uniform golden-file assertion helper for tests that compare byte-for-byte output against stored fixtures.
invariants
Package invariants provides hardened assertion helpers for graph property-based tests.
Package invariants provides hardened assertion helpers for graph property-based tests.
metrics
Package metrics is GoGraph's optional observability surface.
Package metrics is GoGraph's optional observability surface.
metrics/prometheus
Package prometheus provides a [metrics.Backend] implementation that produces Prometheus-compatible text exposition output — with no dependency on github.com/prometheus/client_golang.
Package prometheus provides a [metrics.Backend] implementation that produces Prometheus-compatible text exposition output — with no dependency on github.com/prometheus/client_golang.
shapegen
Package shapegen defines a uniform contract for graph-shape generators used across property-based tests, golden corpora, and benchmarks in GoGraph.
Package shapegen defines a uniform contract for graph-shape generators used across property-based tests, golden corpora, and benchmarks in GoGraph.
sim
Package sim implements a deterministic simulation testing (DST) harness for the GoGraph engine, modelled on TigerBeetle's VOPR.
Package sim implements a deterministic simulation testing (DST) harness for the GoGraph engine, modelled on TigerBeetle's VOPR.
subproc
Package subproc provides a deterministic subprocess helper for cross-process tests.
Package subproc provides a deterministic subprocess helper for cross-process tests.
testfs
Package testfs provides a fault-injection wrapper around *os.File for use in crash-safety and durability tests of WAL, snapshot, and checkpoint paths.
Package testfs provides a fault-injection wrapper around *os.File for use in crash-safety and durability tests of WAL, snapshot, and checkpoint paths.
testlayers
Package testlayers gates tests by execution layer.
Package testlayers gates tests by execution layer.
Package metrics is the public observability facade for GoGraph.
Package metrics is the public observability facade for GoGraph.
Package search provides graph traversal and path-finding algorithms over the immutable github.com/FlavioCFOliveira/GoGraph/graph/csr.CSR read-only view.
Package search provides graph traversal and path-finding algorithms over the immutable github.com/FlavioCFOliveira/GoGraph/graph/csr.CSR read-only view.
centrality
Package centrality implements vertex importance metrics.
Package centrality implements vertex importance metrics.
community
Package community implements community detection algorithms for undirected graphs.
Package community implements community detection algorithms for undirected graphs.
extern
Package extern provides graph algorithms that operate directly on a Tier 2 (mmap-backed) csrfile.Reader without first materialising the CSR in memory.
Package extern provides graph algorithms that operate directly on a Tier 2 (mmap-backed) csrfile.Reader without first materialising the CSR in memory.
flow
Package flow implements network-flow algorithms over directed capacitated graphs.
Package flow implements network-flow algorithms over directed capacitated graphs.
Package store provides the composed teardown owner that bundles a WAL-backed store's durability pieces — a wal.Writer and an optional background [checkpoint.Checkpointer] — and closes them in the single crash-safe order.
Package store provides the composed teardown owner that bundles a WAL-backed store's durability pieces — a wal.Writer and an optional background [checkpoint.Checkpointer] — and closes them in the single crash-safe order.
bulk
Package bulk implements the bulk-loading path that bypasses the transactional WAL stack and writes a Tier 2 csrfile directly from a stream of edges.
Package bulk implements the bulk-loading path that bypasses the transactional WAL stack and writes a Tier 2 csrfile directly from a stream of edges.
checkpoint
Package checkpoint runs a background goroutine that periodically folds the WAL tail into a fresh snapshot and truncates the WAL.
Package checkpoint runs a background goroutine that periodically folds the WAL tail into a fresh snapshot and truncates the WAL.
csrfile
Package csrfile defines the on-disk binary format used by GoGraph's Tier 2 (out-of-core, mmap-backed) CSR storage.
Package csrfile defines the on-disk binary format used by GoGraph's Tier 2 (out-of-core, mmap-backed) CSR storage.
recovery
Package recovery rebuilds the in-memory graph state from a snapshot (when present) plus the WAL tail, and exposes the harness used to fuzz crash semantics in tests.
Package recovery rebuilds the in-memory graph state from a snapshot (when present) plus the WAL tail, and exposes the harness used to fuzz crash semantics in tests.
snapshot
Package snapshot serialises the durable on-disk representation of a gograph snapshot (CSR + LPG + schema) and reads it back into a fresh process.
Package snapshot serialises the durable on-disk representation of a gograph snapshot (CSR + LPG + schema) and reads it back into a fresh process.
txn
Package txn provides the transactional surface (Begin / Commit / Rollback) layered over an lpg.Graph and a wal.Writer.
Package txn provides the transactional surface (Begin / Commit / Rollback) layered over an lpg.Graph and a wal.Writer.
wal
Package wal implements a versioned, length-prefixed, CRC32C-checksummed Write-Ahead Log for the gograph durability stack.
Package wal implements a versioned, length-prefixed, CRC32C-checksummed Write-Ahead Log for the gograph durability stack.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL