Add GraphTopology::incident_vertices and tests
This commit is contained in:
+1
-1
@@ -2,7 +2,6 @@ use crate::maps::{EdgeMap, VertexMap};
|
||||
|
||||
// TODO: Add functions to reserve memory for vertices and edges.
|
||||
// TODO: Add iterator of incident edges for a vertex.
|
||||
// TODO: Add finding incident vertices for an edge.
|
||||
// TODO: Split out GraphTopologyAddition trait.
|
||||
pub trait GraphTopology {
|
||||
type Vertex: Copy + Eq;
|
||||
@@ -18,6 +17,7 @@ pub trait GraphTopology {
|
||||
fn are_adjacent(&self, v1: Self::Vertex, v2: Self::Vertex) -> bool;
|
||||
fn vertices(&self) -> impl Iterator<Item = Self::Vertex>;
|
||||
fn adjacent_vertices(&self, v: Self::Vertex) -> impl Iterator<Item = Self::Vertex>;
|
||||
fn incident_vertices(&self, e: Self::Edge) -> (Self::Vertex, Self::Vertex);
|
||||
fn edges(&self) -> impl Iterator<Item = Self::Edge>;
|
||||
fn incidences(&self, v: Self::Vertex) -> impl Iterator<Item = (Self::Vertex, Self::Edge)>;
|
||||
fn add_vertex(&mut self) -> Self::Vertex;
|
||||
|
||||
Reference in New Issue
Block a user