def adjency_to_edges(network, i_map):
    """
    Returns array containing the tuples of the edges from a (pseudo)-adjency list of the topology
    i.e. a len(leaf_nodes)xlen(root_nodes) matrix with
    0 and 1's

    :param network: peepo_network
    :param i_map: a matrix of shape (len(leaf_nodes),len(root_nodes)) containing the adjency matrixa
    :return: array containing the tuples of the edges
    """
    edges = []
    for col, root in enumerate(network.get_root_nodes()):
        for row, leaf in enumerate(network.get_leaf_nodes()):
            if i_map[row][col] == 1:
                edges.append((root, leaf))
    return edges