graph TD subgraph "Generic (Hash-map)" A1["node u"] -->|"hash lookup πΈ"| B1["neighbors map"] B1 -->|"hash lookup πΈ"| C1["edge w_uv"] end subgraph "CSR" A2["offsets[u]"] -->|"direct index β "| B2["targets[e]"] B2 -->|"direct index β "| C2["weights[e]"] end style A1 fill:#fce4ec,stroke:#ad1457,stroke-width:3px style B1 fill:#fce4ec,stroke:#ad1457,stroke-width:3px style C1 fill:#fce4ec,stroke:#ad1457,stroke-width:3px style A2 fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style B2 fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style C2 fill:#e3f2fd,stroke:#1565c0,stroke-width:3px
graph TD subgraph "Node 0" O0["offsets[0]=0"] end subgraph "Node 1" O1["offsets[1]=2"] end subgraph "Node 2" O2["offsets[2]=4"] end subgraph "Targets" T["[1, 2, 0, 2, 0, 1]"] end subgraph "Weights" W["[10, 20, 30, 40, 50, 60]"] end O0 -.->|"edges 0-1"| T O1 -.->|"edges 2-3"| T O2 -.->|"edges 4-5"| T style O0 fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style O1 fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style O2 fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style T fill:#f3e5f5,stroke:#7b1fa2,stroke-width:3px style W fill:#f3e5f5,stroke:#7b1fa2,stroke-width:3px
graph LR reset["Reset\npredecessor map"] --> relax["Relax all edges\nO(E)"] relax --> changed{"Changed?"} changed -->|"Yes"| cycle["Find cycle in\npredecessor graph\nO(V)"] changed -->|"No"| done["Return\nfound > 0"] cycle --> neg{"Negative?"} neg -->|"Yes"| yield["Yield cycle\nvia callback"] neg -->|"No"| relax yield --> relax style reset fill:#fce4ec,stroke:#ad1457,stroke-width:3px style relax fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style changed fill:#fff9c4,stroke:#f57f17,stroke-width:3px style cycle fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style neg fill:#fff9c4,stroke:#f57f17,stroke-width:3px style yield fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px style done fill:#e3f2fd,stroke:#1565c0,stroke-width:3px
graph LR 0 -->|"-5"| 1 1 -->|"-5"| 2 2 -->|"-5"| 0 0 -->|"w_01"| 1 0 -->|"w_02"| 2 0 -->|"w_03"| 3 1 -->|"w_12"| 2 1 -->|"w_13"| 3 1 -->|"w_14"| 4 2 -->|"w_23"| 3 2 -->|"w_24"| 4 2 -->|"w_25"| 5 style 0 fill:#ffcdd2,stroke:#c62828,stroke-width:3px style 1 fill:#ffcdd2,stroke:#c62828,stroke-width:3px style 2 fill:#ffcdd2,stroke:#c62828,stroke-width:3px
graph TD subgraph "CSR Memory Layout" M1["[wβ wβ wβ ... wβ] βββΆ sequential scan"] end subgraph "Hash-map Memory Layout" M2["[wβ ββββ wβ ββ wβ ...] βββΆ random access"] end style M1 fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style M2 fill:#fce4ec,stroke:#ad1457,stroke-width:3px
graph TD subgraph "Future Architecture" A["CSR Graph\n(fast paths)"] --> B["Howard's\nAlgorithm"] C["Hash Index\n(mutation)"] -.->|"rebuild"| A end style A fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style B fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px style C fill:#fce4ec,stroke:#ad1457,stroke-width:3px