def test_kuratowski_k5m(self): G = nx.complete_graph(5) G.remove_edge(1, 2) K = planarity.kuratowski_subgraph(G) assert_equal(K.nodes(), []) assert_equal(K.edges(), [])
def test_kuratowski_k5(self): G = nx.complete_graph(5) K = planarity.kuratowski_subgraph(G) assert_equal(sorted(G.nodes()), sorted(K.nodes())) assert_equal(sorted(G.edges()), sorted(K.edges()))
def test_kuratowski_k5m(self): G=nx.complete_graph(5) G.remove_edge(1,2) K=planarity.kuratowski_subgraph(G) assert_equal(list(K.nodes()),[]) assert_equal(list(K.edges()),[])
def test_kuratowski_k5(self): G=nx.complete_graph(5) K=planarity.kuratowski_subgraph(G) assert_equal(sorted(G.nodes()),sorted(K.nodes())) assert_equal(sorted(G.edges()),sorted(K.edges()))
import planarity import networkx as nx G8 = nx.complete_graph(8) G8.nodes G8.edges planarity.is_planar(G8) K = planarity.kuratowski_subgraph(G8) K.edges K.nodes nx.draw(G8)
import planarity import networkx as nx # Example of the complete graph of 5 nodes, K5 G=nx.complete_graph(5) # K5 is not planar print(planarity.is_planar(G)) # False # find forbidden Kuratowski subgraph K=planarity.kuratowski_subgraph(G) print(K.edges()) # K5 edges