I created a networkX weighted graph (refer to this question for the code) and I wanted to color code the edges based on node color. If two nodes are of the same color and connected I want their edge color to be one color, say red. Moreover, if the nodes aren't the same color but connected I want them to be a different color, say blue. Is there a way I could achieve this?
The code for the edges is as follows:
for edge in G.edges():
source, target = edge
rad = 0.35
arrowprops=dict(lw=G.edges[(source,target)]['weight'],
arrowstyle="-",
color='blue',
connectionstyle=f"arc3,rad={rad}",
linestyle= '-',
alpha=0.6)
ax.annotate("",
xy=pos[source],
xytext=pos[target],
arrowprops=arrowprops
)