When defining a graph whose vertices are sets e.g. the Kneser graph, how does Mathematica interpret the vertices?

I am having trouble highlighting vertices when I define vertices with sets, but for some reason highlighting edges creates no problem:

HighlightGraph[Graph[{{1, 2} <-> {3, 4}}], {{1, 2} <-> {3, 4}}]

This creates an edge with the edge highlighted, as expected. However

HighlightGraph[Graph[{{1, 2} <-> {3, 4}}], {1,2}]

does not highlight the vertex corresponding to {1,2}.

I originally had a colleague help write a program to construct the general Kneser graph. However, when using FindIndependentVertexSet, it lists the correct vertices (sets), but when using HighlightGraph, it doesn't highlight anything; using FindHamiltonianCycle, I can highlight the cycle though.

  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 0) Browse the common pitfalls question 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ Commented Nov 16, 2015 at 21:02

1 Answer 1


Probably a bug.
You may use this alternative syntax:

g = Graph[{{1, 2} <-> {3, 4}}]; 
SetProperty[{g, {{1, 2}}}, GraphHighlight -> True]

Mathematica graphics

  • $\begingroup$ Unfortunately, this method, which works for me a few hours ago (on my local Mathematica 10.2 install), fails now. It return $Failed. $\endgroup$
    – user202729
    Commented Jun 11, 2017 at 4:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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