Patent ID: 7620933

Claim:
A method for determining a distance between a first node and a second node that share a nearest root node within a structured program, the method comprising programming a processor to perform the steps of: determining a shortest first node path between the first node and the nearest root node, counting a first node depth between the first node and the nearest root node along the first node path, determining a shortest second node path between the second node and the nearest root node, counting a second node depth between the second node and the nearest root node along the second node path, designating one of the first node path and the second node path that has a highest count as a deepest node path, designating another of the first node path and the second node path that has a lowest count as a shallowest node path, descending the deepest node path to a node depth that is equal to that of the shallowest node path, increasing a distance count by one count for each node that was descended on the deepest node path to reach a node with a depth that is equal to that of the shallowest node path, descending both the deepest node path and the shallowest node path to the nearest root node, increasing the distance count by two counts for each node that was descended on the deepest node path and the shallowest node path to reach the nearest root node, and providing the distance count as the distance between the first node and the second node.