0
votes

I am trying to compare two graphs and draw a third directed graph in which blue edges represent that these edges are present in both graph, red edges represent that edges present in former graph were no more exist in the latter graph, and green edges represent the edges present in latter graph were not exist in the former graph. enter image description here Problem: In the attached figure, I marked (with black colour) the edge between nodes 'New' and 'Assigned', which is composed of two colours (blue and green) which composed of two colours which means edge between 'New' to 'Assigned' exist in both graphs. However, an edge between 'Assigned' to 'New' exist in latter graph only. Is there any way I can draw two different colour edges between same nodes. Here is my part of my code I used for drawing this graph.

def multi_draw_circle(list1):

outerloop = 0

while(outerloop < len(list1)):

    for item in list1[outerloop][:-1]:

        colo = list1[outerloop][-1]
        G.add_edge(*item,color = colo)  

    outerloop = outerloop + 1

edges = G.edges()
colors = [G[u][v]['color'] for u,v in edges]
pos = nx.circular_layout(G)    
nx.draw(G, pos, with_labels = True, edge_color = colors)  

plt.show()

return

Any help would be really appreciated. Thanks

1
I'm afraid this is not possible with nx.draw now. All the edges are drawn as a straight line between two nodes and they will be overlapped if there are edges for both directions. - Haochen Wu

1 Answers

1
votes

Besides the comment I had, you might want to try to use graphviz to plot your graph. Networkx has an interface to convert your graph to graphviz object easily. See https://networkx.github.io/documentation/stable/reference/drawing.html#module-networkx.drawing.nx_agraph. The edges are not overlapped there.