def build_cycle_graph(num_nodes):
graph = UndirectedGraph()<EOL>if num_nodes > <NUM_LIT:0>:<EOL><INDENT>first_node = graph.new_node()<EOL>if num_nodes > <NUM_LIT:1>:<EOL><INDENT>previous_node = first_node<EOL>for _ in range(num_nodes - <NUM_LIT:1>):<EOL><INDENT>new_node = graph.new_node()<EOL>graph.new_edge(previous_node, new_node)<EOL>previous_node = new_node<EOL><DEDENT>graph.new_edge(previous_node, first_node)<EOL><DEDENT><DEDENT>return graph<EOL>
Builds a cycle graph with the specified number of nodes.
       Ref: http://mathworld.wolfram.com/CycleGraph.html