private function buildGraph() { $matches = $this->problem->getPairsOfMatchingPositions(); $graph = new Graph(); foreach ($matches as $match1) { foreach ($matches as $match2) { if ($match1 != $match2) { $di = $match2->pos1 - $match1->pos1; $dj = $match2->pos2 - $match1->pos2; if ($di > 0 && $dj > 0) { $graph->newLink($match1, $match2); } } } } return $graph; }