I was hoping that you can helped me with this. I created a graph using an adjacency matrix with the next code.
graph = nx.from_numpy_array(adjacency_matrix, create using = nx.DiGraph)
mypos = nx.spring_layout(graph)
nx.draw_networkx(graph, pos = mypos)
and then I get the shortest path...
path = nx.shortest_path(graph, 3, 2)
print(path)
Which give me the next path
[3,1,2]
I was triying to draw the path creating a subgraph using the nodes given by the shortest path.
subgraph = graph.subgraph(path)
nx.draw_networkx(H, pos = mypos, arrows = True)
nx.draw_networkx_nodes(H, pos = mypos, node_color = 'r')
nx.draw_networkx_edges(H, pos = mypos, edge_color = 'r')
And I get the next result
The problem is, even though it was draw, they added a new extra edge between node 2 and 3 that I don't want, is there a way to change this so I don't have that extra edge? I know that networkx can remove an edge using nx.remove_edge() but I don't want to be removing edges manually every time I run the program and choosing another path. Thank you in advance
