5
$\begingroup$

In this picture you see a graph. The shortest path between vertex 5 and vertex 3 is highlighted in red. Instead I want blue highlighted edges of thickness 10.

HighlightGraph[WheelGraph[6, EdgeStyle -> Directive[Black,AbsoluteThickness[10]]],
 PathGraph@FindShortestPath[WheelGraph[6], 5, 3], 
 GraphHighlightStyle -> {"Red", AbsoluteThickness[10]}]

a

I tried this. The thickness went to 10, but why is the highlighted path not blue?

HighlightGraph[WheelGraph[6, EdgeStyle -> Directive[Black, AbsoluteThickness[10]],
  VertexSize -> 0], PathGraph@FindShortestPath[WheelGraph[6], 5, 3],
  GraphHighlightStyle -> {"Blue", AbsoluteThickness[10]}]

b

$\endgroup$
0

2 Answers 2

4
$\begingroup$

You can also Style sub-graphs directly (see @Heike's answer to a related question)

 HighlightGraph[WheelGraph[6, EdgeStyle -> Directive[Black, AbsoluteThickness[10]]], 
   Style[PathGraph[FindShortestPath[WheelGraph[6], 5, 3]],
          {{Blue,  AbsoluteThickness[10]}}]]

enter image description here

$\endgroup$
7
$\begingroup$

It seems that GraphHighlightStyle takes only built-in options:

GraphElementData["GraphHighlightStyle"]

{Automatic, "Dashed", "Dotted", "Thick", "VertexConcaveDiamond", "VertexDiamond", "VertexTriangle", "DehighlightFade", "DehighlightGray", "DehighlightHide"}

To achieve what you're looking for you can wrap up a solution customizing the EdgeStyle:

WheelGraph[6, 
 EdgeStyle -> 
  Flatten@{(# -> {Blue, AbsoluteThickness[10]} & /@ 
      EdgeList[
       PathGraph@FindShortestPath[WheelGraph[6], 5, 3]]), {Directive[
      Black, AbsoluteThickness[10]]}}, VertexSize -> 0]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.