def METHOD_NAME(
    self, nodes: List[NodeWithScore]
) -> Tuple[List[NodeWithScore], bool]:
    """Try different ways to merge nodes."""
    # first try filling in nodes
    nodes, is_changed_0 = self._fill_in_nodes(nodes)
    # then try merging nodes
    nodes, is_changed_1 = self._get_parents_and_merge(nodes)
    return nodes, is_changed_0 or is_changed_1