Renamed FromGraph to GraphTopologyConversion to align with existing traits and separate from From trait

This commit is contained in:
2026-09-29 23:16:57 +02:00
parent 9d43f0cb8d
commit c8855daddf
11 changed files with 125 additions and 98 deletions
+5 -4
View File
@@ -17,14 +17,15 @@ pub use graph::{Graph, GraphEdgeMap, GraphIncidence, GraphVertexMap};
/// Builds a new graph isomorphic to `source`.
///
/// The resulting graph type `G` must implement [`GraphTopologyAddition`] which is used to add
/// The resulting graph type `G` implements [`GraphTopologyAddition`] which is used to add
/// vertices and edges. `on_edge` is called for each edge in `source` together with the
/// corresponding new edge of the new graph, which callers can use to construct an edge mapping.
///
/// Used by the [`GraphTopologyAddition`] models' `From<&H>` and [`FromGraph`] implementations.
/// Used by the [`GraphTopologyAddition`] models' `From<&H>` and [`GraphTopologyConversion`]
/// implementations.
///
/// [`FromGraph`]: crate::traits::FromGraph
pub(crate) fn build_from_topology<G: GraphTopologyAddition, H: GraphTopology>(
/// [`GraphTopologyConversion`]: crate::traits::GraphTopologyConversion
pub(crate) fn convert_to_addition<G: GraphTopologyAddition, H: GraphTopology>(
source: &H,
vertex_default: G::Vertex,
mut on_edge: impl FnMut(H::Edge, G::Edge),