From d711e6857702cc780fda00b52ecd9bf53d4261da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20M=C3=BCller?= Date: Wed, 22 Jul 2026 13:30:09 +0200 Subject: [PATCH] Replace VertexMap and EdgeMap with now public EntityMap --- src/algorithms.rs | 28 +++--- src/lib.rs | 5 +- src/maps.rs | 105 ++++++-------------- src/models/append_graph.rs | 14 +-- src/models/graph.rs | 14 +-- src/testing/bfs_testing.rs | 4 +- src/testing/dfs_testing.rs | 6 +- src/testing/dijkstra_testing.rs | 10 +- src/testing/maps_testing.rs | 170 ++------------------------------ src/traits.rs | 11 ++- tests/maps.rs | 23 +---- 11 files changed, 90 insertions(+), 300 deletions(-) diff --git a/src/algorithms.rs b/src/algorithms.rs index b974441..f2370c0 100644 --- a/src/algorithms.rs +++ b/src/algorithms.rs @@ -1,7 +1,7 @@ use std::cmp::Ordering; use std::collections::{BinaryHeap, VecDeque}; -use crate::maps::VertexMap; +use crate::maps::EntityMap; use crate::traits::{GraphTopology, IncidenceCursor}; #[derive(PartialEq, Eq)] @@ -23,8 +23,8 @@ impl Ord for DistanceOrderedVertex { } pub struct DijkstraResult { - pub distances: VertexMap>, - pub predecessors: VertexMap>, + pub distances: EntityMap>, + pub predecessors: EntityMap>, } // TODO: Generalize the return type of the weight function. @@ -54,7 +54,7 @@ pub fn dijkstra_distances( graph: &G, source: G::Vertex, weight: W, -) -> VertexMap> +) -> EntityMap> where G: GraphTopology, W: Fn(G::Edge) -> u32, @@ -65,7 +65,7 @@ where pub fn dijkstra_distances_unweighted( graph: &G, source: G::Vertex, -) -> VertexMap> +) -> EntityMap> where G: GraphTopology, { @@ -77,7 +77,7 @@ fn dijkstra_impl( source: G::Vertex, weight: W, mut on_relax: F, -) -> VertexMap> +) -> EntityMap> where G: GraphTopology, W: Fn(G::Edge) -> u32, @@ -113,8 +113,8 @@ where } pub struct BfsResult { - pub distances: VertexMap>, - pub predecessors: VertexMap>, + pub distances: EntityMap>, + pub predecessors: EntityMap>, } pub fn bfs(graph: &G, source: G::Vertex) -> BfsResult @@ -132,7 +132,7 @@ where } } -pub fn bfs_distances(graph: &G, source: G::Vertex) -> VertexMap> +pub fn bfs_distances(graph: &G, source: G::Vertex) -> EntityMap> where G: GraphTopology, { @@ -158,7 +158,7 @@ where } struct BfsImplResult { - distances: VertexMap>, + distances: EntityMap>, found: Option<(V, u32)>, } @@ -195,8 +195,8 @@ where } pub struct DfsResult { - pub visited: VertexMap, - pub predecessors: VertexMap>, + pub visited: EntityMap, + pub predecessors: EntityMap>, } pub fn dfs(graph: &G, source: G::Vertex) -> DfsResult @@ -214,7 +214,7 @@ where } } -pub fn dfs_visited(graph: &G, source: G::Vertex) -> VertexMap +pub fn dfs_visited(graph: &G, source: G::Vertex) -> EntityMap where G: GraphTopology, { @@ -240,7 +240,7 @@ where } struct DfsImplResult { - visited: VertexMap, + visited: EntityMap, found: Option, } diff --git a/src/lib.rs b/src/lib.rs index 593f258..b8bc1ee 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,7 +7,7 @@ //! //! * Undirected graph types [`Graph`] and [`AppendGraph`] built on a flat, index-based adjacency //! list, -//! * [`VertexMap`] and [`EdgeMap`] to freely associate custom data with vertices and edges, +//! * [`EntityMap`] to freely associate custom data with vertices and edges, //! * Connectivity and pathing algorithms: [Dijkstra's algorithm], [DFS], and [BFS] in different //! variants, //! * Exposed traits to implement custom graph data structures or algorithms. @@ -118,8 +118,7 @@ //! [BFS]: crate::algorithms::bfs //! [Dijkstra's algorithm]: crate::algorithms::dijkstra //! [DFS]: crate::algorithms::dfs -//! [`EdgeMap`]: crate::maps::EdgeMap -//! [`VertexMap`]: crate::maps::VertexMap +//! [`EntityMap`]: crate::maps::EntityMap //! [`AppendGraph`]: crate::models::AppendGraph //! [`Graph`]: crate::models::Graph //! [`GraphTopology`]: crate::traits::GraphTopology diff --git a/src/maps.rs b/src/maps.rs index 699587d..7cabb0a 100644 --- a/src/maps.rs +++ b/src/maps.rs @@ -1,84 +1,32 @@ +//! Provides maps to associate custom data to graph vertices and edges. +//! +//! [`EntityMap`] provides a copy-on-write, [`Vec`]-backed map to associate data to either all +//! vertices or all edges in a graph. + use std::ops::{Index, IndexMut}; -use crate::traits::GraphTopology; - -pub struct VertexMap { - inner: EntityMap, -} - -impl VertexMap { - pub fn new(default: T, to_index: fn(V) -> usize, capacity: usize) -> Self { - Self { - inner: EntityMap::new(default, to_index, capacity), - } - } - - // Reads beyond 'capacity' are valid and return the default value. - pub fn capacity(&self) -> usize { - self.inner.capacity() - } - - pub fn sync>(&mut self, graph: &G) { - self.inner.resize(graph.vertex_capacity()); - } -} - -impl Index for VertexMap { - type Output = T; - - fn index(&self, v: V) -> &T { - &self.inner[v] - } -} - -impl IndexMut for VertexMap { - fn index_mut(&mut self, v: V) -> &mut T { - &mut self.inner[v] - } -} - -pub struct EdgeMap { - inner: EntityMap, -} - -impl EdgeMap { - pub fn new(default: T, to_index: fn(E) -> usize, capacity: usize) -> Self { - Self { - inner: EntityMap::new(default, to_index, capacity), - } - } - - // Reads beyond 'capacity' are valid and return the default value. - pub fn capacity(&self) -> usize { - self.inner.capacity() - } - - pub fn sync>(&mut self, graph: &G) { - self.inner.resize(graph.edge_capacity()); - } -} - -impl Index for EdgeMap { - type Output = T; - - fn index(&self, e: E) -> &T { - &self.inner[e] - } -} - -impl IndexMut for EdgeMap { - fn index_mut(&mut self, e: E) -> &mut T { - &mut self.inner[e] - } -} - -struct EntityMap { +/// A map to associate custom data to graph vertices or edges. +/// +/// This map uses raw entity indices to associate homogenous custom data of type `T` to graph +/// vertices or edges. The implementation uses a [`Vec`], allocating contiguous slots for the data, +/// which means that the provided index conversion function should map entities to contiguous +/// indices, or indices with relatively few gaps. +/// +/// Data allocation happens as copy-on-write, i.e. the backing [`Vec`] is only resized if a value +/// beyond current capacity is written, but the `default` value can transparently be read. No bound +/// or validity checks are performed by the map on the provided entities. +/// +/// Use [`GraphTopology::vertex_map`] or [`GraphTopology::edge_map`] to obtain an `EntityMap` for +/// vertices or edges, respectively. +pub struct EntityMap { data: Vec, default: T, to_index: fn(E) -> usize, } impl EntityMap { + /// Creates a new map with the given `default` value, an index conversion function `to_index`, + /// and an initial `capacity`. pub fn new(default: T, to_index: fn(E) -> usize, capacity: usize) -> Self { Self { data: vec![default.clone(); capacity], @@ -87,11 +35,18 @@ impl EntityMap { } } + /// Returns the total number of data entries the map can write without reallocating. Reads + /// beyond `capacity` are valid and return the default value. pub fn capacity(&self) -> usize { - self.data.len() + self.data.capacity() } - pub fn resize(&mut self, capacity: usize) { + /// Extends the internal data storage of the map to `capacity`, pre-filling any new slots with + /// the default value. + /// + /// Use this before writing data for new graph entities to avoid incremental growth on the first + /// write to each new entity. + pub fn extend(&mut self, capacity: usize) { if capacity > self.data.len() { self.data.resize(capacity, self.default.clone()); } diff --git a/src/models/append_graph.rs b/src/models/append_graph.rs index 2487f23..9cbdbca 100644 --- a/src/models/append_graph.rs +++ b/src/models/append_graph.rs @@ -1,4 +1,4 @@ -use crate::maps::{EdgeMap, VertexMap}; +use crate::maps::EntityMap; use crate::traits::{GraphTopology, IncidenceCursor}; #[derive(Copy, Clone, PartialEq, Eq, Debug)] @@ -7,8 +7,8 @@ pub struct Vertex(usize); #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub struct Edge(usize); -pub type AppendGraphVertexMap = VertexMap; -pub type AppendGraphEdgeMap = EdgeMap; +pub type AppendGraphVertexMap = EntityMap; +pub type AppendGraphEdgeMap = EntityMap; impl Edge { fn normalize(&self) -> Self { @@ -94,8 +94,8 @@ impl GraphTopology for AppendGraph { self.vertices.capacity() } - fn vertex_map(&self, default: T) -> VertexMap { - VertexMap::new(default, |v| v.0, self.vertex_capacity()) + fn vertex_map(&self, default: T) -> EntityMap { + EntityMap::new(default, |v| v.0, self.vertex_capacity()) } fn edge_count(&self) -> usize { @@ -106,8 +106,8 @@ impl GraphTopology for AppendGraph { self.incidences.len() / 2 } - fn edge_map(&self, default: T) -> EdgeMap { - EdgeMap::new(default, |e| e.0 / 2, self.edge_capacity()) + fn edge_map(&self, default: T) -> EntityMap { + EntityMap::new(default, |e| e.0 / 2, self.edge_capacity()) } fn degree(&self, v: Self::Vertex) -> usize { diff --git a/src/models/graph.rs b/src/models/graph.rs index ed86205..89ad70e 100644 --- a/src/models/graph.rs +++ b/src/models/graph.rs @@ -1,13 +1,13 @@ use typed_generational_arena::{Arena, Index}; -use crate::maps::{EdgeMap, VertexMap}; +use crate::maps::EntityMap; use crate::traits::{GraphTopology, GraphTopologyDeletion, IncidenceCursor}; pub type Vertex = Index; pub type Edge = Index; -pub type GraphVertexMap = VertexMap; -pub type GraphEdgeMap = EdgeMap; +pub type GraphVertexMap = EntityMap; +pub type GraphEdgeMap = EntityMap; #[derive(Copy, Clone, PartialEq, Eq, Debug)] struct VertexSlot(usize); @@ -163,8 +163,8 @@ impl GraphTopology for Graph { self.vertices.capacity() } - fn vertex_map(&self, default: T) -> VertexMap { - VertexMap::new(default, |v| v.arr_idx(), self.vertex_capacity()) + fn vertex_map(&self, default: T) -> EntityMap { + EntityMap::new(default, |v| v.arr_idx(), self.vertex_capacity()) } fn edge_count(&self) -> usize { @@ -175,8 +175,8 @@ impl GraphTopology for Graph { self.incidences.capacity() / 2 } - fn edge_map(&self, default: T) -> EdgeMap { - EdgeMap::new(default, |e| e.arr_idx() / 2, self.edge_capacity()) + fn edge_map(&self, default: T) -> EntityMap { + EntityMap::new(default, |e| e.arr_idx() / 2, self.edge_capacity()) } fn degree(&self, v: Self::Vertex) -> usize { diff --git a/src/testing/bfs_testing.rs b/src/testing/bfs_testing.rs index 709ac9f..233a9e7 100644 --- a/src/testing/bfs_testing.rs +++ b/src/testing/bfs_testing.rs @@ -194,7 +194,7 @@ macro_rules! bfs_tests { } fn assert_bfs_distances( - distances: &$crate::maps::VertexMap< + distances: &$crate::maps::EntityMap< <$T as $crate::traits::GraphTopology>::Vertex, Option, >, @@ -222,7 +222,7 @@ macro_rules! bfs_tests { } fn assert_bfs_predecessors( - predecessors: &$crate::maps::VertexMap< + predecessors: &$crate::maps::EntityMap< <$T as $crate::traits::GraphTopology>::Vertex, Option<<$T as $crate::traits::GraphTopology>::Vertex>, >, diff --git a/src/testing/dfs_testing.rs b/src/testing/dfs_testing.rs index 78238c8..eb59676 100644 --- a/src/testing/dfs_testing.rs +++ b/src/testing/dfs_testing.rs @@ -163,7 +163,7 @@ macro_rules! dfs_tests { } fn assert_dfs_visited( - visited: &$crate::maps::VertexMap<<$T as $crate::traits::GraphTopology>::Vertex, bool>, + visited: &$crate::maps::EntityMap<<$T as $crate::traits::GraphTopology>::Vertex, bool>, vertices: &[<$T as $crate::traits::GraphTopology>::Vertex], ) { for i in 0..10 { @@ -177,8 +177,8 @@ macro_rules! dfs_tests { fn assert_dfs_predecessors( graph: &$T, - visited: &$crate::maps::VertexMap<<$T as $crate::traits::GraphTopology>::Vertex, bool>, - predecessors: &$crate::maps::VertexMap< + visited: &$crate::maps::EntityMap<<$T as $crate::traits::GraphTopology>::Vertex, bool>, + predecessors: &$crate::maps::EntityMap< <$T as $crate::traits::GraphTopology>::Vertex, Option<<$T as $crate::traits::GraphTopology>::Vertex>, >, diff --git a/src/testing/dijkstra_testing.rs b/src/testing/dijkstra_testing.rs index 3815c4e..f53eee1 100644 --- a/src/testing/dijkstra_testing.rs +++ b/src/testing/dijkstra_testing.rs @@ -131,7 +131,7 @@ macro_rules! dijkstra_tests { } fn assert_distances_single_vertex( - distances: &$crate::maps::VertexMap< + distances: &$crate::maps::EntityMap< <$T as $crate::traits::GraphTopology>::Vertex, Option, >, @@ -160,7 +160,7 @@ macro_rules! dijkstra_tests { } fn assert_distances_disconnected( - distances: &$crate::maps::VertexMap< + distances: &$crate::maps::EntityMap< <$T as $crate::traits::GraphTopology>::Vertex, Option, >, @@ -204,7 +204,7 @@ macro_rules! dijkstra_tests { } fn assert_distances_test_graph( - distances: &$crate::maps::VertexMap< + distances: &$crate::maps::EntityMap< <$T as $crate::traits::GraphTopology>::Vertex, Option, >, @@ -261,7 +261,7 @@ macro_rules! dijkstra_tests { } fn assert_distances_unweighted_test_graph( - distances: &$crate::maps::VertexMap< + distances: &$crate::maps::EntityMap< <$T as $crate::traits::GraphTopology>::Vertex, Option, >, @@ -300,7 +300,7 @@ macro_rules! dijkstra_tests { <$T as $crate::traits::GraphTopology>::Vertex, <$T as $crate::traits::GraphTopology>::Edge, )>; 10], - $crate::maps::EdgeMap<<$T as $crate::traits::GraphTopology>::Edge, u32>, + $crate::maps::EntityMap<<$T as $crate::traits::GraphTopology>::Edge, u32>, ) { use $crate::traits::GraphTopology; let (graph, vertices, edges, incidences) = make_test_graph(); diff --git a/src/testing/maps_testing.rs b/src/testing/maps_testing.rs index e8b5362..c3155bc 100644 --- a/src/testing/maps_testing.rs +++ b/src/testing/maps_testing.rs @@ -1,6 +1,6 @@ #[doc(hidden)] #[macro_export] -macro_rules! vertex_map_tests { +macro_rules! entity_map_tests { ($T:ty) => { #[test] fn initial_values_are_default() { @@ -48,7 +48,7 @@ macro_rules! vertex_map_tests { } #[test] - fn sync_expands_to_new_vertices() { + fn extend_to_new_vertices() { use $crate::traits::GraphTopology; let mut graph = <$T>::new(); graph.add_vertex(); @@ -59,21 +59,21 @@ macro_rules! vertex_map_tests { } assert!( map.capacity() < graph.vertex_capacity(), - "precondition: map is stale before sync" + "precondition: map is stale before extend" ); - map.sync(&graph); + map.extend(graph.vertex_capacity()); assert_eq!(map.capacity(), graph.vertex_capacity()); } #[test] - fn sync_does_not_overwrite_existing_values() { + fn extend_does_not_overwrite_existing_values() { use $crate::traits::GraphTopology; let mut graph = <$T>::new(); let v = graph.add_vertex(); let mut map = graph.vertex_map(0); map[v] = 5; graph.add_vertex(); - map.sync(&graph); + map.extend(graph.vertex_capacity()); assert_eq!(map[v], 5); } }; @@ -81,7 +81,7 @@ macro_rules! vertex_map_tests { #[doc(hidden)] #[macro_export] -macro_rules! vertex_map_deletion_tests { +macro_rules! entity_map_deletion_tests { ($T:ty) => { #[test] fn surviving_vertex_readable_after_delete() { @@ -108,7 +108,7 @@ macro_rules! vertex_map_deletion_tests { map[v1] = 5; let capacity_before = graph.vertex_capacity(); graph.delete_vertex(v2); - map.sync(&graph); + map.extend(graph.vertex_capacity()); assert_eq!(map.capacity(), capacity_before); assert_eq!(map[v1], 5); } @@ -124,162 +124,10 @@ macro_rules! vertex_map_deletion_tests { map[v1] = 99; graph.delete_vertex(v1); let v2 = graph.add_vertex(); - // VertexMap uses raw indices, not vertex identity. A new vertex v2 reusing the slot + // EntityMap uses raw indices, not vertex identity. A new vertex v2 reusing the slot // of previously deleted v1 sees the old value. Callers must reinitialize stale slots // after deletion. assert_eq!(map[v2], 99); } }; } - -#[doc(hidden)] -#[macro_export] -macro_rules! edge_map_tests { - ($T:ty) => { - #[test] - fn initial_values_are_default() { - use $crate::traits::GraphTopology; - let mut graph = <$T>::new(); - let v1 = graph.add_vertex(); - let v2 = graph.add_vertex(); - let e1 = graph.add_edge(v1, v2); - let e2 = graph.add_edge(v1, v2); - let map = graph.edge_map(42); - assert_eq!(map[e1], 42); - assert_eq!(map[e2], 42); - } - - #[test] - fn write_and_read() { - use $crate::traits::GraphTopology; - let mut graph = <$T>::new(); - let v1 = graph.add_vertex(); - let v2 = graph.add_vertex(); - let e1 = graph.add_edge(v1, v2); - let e2 = graph.add_edge(v1, v2); - let mut map = graph.edge_map(0); - map[e1] = 7; - assert_eq!(map[e1], 7); - assert_eq!(map[e2], 0); - } - - #[test] - fn lazy_growth_on_read() { - use $crate::traits::GraphTopology; - let mut graph = <$T>::new(); - let v1 = graph.add_vertex(); - let v2 = graph.add_vertex(); - graph.add_edge(v1, v2); - let map = graph.edge_map(99); - let e = graph.add_edge(v1, v2); - assert_eq!(map[e], 99); - } - - #[test] - fn lazy_growth_on_write() { - use $crate::traits::GraphTopology; - let mut graph = <$T>::new(); - let v1 = graph.add_vertex(); - let v2 = graph.add_vertex(); - let e1 = graph.add_edge(v1, v2); - let mut map = graph.edge_map(0); - let e2 = graph.add_edge(v1, v2); - map[e2] = 7; - assert_eq!(map[e1], 0); - assert_eq!(map[e2], 7); - } - - #[test] - fn sync_expands_to_new_edges() { - use $crate::traits::GraphTopology; - let mut graph = <$T>::new(); - let v1 = graph.add_vertex(); - let v2 = graph.add_vertex(); - graph.add_edge(v1, v2); - let mut map = graph.edge_map(42); - let capacity_before = map.capacity(); - while graph.edge_capacity() <= capacity_before { - graph.add_edge(v1, v2); - } - assert!( - map.capacity() < graph.edge_capacity(), - "precondition: map is stale before sync" - ); - map.sync(&graph); - assert_eq!(map.capacity(), graph.edge_capacity()); - } - - #[test] - fn sync_does_not_overwrite_existing_values() { - use $crate::traits::GraphTopology; - let mut graph = <$T>::new(); - let v1 = graph.add_vertex(); - let v2 = graph.add_vertex(); - let e = graph.add_edge(v1, v2); - let mut map = graph.edge_map(0); - map[e] = 5; - graph.add_edge(v1, v2); - map.sync(&graph); - assert_eq!(map[e], 5); - } - }; -} - -#[doc(hidden)] -#[macro_export] -macro_rules! edge_map_deletion_tests { - ($T:ty) => { - #[test] - fn surviving_edge_readable_after_delete() { - use $crate::traits::GraphTopology; - use $crate::traits::GraphTopologyDeletion; - let mut graph = <$T>::new(); - let v1 = graph.add_vertex(); - let v2 = graph.add_vertex(); - let e1 = graph.add_edge(v1, v2); - let e2 = graph.add_edge(v1, v2); - let mut map = graph.edge_map(0); - map[e1] = 1; - map[e2] = 2; - graph.delete_edge(e2); - assert_eq!(map[e1], 1); - } - - #[test] - fn capacity_does_not_shrink_after_delete() { - use $crate::traits::GraphTopology; - use $crate::traits::GraphTopologyDeletion; - let mut graph = <$T>::new(); - let v1 = graph.add_vertex(); - let v2 = graph.add_vertex(); - let e1 = graph.add_edge(v1, v2); - let e2 = graph.add_edge(v1, v2); - let mut map = graph.edge_map(0); - map[e1] = 5; - let capacity_before = graph.edge_capacity(); - graph.delete_edge(e2); - map.sync(&graph); - assert_eq!(map.capacity(), capacity_before); - assert_eq!(map[e1], 5); - } - - #[test] - fn reused_slot_returns_old_value() { - use $crate::traits::GraphTopology; - use $crate::traits::GraphTopologyDeletion; - let mut graph = <$T>::new(); - let v1 = graph.add_vertex(); - let v2 = graph.add_vertex(); - graph.add_edge(v1, v2); - let e1 = graph.add_edge(v1, v2); - let mut map = graph.edge_map(0); - map[e1] = 99; - graph.delete_edge(e1); - let e2 = graph.add_edge(v1, v2); - // EdgeMap uses raw indices, not edge identity. Because to_index uses arr_idx/2, - // both halves of a deleted edge pair map to the same index, so a new edge reusing - // either slot sees the old value. Callers must reinitialize stale slots after deletion. - assert_eq!(map[e2], 99); - } - }; -} diff --git a/src/traits.rs b/src/traits.rs index 9978912..9493b4b 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -1,4 +1,4 @@ -use crate::maps::{EdgeMap, VertexMap}; +use crate::maps::EntityMap; // TODO: Add functions to reserve memory for vertices and edges. // TODO: Split out GraphTopologyAddition trait. @@ -46,7 +46,8 @@ pub trait GraphTopology { /// Returns the total number of vertices the graph can hold without reallocating. fn vertex_capacity(&self) -> usize; - /// Creates and returns a [`VertexMap`] with every slot initialised to `default`. + /// Creates and returns an [`EntityMap`] for the vertices with every slot initialised to + /// `default`. /// /// # Examples /// @@ -66,7 +67,7 @@ pub trait GraphTopology { /// labels[v2] = "b"; /// assert_eq!(labels[v2], "b"); /// ``` - fn vertex_map(&self, default: T) -> VertexMap; + fn vertex_map(&self, default: T) -> EntityMap; /// Returns the number of edges in the graph. fn edge_count(&self) -> usize; @@ -74,7 +75,7 @@ pub trait GraphTopology { /// Returns the total number of edges the graph can hold without reallocating. fn edge_capacity(&self) -> usize; - /// Creates and returns an [`EdgeMap`] with every slot initialised to `default`. + /// Creates and returns an [`EntityMap`] for the edges with every slot initialised to `default`. /// /// # Examples /// @@ -96,7 +97,7 @@ pub trait GraphTopology { /// weights[e2] = 2; /// assert_eq!(weights[e2], 2); /// ``` - fn edge_map(&self, default: T) -> EdgeMap; + fn edge_map(&self, default: T) -> EntityMap; /// Returns the degree of `v`, i.e. the number of incident edges, where each loop contributes 2. /// diff --git a/tests/maps.rs b/tests/maps.rs index b936db9..73fe87d 100644 --- a/tests/maps.rs +++ b/tests/maps.rs @@ -1,25 +1,12 @@ -mod append_graph_vertex_map_tests { +mod append_graph_entity_map_tests { use grapherity::models::AppendGraph; - grapherity::vertex_map_tests!(AppendGraph); + grapherity::entity_map_tests!(AppendGraph); } -mod append_graph_edge_map_tests { - use grapherity::models::AppendGraph; - - grapherity::edge_map_tests!(AppendGraph); -} - -mod graph_vertex_map_tests { +mod graph_entity_map_tests { use grapherity::models::Graph; - grapherity::vertex_map_tests!(Graph); - grapherity::vertex_map_deletion_tests!(Graph); -} - -mod graph_edge_map_tests { - use grapherity::models::Graph; - - grapherity::edge_map_tests!(Graph); - grapherity::edge_map_deletion_tests!(Graph); + grapherity::entity_map_tests!(Graph); + grapherity::entity_map_deletion_tests!(Graph); }