0

I have a complete graph G of 214 nodes and therefore a looot of edges. In this graph I have a subset of edges that are coloured red, however almost all edges are overlapped by other edges and therefore the route is not visible. Is it possible to get the coloured edges to the front and make them visible?

enter image description here

and the code i used:

#G = a nx. multigraph filled with edges and nodes
for u,v,k in G.edges(keys = True):
        coloured = False
        for i in range(len(route)):
            if i != len(route)-1:
                reqU = route[i]
                reqV = route[i+1]
                
                if (u==reqU) & (v == reqV):
                    ec.append('r')
                    coloured = True
            else:
                reqU = route[i]
                reqV = route[0]
                if (u==reqU) & (v == reqV):
                    ec.append('r')
                    coloured = True
                        
        if coloured == False:
            ec.append('gray')

    G_projected = ox.project_graph(G)
    fig, ax = ox.plot_graph(G_projected, edge_color=ec,figsize=(25,25))
kGame
  • 21
  • 3
  • I think a good approach would be to make a new graph with the red edges only, to remove the red edges from the original graph, and to then draw the red graph on top of the other graph. This would allow you also to make use of transparencety. Check [this answer](https://stackoverflow.com/questions/67385391/networkx-osmnx-and-folium-plotting-different-coloured-edges) for a pointer. – warped Nov 11 '22 at 09:19

0 Answers0