def show_different_hypergraphs(n=10, k=3, parts=10): for fraction in np.linspace(0, 1, parts)[1:]: plt.figure(figsize=(6, 6)) g = uniform_hypergraph(n=n, k=k, number_of_edges=int(n * fraction)) G = convert_to_nx_bipartite_graph(g.nodes(), g.hyper_edges()) utils.plot_bipartite_graph(G, *utils.hypergraph_to_bipartite_parts(G)) hyper_G = convert_to_custom_hyper_G(g.nodes(), g.hyper_edges()) plt.figure(figsize=(6, 6)) nx.draw(hyper_G, node_size=3000, cmap=plt.cm.Blues, alpha=0.6) plt.show()
def plot_different_representations(nodes, hyperedges): print("Drawing different representations of hypergraph") print("Bipartite graph") nx_bipartite = converters.convert_to_nx_bipartite_graph(nodes, hyperedges) plot_bipartite_graph(nx_bipartite, *hypergraph_to_bipartite_parts(nx_bipartite)) print("Graph of hypereges as nodes") custom_hyper_g = converters.convert_to_custom_hyper_G(nodes, hyperedges) plt.figure() nx.draw(custom_hyper_g) print("Clique graph") clique_graph = converters.convert_to_clique_graph(nodes, hyperedges) plt.figure() nx.draw(clique_graph)