def generate_hypergraph(num_nodes, num_edges, r = <NUM_LIT:0>):
<EOL>random_graph = hypergraph()<EOL>nodes = list(map(str, list(range(num_nodes))))<EOL>random_graph.add_nodes(nodes)<EOL>edges = list(map(str, list(range(num_nodes, num_nodes+num_edges))))<EOL>random_graph.add_hyperedges(edges)<EOL>if <NUM_LIT:0> == r:<EOL><INDENT>for e in edges:<EOL><INDENT>for n in nodes:<EOL><INDENT>if choice([True, False]):<EOL><INDENT>random_graph.link(n, e)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>for e in edges:<EOL><INDENT>shuffle(nodes)<EOL>for i in range(r):<EOL><INDENT>random_graph.link(nodes[i], e)<EOL><DEDENT><DEDENT><DEDENT>return random_graph<EOL>
Create a random hyper graph.

@type  num_nodes: number
@param num_nodes: Number of nodes.

@type  num_edges: number
@param num_edges: Number of edges.

@type  r: number
@param r: Uniform edges of size r.