diff --git a/src/treedata/_core/aligned_mapping.py b/src/treedata/_core/aligned_mapping.py index 08abb23..af6a05f 100755 --- a/src/treedata/_core/aligned_mapping.py +++ b/src/treedata/_core/aligned_mapping.py @@ -81,7 +81,7 @@ def _validate_tree(self, tree: nx.DiGraph, key: str) -> nx.DiGraph: def _update_tree_labels(self): if self.parent._tree_label is not None: if self.parent.allow_overlap: - mapping = {k: ",".join(map(str, v)) for k, v in self._leaf_to_tree.items()} + mapping = {k: ",".join(map(str, sorted(v))) for k, v in self._leaf_to_tree.items()} else: mapping = {k: next(iter(v)) for k, v in self._leaf_to_tree.items()} getattr(self.parent, self.dim)[self.parent._tree_label] = getattr(self.parent, f"{self.dim}_names").map(