Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

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

enter image description here

For example, like above. I've read some examples and descriptions in here, but couldn't figured it out.

share|improve this question
Have you tried writing something down ? If so, please, share your code. – Sektor Jul 6 '14 at 19:48
Do you need the Combinatorica package? If not, just use EdgeStyle :) – Öskå Jul 6 '14 at 21:17
@Novice Looks like a PetersonGraph. Where did you get the image from? – eldo Jul 6 '14 at 21:48

I post this for illustrative purposes based on the title of the question (which is somewhat ambiguous). I agree as Szabolcs advice re: looking at documentation, which is good. Here are some motivating examples:

Your example: another way (exploiting Szabolcs observation):

cg = CompleteGraph[6];
el = EdgeList[cg]; 
path = EdgeList[CycleGraph[6]];
    EdgeStyle -> 
    Join[(# -> {Red, Thickness[0.01]} & /@ path), {Blue, 

enter image description here

or if you wanted different colors on the hightlighted path:

  Graph[EdgeList@cg,EdgeStyle -> 
    Join[MapThread[#1 -> {RGBColor[#2], Thickness[0.01]} &, {path, 
    RandomReal[{0, 1}, {6, 3}]}], {Blue, Thickness[0.01]}]]

![enter image description here][2]

A modification of the documentation to illustrate styles for HighlightGraph:

ged = GraphElementData["GraphHighlightStyle"]


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

An example (adapted from documentation):

  Column /@ 
        cg, {1, 2 \[UndirectedEdge] 4, 3 \[UndirectedEdge] 6}, 
        GraphHighlightStyle -> #] & /@ Rest[ged]}], 3], Frame -> All]

enter image description here

Finally, you have a lot of control with wrapper Style or using EdgeStyle option of built in `Graph function:

Using Style

      MapThread[Style[#1, RGBColor[#2], Thick] &,
      {el,RandomReal[{0, 1}, {Length@el, 3}]}]

enter image description here

Using EdgeStyle:

   Style[#1, RGBColor[#2], Thick] &, {el, 
    RandomReal[{0, 1}, {Length@el, 3}]}]]]
 EdgeStyle -> 
  MapThread[#1 -> {RGBColor[#2], Thick} &, {el, 
    RandomReal[{0, 1}, {Length@el, 3}]}]]

enter image description here

share|improve this answer

Look up HighlightGraph.


(This solution is based on the accidental fact that CompleteGraph and CycleGraph name and connect the vertices in the same order, i.e. 1--2--3--4--5--1)

share|improve this answer
I would have written: "The solution is based on a thorough forensic inquiry on the accidental fact..." :) – eldo Jul 6 '14 at 22:56

It looks like you want to make an edge rendering function:

share|improve this answer

Your Answer


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.