Add Clone to graph models, and tests
This commit is contained in:
@@ -87,9 +87,16 @@ impl IncidenceCursor<FrozenGraph> for FrozenGraphIncidenceCursor {
|
||||
///
|
||||
/// [`degree`] runs in *O(1)* time. Space complexity is *O(|V| + |E|)*.
|
||||
///
|
||||
/// # Cloning
|
||||
///
|
||||
/// [`Vertex`] and [`Edge`] handles obtained from a clone are valid, and refer to the same vertex or
|
||||
/// edge in the original, and vice versa. However, once cloned, the two instances no longer affect
|
||||
/// each other.
|
||||
///
|
||||
/// [`degree`]: Self::degree
|
||||
/// [`AppendGraph`]: crate::models::AppendGraph
|
||||
/// [`Graph`]: crate::models::Graph
|
||||
#[derive(Clone)]
|
||||
pub struct FrozenGraph {
|
||||
vertices: Vec<usize>,
|
||||
incidences: Vec<IncidenceEntry>,
|
||||
@@ -255,6 +262,7 @@ mod trait_tests {
|
||||
use super::FrozenGraph;
|
||||
|
||||
crate::graph_topology_tests!(FrozenGraph);
|
||||
crate::graph_topology_clone_tests!(FrozenGraph);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user