What is a Graph? · Basic Graphs
Lesson 3
For \(n \ge 3\), the cycle graph \(C_{n}\) results from the path graph \(P_{n}\) by adding an edge joining the first and the last nodes.

from networkx import cycle_graph
graph = cycle_graph(n=4)
print(graph.nodes(), graph.edges())[0, 1, 2, 3] [(0, 1), (0, 3), (1, 2), (2, 3)]