Module graph

Module graph 

Source
Expand description

Core DAG (Directed Acyclic Graph) data structure.

This module provides the fundamental graph structure with nodes and edges.

§Performance Characteristics

  • Node/Edge Insertion: O(1) amortized with HashMap and cached adjacency lists
  • Child/Parent Lookups: O(1) via cached adjacency lists (not O(E) iteration)
  • ID→Index Mapping: O(1) via HashMap (not O(N) scan)
  • Node Width: O(1) via pre-computed cache

§Memory Overhead

Per node:

  • ~100 bytes (node data, caches, adjacency list headers)

Per edge:

  • ~16 bytes (adjacency list entries, both directions)

§Security

  • No unsafe code
  • For untrusted input, consider limiting maximum nodes/edges to prevent resource exhaustion
  • Maximum node ID: usize::MAX (up to 20 decimal digits)

Structs§

DAG
A Directed Acyclic Graph (DAG) with ASCII rendering capabilities.

Enums§

RenderMode
Rendering mode for the DAG visualization.