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 graph.
|
||||||
///
|
///
|
||||||
/// Generates a cycle with `n` edges in `graph` as a new connected component and returns the new
|
/// Generates a [cycle graph] *C(n)* with `n` vertices and `n` edges in `graph` as a new connected
|
||||||
/// vertices *v0, v1, ..., v(n - 1)* and edges *e0, e1, ..., e(n - 1)* in order, i.e.
|
/// component and returns the new vertices *v0, v1, ..., v(n - 1)* and edges *e0, e1, ..., e(n - 1)*
|
||||||
/// *e0 = (v0, v1), e1 = (v1, v2), ..., e(n - 1) = (v(n - 1), v0)*.
|
/// 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
|
/// 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.
|
/// `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>) {
|
pub fn cycle<G: GraphTopologyAddition>(graph: &mut G, n: usize) -> (Vec<G::Vertex>, Vec<G::Edge>) {
|
||||||
graph.reserve_vertices(n);
|
graph.reserve_vertices(n);
|
||||||
graph.reserve_edges(n);
|
graph.reserve_edges(n);
|
||||||
|
|||||||
Reference in New Issue
Block a user