Transforms astrolabe.json into a directed network for graph analysis.
| Layer | Components |
|---|---|
| Data | astrolabe.json — entries with ref and record |
| Backend | graph_builder · degree · centrality · dag · community · cluster |
| API | GET /api/plugins/leannets/graph?size=&color=&cluster= |
| Network | d3-force simulation + cluster attraction force |
| Color | entryColor.ts → EntryBlock · EntryLink · EntryDetail |
Each entry: { "ref": [...], "record": "<JSON>" }
- Atoms (degree 0):
ref = [self_hash]→ nodes - Edges (degree 1):
ref = [A, B]→ directed edge A → B - Hash: SHA256(ref₁ ‖ 0x00 ‖ ref₂ ‖ ... ‖ record)[:12 hex]
Two required fields for every atom:
| Field | Values |
|---|---|
sort |
definition · theorem · lemma · proposition · corollary · proof · instance · citation |
source |
tex · lean · bib (future: rocq · agda · hm) |
Optional fields by source:
| Field | Source | Description |
|---|---|---|
title |
all | Display name |
notes |
tex lean |
Natural language, may contain $LaTeX$ and \\entryref{hash}{text} |
content |
lean |
Source code (type signature or tactic body) |
state |
lean |
proven or sorry |
key |
bib |
Citation identifier |
Sort derived from LaTeX environment: \\begin{theorem} → sort: "theorem"
{ "sort": "theorem", "source": "tex", "title": "...", "notes": "..." }
{ "sort": "proof", "source": "tex", "notes": "..." }Sort derived from declaration keyword: def → definition, theorem → theorem
{ "sort": "theorem", "source": "lean", "title": "...", "state": "proven", "content": "..." }
{ "sort": "proof", "source": "lean", "title": "... (proof)", "content": "..." }{ "sort": "citation", "source": "bib", "key": "...", "notes": "..." }Sort is auto-derived: (sort_A, sort_B)
| Edge | Meaning |
|---|---|
(theorem, proof) |
Statement ↔ proof |
(theorem, definition) |
Depends on definition |
(proof, lemma) |
Proof cites lemma |
(theorem, theorem) |
Cross-source correspondence |
| Metric | Formula |
|---|---|
| uniform | |
| degree | |
| in-degree | |
| out-degree | |
| pagerank | |
| betweenness | |
| katz | |
| hub | |
| authority | |
| depth | |
| reachability |
| Mode | Method |
|---|---|
| sort | |
| community | Greedy modularity maximization |
| layer | |
| pagerank | |
| spectral | Communities from eigenvectors of |
| curvature |
Colors propagate to: nodes, entry blocks, entry links, detail panel.
| Method | Algorithm |
|---|---|
| louvain | Greedy modularity |
| sort | Partition by sort |
| stage | Partition by depth |
| spectral |
|
Cluster force: $\mathbf{f}v = s \cdot \alpha \cdot (\mathbf{c}{k(v)} - \mathbf{x}_v)$ where