Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 3 down vote accepted

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

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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