A graph implementation in prolog