public function testVertexCanBeDeleted() { $graph = new Graph([1, 2, 3], [[1, 2], [2, 3], [1, 3]], true); $graph->removeVertex(2); $this->assertEquals(2, $graph->order); $sinkArray = $graph->getSinkVertices(); $sourceArray = $graph->getSourceVertices(); $this->assertCount(1, $sourceArray); $this->assertCount(1, $sinkArray); $this->assertSame(reset($sourceArray), $graph->getVertex(1)); $this->assertSame(reset($sinkArray), $graph->getVertex(3)); $graph->removeVertex(3); $this->assertEquals(1, $graph->order); $sinkArray = $graph->getSinkVertices(); $sourceArray = $graph->getSourceVertices(); $this->assertCount(1, $sourceArray); $this->assertCount(1, $sinkArray); $this->assertSame(reset($sourceArray), reset($sinkArray)); }