4
$\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$
3
$\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

| improve this answer | |
$\endgroup$
6
$\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

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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