A Prolog implementation of graph theory