add_star#
- add_star(G_to_add_to, nodes_for_star, **attr)[source]#
Add a star to Graph G_to_add_to.
The first node in
nodes_for_star
is the middle of the star. It is connected to all other nodes.- Parameters:
- G_to_add_tograph
A NetworkX graph
- nodes_for_stariterable container
A container of nodes.
- attrkeyword arguments, optional (default= no attributes)
Attributes to add to every edge in star.
Examples
>>> G = nx.Graph() >>> nx.add_star(G, [0, 1, 2, 3]) >>> nx.add_star(G, [10, 11, 12], weight=2)