Skip to content

topology¤

Topological properties of meshes.

Colouring¤

is_adjacency_two_colorable ¤

is_adjacency_two_colorable(adjacency: dict[Any, list[Any]]) -> dict[Any, int] | None

Try to color a data of adjacency with two colors only withtout any element adjacent to each other having the same colour.

Parameters:

  • adjacency (dict) –

    Dictionary of adjacency between elements, each elements points to the list of adjacent elements.

Returns:

  • key_to_color ( (dict, None) ) –

    A dictionary with vertex keys pointing to colors, if two-colorable. None if not two-colorable.