graphscope.nx.classes.function.add_cycle¶
- graphscope.nx.classes.function.add_cycle(G_to_add_to, nodes_for_cycle, **attr)[source]¶
Add a cycle to the Graph G_to_add_to.
- Parameters:
G_to_add_to (graph) – A NetworkX graph
nodes_for_cycle (iterable container) – A container of nodes. A cycle will be constructed from the nodes (in order) and added to the graph.
attr (keyword arguments, optional (default= no attributes)) – Attributes to add to every edge in cycle.
Examples
>>> G = nx.Graph() # or DiGraph, MultiGraph, MultiDiGraph, etc >>> nx.add_cycle(G, [0, 1, 2, 3]) >>> nx.add_cycle(G, [10, 11, 12], weight=7)