code for creating hypergraph