Skip to main content

Module graph

Module graph 

Source
Expand description

Graph — pure-Rust port of igraph_t.

Storage is the indexed edge list that upstream igraph uses (see references/igraph/include/igraph_datatype.h:105-116):

  • from[e], to[e] — canonical edge list. Edge e runs from from[e] to to[e]; |from| == |to| == ecount.
  • oi[i] — edge ids ordered by from (and then to).
  • ii[i] — edge ids ordered by to (and then from).
  • os[v]..os[v+1] — slice of oi covering vertex v’s out-edges.
  • is[v]..is[v+1] — slice of ii covering vertex v’s in-edges.

For undirected graphs the edge list is canonicalised so from[e] <= to[e] (matching upstream igraph’s invariant in type_indexededgelist.c:282-288). The doubled in/out indexing makes neighbors() symmetric for undirected graphs without storing each edge twice.

ALGO-CORE-001a (Phase 1, this file): struct + new/with_vertices + add_vertices/add_edge/add_edges + vcount/ecount/is_directed + neighbors/degree + Clone.

Follow-up AWUs:

  • 001b: incident, edge-id helpers.
  • 001c: delete_vertices/delete_edges.
  • 001d: edge/edges/get_eid/get_eids/get_all_eids_between.
  • 001e: property cache, is_same_graph.

Attribute system → ALGO-AT-* (out of scope here).

Structs§

Graph
Counterpart of igraph_t (see references/igraph/include/igraph_datatype.h).

Type Aliases§

EdgeId
Edge id. Same width as VertexId; an edge id is its position in from/to.
VertexId
Vertex id. The Phase-0 ADR-0007 fixes this to u32; Option<VertexId> is the idiomatic “no vertex” sentinel (igraph C uses -1).