Refactor ElementMap, removing its copy-on-write feature

This commit is contained in:
2026-10-11 22:24:00 +02:00
parent 4e20c49486
commit 3d7dda6f7b
9 changed files with 281 additions and 113 deletions
+4 -3
View File
@@ -23,14 +23,14 @@
//! use grapherity::algorithms;
//!
//! let mut graph = Graph::new();
//! // Creates a map for edge weights with a default weight.
//! let mut weights = graph.edge_map(1);
//! // Adds three vertices and two edges.
//! let v1 = graph.add_vertex();
//! let v2 = graph.add_vertex();
//! let v3 = graph.add_vertex();
//! graph.add_edge(v1, v2);
//! let e = graph.add_edge(v2, v3);
//! // Creates a map for edge weights with a default weight, after creating the edges.
//! let mut weights = graph.edge_map(1);
//! // Sets a non-default weight for the second edge.
//! weights[e] = 5;
//!
@@ -97,7 +97,8 @@
//! graph.degree(v);
//! ```
//!
//! [`ElementMap`] is not required to panic if provided with an invalid vertex or edge.
//! [`ElementMap`] does not check validity of vertices or edges and might or might not panic in case
//! an invalid handle is provided.
//!
//! Vertices and edges are provided by the graph and not intended to be generated by users.
//!