import copy


def cutoff_graph( g, simi_cutoff ) :
    """
    Generates a new graph by cutting off the similarity scores.

    @type            g: C{networkx.Graph}
    @param           g: Original graph
    @type  simi_cutoff: C{float}
    @param simi_cutoff: Similarity cutoff
    
    @return: A new graph
    """
    g = copy.deepcopy( g )
    edges_to_be_deleted = []
    for e in g.edges() :
        if (g[e[0]][e[1]]["similarity"] < simi_cutoff) :
            edges_to_be_deleted.append( e )
    g.remove_edges_from( edges_to_be_deleted )
    return g