def _get_all_edges(bsp_nodes):
    """
    Get all possible straight edges between rooms in leaf nodes of BSP-tree.
    """
    all_edges = []
    for n1 in bsp_nodes:
        for n2 in bsp_nodes:
            if n1.uid == n2.uid:
                continue
            n1_x2 = n1.x + n1.w
            n1_y2 = n1.y + n1.h
            n2_x2 = n2.x + n2.w
            n2_y2 = n2.y + n2.h
            max_rx1 = max(n1.room_x1, n2.room_x1)
            max_ry1 = max(n1.room_y1, n2.room_y1)
            min_rx2 = min(n1.room_x2, n2.room_x2)
            min_ry2 = min(n1.room_y2, n2.room_y2)
            if (n1.y == n2_y2 or n1_y2 == n2.y) and max_rx1 < min_rx2 and min(
                n1_x2, n2_x2) - max(n1.x, n2.x) > 0.6 * min(n1.w, n2.w):
                all_edges.append((n1.uid, n2.uid))
            elif (n1.x == n2_x2 or n1_x2 == n2.x
                ) and max_ry1 < min_ry2 and min(n1_y2, n2_y2) - max(n1.y, n2.y
                ) > 0.6 * min(n1.h, n2.h):
                all_edges.append((n1.uid, n2.uid))
    return all_edges
