// TODO: Add functions to reserve memory for vertices and edges. // TODO: Add iterator of edges. // TODO: Split out GraphTopologyAddition trait. pub trait GraphTopology { type Vertex: Copy + Eq; type Edge; fn vertex_count(&self) -> usize; fn edge_count(&self) -> usize; fn degree(&self, v: Self::Vertex) -> usize; fn are_adjacent(&self, v1: Self::Vertex, v2: Self::Vertex) -> bool; fn vertices(&self) -> impl Iterator; fn neighbors(&self, v: Self::Vertex) -> impl Iterator; fn add_vertex(&mut self) -> Self::Vertex; fn add_edge(&mut self, v1: Self::Vertex, v2: Self::Vertex) -> Self::Edge; } pub trait GraphTopologyDeletion: GraphTopology { fn delete_vertex(&mut self, v: Self::Vertex); fn delete_edge(&mut self, e: Self::Edge); }