Replace VertexMap and EdgeMap with now public EntityMap
This commit is contained in:
+6
-5
@@ -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<T: Clone>(&self, default: T) -> VertexMap<Self::Vertex, T>;
|
||||
fn vertex_map<T: Clone>(&self, default: T) -> EntityMap<Self::Vertex, T>;
|
||||
|
||||
/// 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<T: Clone>(&self, default: T) -> EdgeMap<Self::Edge, T>;
|
||||
fn edge_map<T: Clone>(&self, default: T) -> EntityMap<Self::Edge, T>;
|
||||
|
||||
/// Returns the degree of `v`, i.e. the number of incident edges, where each loop contributes 2.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user