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)))
chiList=get_chi(g,n) chiObtained=max(chiList) print("chromatic number of graph is "+str(chiObtained)) # nx.draw(graph, node_color=chiList, with_labels=True) # plt.show() if(chi==chiObtained): print("CONDITIONS SATISFIED !!!") else: print("chromatic number doesn't match, doing mycielskian construction") itrns=chi-chiObtained myc_g=nx.mycielskian(graph, iterations=itrns) graph=myc_g gnp=nx.to_numpy_matrix(graph,dtype="int") g=np.ndarray.tolist(gnp) ncopy=graph.number_of_nodes() chiList=get_chi_list(g,ncopy,chi) chiObtained=max(chiList) print("chromatic number of graph now is "+str(chiObtained)) # print(chiList) color_map=get_color_map(chiList) # nodes_list=graph.nodes() # print(nodes_list)
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