#1772: Merged latest changes (directed graph and bottom up distance calculator) from the BottomUpDistance branch.