Example #1
0
 /**
  *
  * @param Graph $graph
  * @depends testGraphSimple
  */
 public function testGraphWithUnweightedEdges(Graph $graph)
 {
     $graph->createVertex(5)->createEdgeTo($graph->createVertex(6))->setFlow(7);
     $alg = new AlgorithmWeight($graph);
     $this->assertEquals(3, $alg->getWeight());
     $this->assertEquals(12, $alg->getWeightFlow());
     $this->assertEquals(3, $alg->getWeightMin());
     $this->assertTrue($alg->isWeighted());
 }
Example #2
0
File: Base.php Project: feffi/graph
 /**
  * calculate total weight along minimum-cost flow
  *
  * @return float
  * @uses self::createGraph()
  * @uses AlgorithmWeight::getWeightFlow()
  */
 public function getWeightFlow()
 {
     $alg = new AlgorithmWeight($this->createGraph());
     return $alg->getWeightFlow();
 }