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 }
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; }