test_mycielski.py 822 B

1234567891011121314151617181920212223242526
  1. """Unit tests for the :mod:`networkx.generators.mycielski` module."""
  2. import networkx as nx
  3. class TestMycielski:
  4. def test_construction(self):
  5. G = nx.path_graph(2)
  6. M = nx.mycielskian(G)
  7. assert nx.is_isomorphic(M, nx.cycle_graph(5))
  8. def test_size(self):
  9. G = nx.path_graph(2)
  10. M = nx.mycielskian(G, 2)
  11. assert len(M) == 11
  12. assert M.size() == 20
  13. def test_mycielski_graph_generator(self):
  14. G = nx.mycielski_graph(1)
  15. assert nx.is_isomorphic(G, nx.empty_graph(1))
  16. G = nx.mycielski_graph(2)
  17. assert nx.is_isomorphic(G, nx.path_graph(2))
  18. G = nx.mycielski_graph(3)
  19. assert nx.is_isomorphic(G, nx.cycle_graph(5))
  20. G = nx.mycielski_graph(4)
  21. assert nx.is_isomorphic(G, nx.mycielskian(nx.cycle_graph(5)))