networkx / networkx

Network Analysis in Python
https://networkx.org
Other
14.82k stars 3.22k forks source link

networkx.draw_networkx() is giving extra edges in a pandapower network #7017

Closed rahatN-tech closed 12 months ago

rahatN-tech commented 12 months ago

Discussed in https://github.com/networkx/networkx/discussions/7016

Originally posted by **rahatN-tech** October 13, 2023 i want to draw a graph of ieee14 pandapower network, but the graph is giving 20 edges which should be 15. i got correct graph in many other networks, but this particular case is creating this issue..plz see the code below.. `import pandapower.networks as nw import networkx as nx net = nw.case14() pp.runpp(net) mgraph = top.create_nxgraph(net) net.bus_geodata.loc[0,'y'] = 5 net.bus_geodata.loc[0,'x'] = 3 net.bus_geodata.loc[10,'y'] = 0.75 pos = {} for n in range(len(net.bus.index)): x = net.bus_geodata.loc[n, 'x'] y = net.bus_geodata.loc[n, 'y'] node_pos = {n: (x, y)} pos.update(node_pos) print(pos) nx.draw_networkx(mgraph, pos, node_color='#808080')` please look into it thanks in advance
rahatN-tech commented 12 months ago

i found that the graph is considering the transformer branches as edges also...thats why there are more edges than lines