I generate a complete graph with arbitrary nodes. Each edge has two attributes where the second one is the function of the first one. (for example, when the first one is x, the second one is 1/x). How can I add these attributes to edges?
def create_random_topology(size):
G = nx.generators.complete_graph(size)
attfirst={x:random.randint(100,500) for x in G.edges()}
nx.set_edge_attributes(G, name="PR", values=attfirst)
#attsecond= 1/attfirst
I want to have this graph, e.g {(0,1):{PR= 10 , BW=1/10}, (0,2):{PR=5 , BW=1/5}, (1,2):{PR=2 , BW=1/2)}}
Because the graph has variable size, I won't have access to the edge with the exact name of its node, for example (1,2).