def TotalEdges(K):
    """
    TotalEdges calculates the total number of edges in a network.
    Input:
        K = array of degree values
    Output:
        m = total number of edges
    """
    m = int(sum(K)/2.0)
    return m