public function testWalkWithinGraph()
{
// 1 -- 2 -- 3
$graph = new Graph();
$v1 = $graph->createVertex(1);
$v2 = $graph->createVertex(2);
$v3 = $graph->createVertex(3);
$e1 = $v1->createEdgeTo($v2);
$e2 = $v2->createEdgeTo($v3);
// construct partial walk "1 -- 2"
$walk = Walk::factoryFromEdges(array($e1), $v1);
$this->assertEquals(2, count($walk->getVertices()));
$this->assertEquals(1, count($walk->getEdges()));
$this->assertSame($v1, $walk->getVertices()->getVertexFirst());
$this->assertSame($v2, $walk->getVertices()->getVertexLast());
$this->assertSame(array($v1, $e1, $v2), $walk->getAlternatingSequence());
$this->assertTrue($walk->isValid());
$graphExpected = new Graph();
$graphExpected->createVertex(1)->createEdgeTo($graphExpected->createVertex(2));
$this->assertGraphEquals($graphExpected, $walk->createGraph());
// construct same partial walk "1 -- 2"
$walkVertices = Walk::factoryFromVertices(array($v1, $v2));
$this->assertEquals(2, count($walkVertices->getVertices()));
$this->assertEquals(1, count($walkVertices->getEdges()));
$this->assertGraphEquals($graphExpected, $walkVertices->createGraph());
return $walk;
}