getGraph()->createGraphCloneEdges($this->getEdges()); } /** * get graph this algorithm operates on * * @return Graph */ abstract protected function getGraph(); /** * get start vertex this algorithm starts on * * @return Vertex */ abstract protected function getVertexStart(); /** * get (first) best circle connecting all vertices * * @return Walk * @uses AlgorithmTsp::getEdges() * @uses AlgorithmTsp::getVertexStart() * @uses Walk::factoryCycleFromEdges() */ public function getCycle() { return Walk::factoryCycleFromEdges($this->getEdges(), $this->getVertexStart()); } public function getWeight() { $weight = 0; foreach ($this->getEdges() as $edge) { $weight += $edge->getWeight(); } return $weight; } /** * get array of edges connecting all vertices in a circle * * @return Edges */ abstract public function getEdges(); }