networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersBackRef
cycle_graph(n, create_using=None)

$C_n$ is a path with its two end-nodes connected.

Notes

If create_using is directed, the direction is in increasing order.

Parameters

n : int or iterable container of nodes

If n is an integer, nodes are from :None:None:`range(n)`. If n is a container of nodes, those nodes appear in the graph.

create_using : NetworkX graph constructor, optional (default=nx.Graph)

Graph type to create. If graph instance, then cleared before populated.

Returns the cycle graph $C_n$ of cyclically connected nodes.

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.algorithms.coloring.equitable_coloring.equitable_color networkx.algorithms.vitality.closeness_vitality networkx.algorithms.tree.mst.maximum_spanning_edges networkx.algorithms.shortest_paths.weighted.negative_edge_cycle networkx.algorithms.shortest_paths.weighted.goldberg_radzik networkx.algorithms.tree.mst.minimum_spanning_edges networkx.algorithms.similarity.optimal_edit_paths networkx.algorithms.minors.contraction.contracted_edge networkx.algorithms.asteroidal.is_at_free networkx.algorithms.tree.mst.maximum_spanning_tree networkx.algorithms.coloring.greedy_coloring.greedy_color networkx.algorithms.components.strongly_connected.kosaraju_strongly_connected_components networkx.algorithms.similarity._simrank_similarity_numpy networkx.algorithms.simple_paths.is_simple_path networkx.algorithms.similarity.simrank_similarity networkx.algorithms.approximation.traveling_salesman.traveling_salesman_problem networkx.algorithms.similarity.optimize_graph_edit_distance networkx.algorithms.minors.contraction.contracted_nodes networkx.algorithms.tree.mst.minimum_spanning_tree networkx.algorithms.similarity.graph_edit_distance networkx.algorithms.polynomials.tutte_polynomial networkx.algorithms.components.strongly_connected.strongly_connected_components networkx.algorithms.shortest_paths.weighted.bellman_ford_predecessor_and_distance networkx.algorithms.similarity._simrank_similarity_python networkx.algorithms.components.strongly_connected.strongly_connected_components_recursive networkx.algorithms.simple_paths.shortest_simple_paths

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/generators/classic.py#353
type: <class 'function'>
Commit: