Add concrete type aliases of VertexMap and EdgeMap for Graph and AppendGraph

This commit is contained in:
2026-07-06 18:49:02 +02:00
parent 266dee783b
commit 1446103d34
3 changed files with 8 additions and 3 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
pub mod append_graph; pub mod append_graph;
pub mod graph; pub mod graph;
pub use append_graph::AppendGraph; pub use append_graph::{AppendGraph, AppendGraphEdgeMap, AppendGraphVertexMap};
pub use graph::Graph; pub use graph::{Graph, GraphEdgeMap, GraphVertexMap};
+3
View File
@@ -7,6 +7,9 @@ pub struct Vertex(usize);
#[derive(Copy, Clone, PartialEq, Eq, Debug)] #[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub struct Edge(usize); pub struct Edge(usize);
pub type AppendGraphVertexMap<T> = VertexMap<Vertex, T>;
pub type AppendGraphEdgeMap<T> = EdgeMap<Edge, T>;
impl Edge { impl Edge {
fn normalize(&self) -> Self { fn normalize(&self) -> Self {
Self(self.0 & !1) Self(self.0 & !1)
+3 -1
View File
@@ -4,9 +4,11 @@ use crate::maps::{EdgeMap, VertexMap};
use crate::traits::{GraphTopology, GraphTopologyDeletion, IncidenceCursor}; use crate::traits::{GraphTopology, GraphTopologyDeletion, IncidenceCursor};
pub type Vertex = Index<VertexIncidenceHeader, usize, usize>; pub type Vertex = Index<VertexIncidenceHeader, usize, usize>;
pub type Edge = Index<IncidenceEntry, usize, usize>; pub type Edge = Index<IncidenceEntry, usize, usize>;
pub type GraphVertexMap<T> = VertexMap<Vertex, T>;
pub type GraphEdgeMap<T> = EdgeMap<Edge, T>;
#[derive(Copy, Clone, PartialEq, Eq, Debug)] #[derive(Copy, Clone, PartialEq, Eq, Debug)]
struct VertexSlot(usize); struct VertexSlot(usize);