First implementation of longest path solver