MCPcopy Index your code
hub / github.com/OmkarPathak/pygorithm / think

Method think

pygorithm/data_structures/quadtree.py:141–161  ·  view source on GitHub ↗

Call :py:meth:`.split` if appropriate Split this quad tree if it has not split already and it has more entities than :py:attr:`.bucket_size` and :py:attr:`.depth` is less than :py:attr:`.max_depth`. If `recursive` is True, think is called

(self, recursive = False)

Source from the content-addressed store, hash-verified

139 self.children = None
140
141 def think(self, recursive = False):
142 """
143 Call :py:meth:`.split` if appropriate
144
145 Split this quad tree if it has not split already and it has more
146 entities than :py:attr:`.bucket_size` and :py:attr:`.depth` is
147 less than :py:attr:`.max_depth`.
148
149 If `recursive` is True, think is called on the :py:attr:`.children` with
150 recursive set to True after splitting.
151
152 :param recursive: if `think(True)` should be called on :py:attr:`.children` (if there are any)
153 :type recursive: bool
154 """
155 if not self.children and self.depth < self.max_depth and len(self.entities) > self.bucket_size:
156 self.split()
157
158 if recursive:
159 if self.children:
160 for child in self.children:
161 child.think(True)
162
163 def split(self):
164 """

Callers 1

test_thinkMethod · 0.95

Calls 1

splitMethod · 0.95

Tested by 1

test_thinkMethod · 0.76