0
|
3973 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
GROUPS:

# Problem with HighlightGraph

Posted 10 years ago
 Hi, everybody i have the follow  problem , my graph has some vertices and I highlight the way that I get with the FindEulerianCycle command, but do not put it in red as usual, because it will not, here is my code rutas = Graph[{1 \[UndirectedEdge] 12, 1 \[UndirectedEdge] 2,     2 \[UndirectedEdge] 3, 2 \[UndirectedEdge] 9,     3 \[UndirectedEdge] 4, 3 \[UndirectedEdge] 8,     4 \[UndirectedEdge] 7, 4 \[UndirectedEdge] 5,     5 \[UndirectedEdge] 6, 6 \[UndirectedEdge] 8,     7 \[UndirectedEdge] 10, 8 \[UndirectedEdge] 9,     8 \[UndirectedEdge] 11, 3 \[UndirectedEdge] 9,     4 \[UndirectedEdge] 10, 9 \[UndirectedEdge] 11,     2 \[UndirectedEdge] 12}, VertexLabels -> "Name",   ImagePadding -> 10]With this check if a graph is EulerianEulerianGraphQ[rutas]Upon request from you, the program does the highlighted path in the graphcaminos = FindEulerianCycle[rutas]HighlightGraph[rutas, PathGraph[First[caminos] I hope something can help me find the solution, or tell me why that happens.Thanks in advance
2 Replies
Sort By:
Posted 10 years ago
 Many thanks Sam, it was what I needed to understand
Posted 10 years ago
 You are missing square parenthesis at the end of your last line. But that's not the main error. PathGraph is - you should not use it, just use list of edges. Because you are interested in an edge path, you should label edges, not vertices:rutas = Graph[{1 <-> 12, 1 <-> 2, 2 <-> 3, 2 <-> 9, 3 <-> 4, 3 <-> 8,     4 <-> 7, 4 <-> 5, 5 <-> 6, 6 <-> 8, 7 <-> 10, 8 <-> 9, 8 <-> 11,     3 <-> 9, 4 <-> 10, 9 <-> 11, 2 <-> 12}, ImagePadding -> 10];caminos = First[FindEulerianCycle[rutas]];HighlightGraph[rutas, Table[Labeled[caminos[[i]], i], {i, Length[caminos]}]] 