A method for determining a distance between a first node and a second node
that share a root node within a structured program. A first node path
between the first node and the root node is determined, and a first node
depth is counted. A second node path between the second node and the root
node is also determined, and a second node depth is likewise counted. One
of the node paths that has a highest count is designated as the deepest
path, and the other is designated as the shallowest path. The deepest
path is descended to a depth that is equal to that of the shallowest
path, and a distance count is increased by one count for each node that
was descended on the deepest path to reach a depth that is equal to the
shallowest path. Both the deepest path and the shallowest path are
descended to the root node, and the distance count is increased by two
counts for each node that was descended. The distance count is provided
as the distance between the first node and the second node.