/** * @return string */ public function __toString() { $parts = []; /* @var Directed $edge */ foreach ($this->walk->getEdges() as $edge) { $from = $this->getEntityClassName($edge->getVertexStart()->getId()); $to = $this->getEntityClassName($edge->getVertexEnd()->getId()); $parts[] = sprintf(' %s %s %s', str_pad($from, 20, ' ', STR_PAD_LEFT), str_pad($edge->getLayoutAttribute('label'), 15, '-', STR_PAD_BOTH) . '>', $to); } return implode("\n", $parts); }
/** * @param Walk $walk * @depends testWalkLoop */ public function testWalkInvalidByDestroyingEdge(Walk $walk) { // destroy first edge found foreach ($walk->getEdges() as $edge) { $edge->destroy(); break; } $this->assertFalse($walk->isValid()); }
/** * checks whether walk is eulerian (i.e. a walk over ALL EDGES of the graph) * * @return boolean * @see self::isHamiltonian() if you want to check for all VERTICES instead of EDGES * @uses self::isArrayContentsEqual() * @link http://en.wikipedia.org/wiki/Eulerian_path */ public function isEulerian() { return $this->isArrayContentsEqual($this->walk->getEdges()->getVector(), $this->walk->getGraph()->getEdges()->getVector()); }