def to_adj_list(adj_matrix):
    """
    Converts a binary adjacency matrix to a list of directed edges
    """
    adj_list = []
    assert adj_matrix.shape[0] == adj_matrix.shape[1]
    for idx in range(adj_matrix.shape[0]):
        for jdx in range(idx, adj_matrix.shape[0]):
            if adj_matrix[idx, jdx] == 1:
                adj_list.append([idx, jdx])
    return adj_list
