Skip to content
Graphviz (DOT) templates

Petersen graph as the Kneser graph K(5,2)

The Petersen graph drawn with pinned neato positions and its vertices labelled by the ten 2-subsets of {1..5}, adjacent exactly when disjoint, with girth, chromatic number, chromatic index, connectivity and hypohamiltonicity stated on the figure — the reference object of graph theory.

Template previewGraphviz (DOT)
Rendering…

Make it your own.

/* The Petersen graph, drawn as the Kneser graph K(5,2):
   vertices are the ten 2-element subsets of {1,2,3,4,5}
   and two vertices are joined exactly when the subsets are DISJOINT.
   Blue rim = outer 5-cycle, amber = inner pentagram, dashed = spokes. */
graph petersen {
  layout=neato;
  graph [bgcolor=transparent, fontname="Inter", fontsize=11, labelloc=b,
         label="Petersen graph = Kneser graph K(5,2) = odd graph O3\n10 vertices, 15 edges, 3-regular; girth 5, diameter 2, chi = 3, chi' = 4 (class 2)\nindependence number 4, vertex connectivity 3, Aut = S5 of order 120\nhypohamiltonian: no Hamiltonian cycle, but G - v has one for every v"];
  node [shape=circle, style=filled, fixedsize=true, width=0.62,
        fontname="Inter", fontsize=10, penwidth=0.8, color="#475569"];
  edge [penwidth=1.6];

  o0 [label="{1,2}", pos="3.000,5.350!", fillcolor="#dbeafe"];
  i0 [label="{3,5}", pos="3.000,4.020!", fillcolor="#fef3c7"];
  o1 [label="{3,4}", pos="5.235,3.726!", fillcolor="#dbeafe"];
  i1 [label="{5,2}", pos="3.970,3.315!", fillcolor="#fef3c7"];
  o2 [label="{5,1}", pos="4.381,1.099!", fillcolor="#dbeafe"];
  i2 [label="{2,4}", pos="3.600,2.175!", fillcolor="#fef3c7"];
  o3 [label="{2,3}", pos="1.619,1.099!", fillcolor="#dbeafe"];
  i3 [label="{4,1}", pos="2.400,2.175!", fillcolor="#fef3c7"];
  o4 [label="{4,5}", pos="0.765,3.726!", fillcolor="#dbeafe"];
  i4 [label="{1,3}", pos="2.030,3.315!", fillcolor="#fef3c7"];

  o0 -- o1 [color="#1d4ed8"];
  o0 -- i0 [color="#334155", style=dashed];
  i0 -- i2 [color="#b45309"];
  o1 -- o2 [color="#1d4ed8"];
  o1 -- i1 [color="#334155", style=dashed];
  i1 -- i3 [color="#b45309"];
  o2 -- o3 [color="#1d4ed8"];
  o2 -- i2 [color="#334155", style=dashed];
  i2 -- i4 [color="#b45309"];
  o3 -- o4 [color="#1d4ed8"];
  o3 -- i3 [color="#334155", style=dashed];
  i3 -- i0 [color="#b45309"];
  o4 -- o0 [color="#1d4ed8"];
  o4 -- i4 [color="#334155", style=dashed];
  i4 -- i1 [color="#b45309"];
}