mycielskian

Contents

mycielskian#

graph_tool.generation.mycielskian(g, iterations=1)[git][source]#

Return the Mycielskian of an undirected graph.

Parameters:
gGraph

Undirected graph.

iterationsint (optional, default: 1)

Number of times the construction is applied.

Returns:
mGraph

The Mycielskian of g, with \(2V+1\) vertices for a single iteration, where the first \(V\) are the vertices of g in the order of their indices.

Notes

The Mycielskian [mycielski-coloriage-1955] of a graph \(G=(V,E)\) with vertices \(v_1,\dots,v_n\) adds a vertex \(u_i\) for every \(v_i\), and a vertex \(w\), with the edge set

\[E \cup \{(v_i, u_j), (v_j, u_i) : (v_i, v_j)\in E\} \cup \{(u_i, w) : i = 1,\dots,n\},\]

so that \(u_i\) is adjacent to the neighbors of \(v_i\) and \(w\) to all \(u_i\). The vertex \(u_i\) has the index \(n + i - 1\) and \(w\) the index \(2n\); with several iterations, the construction is applied again to the result. It increases the chromatic number by one, while keeping the graph triangle-free if it was, and the Mycielski graphs of named_graph() are the Mycielskians of \(K_2\). A self-loop \((v_i, v_i)\) yields two parallel edges \((v_i, u_i)\). The algorithm runs in time \(O(V + E)\) per iteration.

References

[mycielski-coloriage-1955]

J. Mycielski, “Sur le coloriage des graphs”, Colloq. Math. 3, 161-162 (1955). DOI: 10.4064/cm-3-2-161-162 [sci-hub, @tor]

Examples

>>> g = gt.mycielskian(gt.circular_graph(5))
>>> print(g.num_vertices(), g.num_edges())
11 20

The Mycielskian of the cycle \(C_5\), which is the Grötzsch graph, is drawn as follows:

>>> g = gt.mycielskian(gt.circular_graph(5))
>>> b = g.new_vp("int", vals=[0] * 5 + [1] * 5 + [2])
>>> cmap = matplotlib.colors.ListedColormap(
...     ["#9bbedc", "#f28c8e", "#a6d7a4"])
>>> gt.graph_draw(g, pos=gt.sfdp_layout(g), vertex_fill_color=b, vcmap=cmap,
...               output="mycielskian-c5.pdf")
<...>
../_images/mycielskian-c5.png

Mycielskian of the cycle \(C_5\), with the original vertices \(v_i\) in blue, the vertices \(u_i\) in red, and the vertex \(w\) in green.#