GraphPlot how to color edges?

plotting

#1

Dear all,
Here is the code that almost works:

using LightGraphs
using GraphPlot
using Colors

# nodes membership
membership = [1,1,1,1,1,1,1,1,2,1,1,1,1,1,2,2,1,1,2,1,2,1,2,1,1,1,1,2,1,1,2,1,1,1]
nodecolor = [colorant"lightgrey", colorant"orange"]
# membership color
nodefillc = nodecolor[membership]
gplot(g, nodefillc=nodefillc, layout=circular_layout)

I would like to emphasize connection between orange nodes, so the end result should be something like this:

How to do it?


#2

Have you tried edgestrokec ?

edgestrokec
Optional. Color for the edge strokes, can be a Vector. Default: colorant"lightgray"


#3

I tried but I couldn’t figure the right size of the vector. Actually, I posted the example code in the hope that someone could show how to build the vector.


#4

I figured it out. Here is the final code:

using LightGraphs
using GraphPlot
using Colors

g = graphfamous("karate")

membership = [1,1,1,1,1,1,1,1,2,1,1,1,1,1,2,2,1,1,2,1,2,1,2,1,1,1,1,2,1,1,2,1,1,1]
nodecolor = [colorant"lightgrey", colorant"orange"]
nodefillc = nodecolor[membership]

colors = [colorant"lightgray" for i in  1:78]
colors[42] = colorant"orange"

gplot(g, nodefillc=nodefillc, layout=circular_layout, edgestrokec=colors, edgelabel=1:78)