directed graph and tests