コード例 #1
0
ファイル: MST.php プロジェクト: yfeng55/visualgo
 protected function init()
 {
     $this->size = rand(6, 8);
     $this->graphTemplate = GraphTemplate::getGraph(array("numVertex" => $this->size, "directed" => false, "connected" => true));
     $this->adjList = generateAdjList($this->graphTemplate);
     //array of array of Pairs
     $this->edgeList = generateEdgeList($this->graphTemplate);
     //array of triples
 }
コード例 #2
0
 protected function getAnswerNonzero($qObj)
 {
     $graphTemplate = $qObj->internalDS;
     $edgeList = generateEdgeList($graphTemplate);
     $nEdges = count($edgeList);
     $ans = 2 * $nEdges;
     return $ans;
 }