Assuming I have created a MultiDiGraph
in networkx
as follows:
G = nx.MultiDiGraph()
for i in range(5):
G.add_node(i, features=...)
So the resulting graph might look like this:
Is there a way to now connect all nodes with all the other nodes (except self-edges) without specifying each target and source node manually?
I'm aware of the function nx.complete_graph()
but I wonder whether there's a way to first create the nodes and then assign the connections in an automatic way.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.