3
$\begingroup$

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.

$\endgroup$
  • $\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$ – Dr. belisarius Nov 16 '15 at 21:02
3
$\begingroup$

Probably a bug.
You may use this alternative syntax:

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

Mathematica graphics

$\endgroup$
  • $\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 Jun 11 '17 at 4:06

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.