def NW(N, tp='U'):
    """function to compute number of edges or number of feasible vertex-pair

    Args:
        N (int): number of nodes
        tp (str, optional): Can be either 'U' for undirected and 'D' for directed graphs. Defaults to 'U'.

    Returns:
        int: number of edges or number of feasible vertex-pair between N nodes
    """
    assert tp=='U' or tp=='D', "Invalid type in NW, it shall be either 'U' or 'D'"
    if tp=='U':
        return N*(N-1)//2
    else:
        return N*(N-1)