public function testLoopCycle()
{
// 1 --\
// ^ |
// \---/
$graph = new Graph();
$v1 = $graph->createVertex(1);
$e1 = $v1->createEdgeTo($v1);
$cycle = Walk::factoryCycleFromEdges(array($e1), $v1);
$this->assertGraphEquals($graph, $cycle->createGraph());
$cycle = Walk::factoryCycleFromPredecessorMap(array(1 => $v1), $v1);
$this->assertGraphEquals($graph, $cycle->createGraph());
$cycle = Walk::factoryCycleFromVertices(array($v1, $v1));
$this->assertGraphEquals($graph, $cycle->createGraph());
$this->assertCount(2, $cycle->getVertices());
$this->assertCount(1, $cycle->getEdges());
$this->assertSame($v1, $cycle->getVertices()->getVertexFirst());
$this->assertSame($v1, $cycle->getVertices()->getVertexLast());
$this->assertTrue($cycle->isValid());
return $v1;
}