def feynman_loop_number(diagram):
    """
    Calculate the Feynman Loop Number of a Diagram.
    
    The Feynman Loop Number of a connected looped multigraph
    is the number of 1-vertices+2-vertices + the number of loops
    """
    if diagram.num_edges() == 0:
        return 0
    return diagram.degree().count(1) + diagram.degree().count(2) + \
        diagram.num_edges() - diagram.num_verts() + 1