| [maxgetnodes] [Up] [maxgetcount] | Introspection Functions |
| User Feedback |
This function allows tree traversal from the root node to the leaves.
Make sure the node is not a leaf node before calling this function.
For example, the following code snippet print the nodes of the MaxTree recursively, starting on a given node and going to the leaves.
# --------------------------------------------------------------
# Recursive MaxTree print
# --------------------------------------------------------------
def printNode(mxt, indent, level, index):
st = maxgetnodes(mxt, level, index)
print ' '*indent
print 'Node(%d,%d): [%d (%d,%d) (%d,%d -- %d,%d)]' % (level, index, st[3],
st[4]/st[3], st[5]/st[3],
st[6], st[7], st[8], st[9])
if st[0] == 0: # not a leaf
children = maxgetchildren(mxt, level, index)
for lev, ind in children:
printNode(mxt, indent+1, lev, ind)
| [maxgetnodes] [Up] [maxgetcount] | |
| User Feedback | |
| Copyright (c) 1998-2008 by SDC Information Systems |