def _IsBoundary(i, n, cont, assigned):
    """Is path i a boundary, given current assignment?

    Args:
      i: int - index of a path to test for boundary possiblity
      n: int - total number of paths
      cont: dict - maps path pairs (i,j) to _Contains(i,j,...) result
      assigned: set  of int - which paths are already assigned
    Returns:
      bool - True if there is no unassigned j, j!=i, such that
             path j contains path i
    """

    for j in range(0, n):
        if j == i or j in assigned:
            continue
        if (j, i) in cont:
            return False
    return True