5

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

kglr
  • 394,356
  • 18
  • 477
  • 896
sjdh
  • 7,757
  • 5
  • 37
  • 47

2 Answers2

7

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

VLC
  • 9,818
  • 1
  • 31
  • 60
4

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

kglr
  • 394,356
  • 18
  • 477
  • 896