view env/lib/python3.9/site-packages/networkx/generators/tests/test_mycielski.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
line wrap: on
line source

"""Unit tests for the :mod:`networkx.generators.mycielski` module."""

import networkx as nx


class TestMycielski:
    def test_construction(self):
        G = nx.path_graph(2)
        M = nx.mycielskian(G)
        assert nx.is_isomorphic(M, nx.cycle_graph(5))

    def test_size(self):
        G = nx.path_graph(2)
        M = nx.mycielskian(G, 2)
        assert len(M) == 11
        assert M.size() == 20

    def test_mycielski_graph_generator(self):
        G = nx.mycielski_graph(1)
        assert nx.is_isomorphic(G, nx.empty_graph(1))
        G = nx.mycielski_graph(2)
        assert nx.is_isomorphic(G, nx.path_graph(2))
        G = nx.mycielski_graph(3)
        assert nx.is_isomorphic(G, nx.cycle_graph(5))
        G = nx.mycielski_graph(4)
        assert nx.is_isomorphic(G, nx.mycielskian(nx.cycle_graph(5)))