本文整理汇总了Python中TreeNode.TreeNode.edge_label方法的典型用法代码示例。如果您正苦于以下问题:Python TreeNode.edge_label方法的具体用法?Python TreeNode.edge_label怎么用?Python TreeNode.edge_label使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeNode.TreeNode
的用法示例。
在下文中一共展示了TreeNode.edge_label方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadFirstChildren
# 需要导入模块: from TreeNode import TreeNode [as 别名]
# 或者: from TreeNode.TreeNode import edge_label [as 别名]
def loadFirstChildren(root, foundNodes, batchloadOn):
# get immediate children
# batch load nodes of each fetched edge
if batchloadOn:
batchLoadAttribute(root.dagnode.child_edges, "child_node")
for edge in root.dagnode.child_edges:
child_node = edge.child_node
ctree_node = TreeNode(child_node)
ctree_node.parent = root
ctree_node.edge_label = edge.label
root.children.append(ctree_node)
foundNodes.add(child_node)
示例2: loadSiblings
# 需要导入模块: from TreeNode import TreeNode [as 别名]
# 或者: from TreeNode.TreeNode import edge_label [as 别名]
def loadSiblings(originalNode, currentNode, foundNodes, batchloadOn):
# expand first parent to load siblings
if batchloadOn:
batchLoadAttribute(currentNode.dagnode.child_edges, "child_node")
currentNode.children = []
for edge in currentNode.dagnode.child_edges:
child_node = edge.child_node
ctree_node = TreeNode(child_node)
# preserve original node structure in order
if ctree_node._term_key == originalNode._term_key:
ctree_node = originalNode
ctree_node.parent = currentNode
ctree_node.edge_label = edge.label
currentNode.children.append(ctree_node)
foundNodes.add(child_node)