def is_subgraph(G, H):
    """
        Checks whether G is a subgraph of H, that is whether all the edges of G belong to H
    """
    edges1 = set(G.edges())
    edges2 = set(H.edges())
    return len(edges1) == len(edges1 & edges2)