# HighlightGraph highlighting the vertices but not the edges of a subgraph

I'm trying to highlight the path between two vertices, and it seems that PathGraph along with HighlightGraph is what I should use. However, only the vertices of the path graph get highlighted. The edges between the vertices are not being highlighted.

Here's my code:

G =
Graph[
{1 -> 3, 1 -> 9, 3 -> 4, 4 -> 3, 3 -> 7, 4 -> 1, 4 -> 8, 4 -> 2, 9 -> 2,
9 -> 10, 5 -> 9, 2 -> 5, 2 -> 7, 10 -> 2, 7 -> 10, 7 -> 8, 7 -> 2, 8 -> 6,
8 -> 7, 6 -> 8, 6 -> 7 },
GraphStyle -> "SmallNetwork"]


I'll get the following:

Now for my attempt at highlighting the shortest path between vertex 1 and 5:

HighlightGraph[G, PathGraph[FindShortestPath[G, 1, 5]]]


I get the following:

What am I doing wrong? I'd like for the arrows leading from vertex 1 to 5 to be highlighted too.

### Method one:

HighlightGraph[G,
PathGraph[FindShortestPath[G, 1, 5], DirectedEdges -> True]]


### Method two:

HighlightGraph[G, Subgraph[G, FindShortestPath[G, 1, 5]]]


BTW, I strongly recommend avoiding the use of a single capital letter as a variable name. Note that all the characters in the phase "ONE DICK" are pre-defined in the System context in Mathematica.

• Method 2 is not so good. It highlights edge 5 -> 9`, which is not part of the path. – m_goldberg Feb 24 '17 at 2:57
• Oh! I didn't know DirectedEdges was needed. Thank you so much. And noted on that point, I will change it. – harlowworld Feb 24 '17 at 2:58
• @m_goldberg I mean this two method face to two cases.But I don't know which one the OP need. – yode Feb 24 '17 at 2:59