Rename EntityMap to ElementMap (tests not yet updated)

This commit is contained in:
2026-08-06 23:01:10 +02:00
parent 7d8c9aaa10
commit a7346bd782
9 changed files with 58 additions and 58 deletions
+9 -9
View File
@@ -1,6 +1,6 @@
//! [`AppendGraph`], an undirected graph topology supporting addition only.
use crate::maps::EntityMap;
use crate::maps::ElementMap;
use crate::traits::{GraphTopology, GraphTopologyAddition, Incidence, IncidenceCursor};
/// An opaque handle identifying a vertex in an [`AppendGraph`].
@@ -17,11 +17,11 @@ pub struct Vertex(usize);
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]
pub struct Edge(usize);
/// An [`EntityMap`] for [`AppendGraph`] vertices.
pub type AppendGraphVertexMap<T> = EntityMap<Vertex, T>;
/// An [`ElementMap`] for [`AppendGraph`] vertices.
pub type AppendGraphVertexMap<T> = ElementMap<Vertex, T>;
/// An [`EntityMap`] for [`AppendGraph`] edges.
pub type AppendGraphEdgeMap<T> = EntityMap<Edge, T>;
/// An [`ElementMap`] for [`AppendGraph`] edges.
pub type AppendGraphEdgeMap<T> = ElementMap<Edge, T>;
/// An [`Incidence`] for [`AppendGraph`].
pub type AppendGraphIncidence = Incidence<Vertex, Edge>;
@@ -147,16 +147,16 @@ impl GraphTopology for AppendGraph {
self.vertices.len()
}
fn vertex_map<T: Clone>(&self, default: T) -> EntityMap<Self::Vertex, T> {
EntityMap::new(default, |v| v.0, self.vertex_capacity())
fn vertex_map<T: Clone>(&self, default: T) -> ElementMap<Self::Vertex, T> {
ElementMap::new(default, |v| v.0, self.vertex_capacity())
}
fn edge_count(&self) -> usize {
self.incidences.len() / 2
}
fn edge_map<T: Clone>(&self, default: T) -> EntityMap<Self::Edge, T> {
EntityMap::new(default, |e| e.0 / 2, self.edge_capacity())
fn edge_map<T: Clone>(&self, default: T) -> ElementMap<Self::Edge, T> {
ElementMap::new(default, |e| e.0 / 2, self.edge_capacity())
}
fn degree(&self, v: Self::Vertex) -> usize {
+9 -9
View File
@@ -2,7 +2,7 @@
use typed_generational_arena::{Arena, Index};
use crate::maps::EntityMap;
use crate::maps::ElementMap;
use crate::traits::{
GraphTopology, GraphTopologyAddition, GraphTopologyDeletion, Incidence, IncidenceCursor,
};
@@ -19,11 +19,11 @@ pub type Vertex = Index<VertexIncidenceHeader, usize, usize>;
/// deleted. Obtain via graph methods like [`Graph::add_edge`] and [`Graph::edges`].
pub type Edge = Index<IncidenceEntry, usize, usize>;
/// An [`EntityMap`] for [`Graph`] vertices.
pub type GraphVertexMap<T> = EntityMap<Vertex, T>;
/// An [`ElementMap`] for [`Graph`] vertices.
pub type GraphVertexMap<T> = ElementMap<Vertex, T>;
/// An [`EntityMap`] for [`Graph`] edges.
pub type GraphEdgeMap<T> = EntityMap<Edge, T>;
/// An [`ElementMap`] for [`Graph`] edges.
pub type GraphEdgeMap<T> = ElementMap<Edge, T>;
/// An [`Incidence`] for [`Graph`].
pub type GraphIncidence = Incidence<Vertex, Edge>;
@@ -241,16 +241,16 @@ impl GraphTopology for Graph {
self.vertices.len()
}
fn vertex_map<T: Clone>(&self, default: T) -> EntityMap<Self::Vertex, T> {
EntityMap::new(default, |v| v.arr_idx(), self.vertex_capacity())
fn vertex_map<T: Clone>(&self, default: T) -> ElementMap<Self::Vertex, T> {
ElementMap::new(default, |v| v.arr_idx(), self.vertex_capacity())
}
fn edge_count(&self) -> usize {
self.incidences.len() / 2
}
fn edge_map<T: Clone>(&self, default: T) -> EntityMap<Self::Edge, T> {
EntityMap::new(default, |e| e.arr_idx() / 2, self.edge_capacity())
fn edge_map<T: Clone>(&self, default: T) -> ElementMap<Self::Edge, T> {
ElementMap::new(default, |e| e.arr_idx() / 2, self.edge_capacity())
}
fn degree(&self, v: Self::Vertex) -> usize {