MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / union

Method union

docling/utils/layout_postprocessor.py:27–38  ·  view source on GitHub ↗
(self, x, y)

Source from the content-addressed store, hash-verified

25 return self.parent[x]
26
27 def union(self, x, y):
28 root_x, root_y = self.find(x), self.find(y)
29 if root_x == root_y:
30 return
31
32 if self.rank[root_x] > self.rank[root_y]:
33 self.parent[root_y] = root_x
34 elif self.rank[root_x] < self.rank[root_y]:
35 self.parent[root_x] = root_y
36 else:
37 self.parent[root_y] = root_x
38 self.rank[root_x] += 1
39
40 def get_groups(self) -> Dict[int, List[int]]:
41 """Returns groups as {root: [elements]}."""

Callers 5

object_to_dictFunction · 0.45
layout_inductMethod · 0.45
find_candidatesMethod · 0.45
LayoutPostprocessorClass · 0.45

Calls 1

findMethod · 0.95

Tested by

no test coverage detected