Working on reimplimentation using generic directed graph