/** * @expectedException InvalidArgumentException */ public function testInvalidVertexPassedToAlgorithm() { $graph = new Graph(); $graph2 = new Graph(); $v2 = $graph2->createVertex(12); $alg = new AlgorithmConnected($graph); $alg->createGraphComponentVertex($v2); }
/** * create subgraph for all classes connected to given class (i.e. return it's connected component) * * @param string $class * @return Graph * @throws Exception */ public function createGraphComponent($class) { try { $vertex = $this->graph->getVertex($class); } catch (Exception $e) { throw new Exception('Given class is unknown'); } $alg = new AlgorithmConnectedComponents($this->graph); return $alg->createGraphComponentVertex($vertex); }