Update cycle graph docs with link and C(n) denotation
This commit is contained in:
+5
-3
@@ -63,12 +63,14 @@ pub fn path<G: GraphTopologyAddition>(graph: &mut G, n: usize) -> (Vec<G::Vertex
|
||||
|
||||
/// Generates a cycle graph.
|
||||
///
|
||||
/// Generates a cycle with `n` edges in `graph` as a new connected component and returns the new
|
||||
/// vertices *v0, v1, ..., v(n - 1)* and edges *e0, e1, ..., e(n - 1)* in order, i.e.
|
||||
/// *e0 = (v0, v1), e1 = (v1, v2), ..., e(n - 1) = (v(n - 1), v0)*.
|
||||
/// Generates a [cycle graph] *C(n)* with `n` vertices and `n` edges in `graph` as a new connected
|
||||
/// component and returns the new vertices *v0, v1, ..., v(n - 1)* and edges *e0, e1, ..., e(n - 1)*
|
||||
/// in order, i.e. *e0 = (v0, v1), e1 = (v1, v2), ..., e(n - 1) = (v(n - 1), v0)*.
|
||||
///
|
||||
/// For `n == 0`, nothing is added. For `n == 1`, a single vertex with a loop is added. For
|
||||
/// `n == 2`, two vertices and two edges between them (multi-edge) are added.
|
||||
///
|
||||
/// [Cycle graph]: https://en.wikipedia.org/wiki/Cycle_graph
|
||||
pub fn cycle<G: GraphTopologyAddition>(graph: &mut G, n: usize) -> (Vec<G::Vertex>, Vec<G::Edge>) {
|
||||
graph.reserve_vertices(n);
|
||||
graph.reserve_edges(n);
|
||||
|
||||
Reference in New Issue
Block a user