5237 Better algorithm to pich replacement node when faking position for subgraphs

This commit is contained in:
Knut Sveidqvist
2024-06-11 13:27:51 +02:00
parent aaa4e8a794
commit 5f110e4cde
3 changed files with 85 additions and 14 deletions

View File

@@ -8,6 +8,7 @@ export const findCommonAncestor = (id1: string, id2: string, treeData: TreeData)
const visited = new Set();
let currentId = id1;
// Edge case with self edges
if (id1 === id2) {
return parentById[id1] || 'root';
}