Get a list of names from the root to this node. Returns: List[str]: A list of node names from the root to this node.
(self, root: Optional["KnowledgeNode"] = None)
| 188 | return f"KnowledgeNode(name={self.name}, content={self.content}, children={len(self.children)})" |
| 189 | |
| 190 | def get_path_from_root(self, root: Optional["KnowledgeNode"] = None): |
| 191 | """ |
| 192 | Get a list of names from the root to this node. |
| 193 | |
| 194 | Returns: |
| 195 | List[str]: A list of node names from the root to this node. |
| 196 | """ |
| 197 | path = [] |
| 198 | current_node = self |
| 199 | while current_node: |
| 200 | path.append(current_node.name) |
| 201 | if root is not None and current_node.name == root.name: |
| 202 | break |
| 203 | current_node = current_node.parent |
| 204 | return path[::-1] |
| 205 | |
| 206 | def insert_information(self, information_index: int): |
| 207 | if information_index not in self.content: |
no outgoing calls
no test coverage detected