w = {3, 4, 10, 2, 1};
g = Graph[{1 -> 2, 1 -> 3, 1 -> 4, 2 -> 3, 2 -> 4}, EdgeWeight -> w];
p = {1 -> 2, 1 -> 4};
Then I set their EdgeStyle to reflect the Edgeweights:
Table[PropertyValue[{g, e}, EdgeWeight], {e, EdgeList[g]}];
{min, max} = {Min[#], Max[#]} &@%
Do[PropertyValue[{g, e}, EdgeStyle] = AbsoluteThickness[Rescale[PropertyValue[{g, e}, EdgeWeight], {min, max}, {1, 7}]], {e, EdgeList[g]}]
However, I also want to color certain edges a color... so I attempt to use:
Do[PropertyValue[{g, e}, EdgeStyle] = {Green}, {e,p}]
The result is that the edges get colored green, except they are green without displaying the thickness I assigned to them earlier. I know why it's happening... I'm resetting EdgeStyle
for those edges.
My attempt to circumvent this: I figured that we use Epilog here?-right? It gives me the same result when I use:
HighlightGraph[g, p, Epilog -> Green]
This gives me the same output as Do[PropertyValue[{g, e}, EdgeStyle] = {Green}, {e,p}]
How can I apply a color to certain edges once I've assigned their thicknesses?
Do[PropertyValue[{g, e}, EdgeStyle] = Directive[Green, PropertyValue[{g, e}, EdgeStyle]], {e, p}]
? $\endgroup$HighlightGraph[g, Style[#, PropertyValue[{g, #}, EdgeStyle], Green] & /@ p]
? $\endgroup$