Add graph construction algorithm.