Ejemplo n.º 1
0
 protected function init()
 {
     $this->size = rand(6, 10);
     $this->graphTemplate = GraphTemplate::getGraph(array("numVertex" => $this->size, "directed" => true, "connected" => true));
     $this->adjList = generateAdjList($this->graphTemplate);
     //array of array of Pairs
 }
Ejemplo n.º 2
0
 protected function getAnswerNeighbours($qObj)
 {
     $graphTemplate = $qObj->internalDS;
     $v = $qObj->qParams["value"];
     $adjList = generateAdjList($graphTemplate);
     $ans = array();
     $thisrow = $adjList[$v];
     for ($i = 0; $i < count($thisrow); $i++) {
         $ans[] = $thisrow[$i]->v();
     }
     return $ans;
 }