Skip to content

Get best alignment #11

@LuisCastilloV98

Description

@LuisCastilloV98

I'm trying to add a code to alignments.py, to get the best alignment the alignment matrix doesn't work, but it doesn't work for me, I don't know if it finds the error and could you help me with it?

def get_best_alignment(alignment_matrix):
  n_nodes = alignment_matrix.shape[0]
  result = []
  if not sp.issparse(alignment_matrix):
      sorted_indices = np.argsort(alignment_matrix)
  for node_index in range(n_nodes):
    target_alignment = node_index #default: assume identity mapping, and the node should be aligned to itself      

    if sp.issparse(alignment_matrix):
          row, possible_alignments, possible_values = sp.find(alignment_matrix[node_index])
          node_sorted_indices = possible_alignments[possible_values.argsort()]
    else:
          node_sorted_indices = sorted_indices[node_index]

    result.append([target_alignment, node_sorted_indices[-1:][0]])

  return result

The idea is that of a result type [A -> B...].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions