function getDomainNodesAndTheirPatternCounts() { $result = getAllDomainNodes(); $list = array(); while ($row = mysql_fetch_array($result)) { $tempList = array(); $linksArray = getLinksArrayByNid($row['nid']); $count = 0; foreach ($linksArray as $key => $value) { if (!isDomainNode($value)) { $count++; } } array_push($tempList, $row); array_push($tempList, $count); array_push($list, $tempList); } return $list; }
function findNodeNeighbour($start, $recordList) { // global $recordList; $linkList = getLinksArrayByNid($start); //print_r($linkList); //print_r($recordList); $count = count($linkList); for ($i = 0; $i < $count; $i++) { if (in_array($linkList[$i], $recordList)) { // array_splice($linkList,$i,1); // echo "true".$i." "; unset($linkList[$i]); } } $resultLink = array(); foreach ($linkList as $value) { array_push($resultLink, $value); } //print_r($resultLink); return $resultLink; }
$nodes0 = $_POST['nodes0']; if ($nodes0 == null) { echo "You need to connect to at least one node\n"; $flag = false; } if (count($nodes0) == 0) { echo "You need to connect to at least one node\n"; $flag = false; } if (count($nodes0) > 3) { echo "Please select at most three nodes\n"; $flag = false; } foreach ($nodes0 as $key => $value) { if (getNodeByNid($value)['isConnector'] == 1) { $links = getLinksArrayByNid($value); foreach ($links as $key1 => $value1) { if (getNodeByNid($value1)['isConnector'] == 1 || getNodeByNid($value1)['isConnector'] == 2) { unset($links[$key1]); } } if (count($links) >= 3) { echo "Can not connect to Node" . $value . " because it is already connected with three nodes\n"; $flag = false; break; } } else { if (getLinkCountByNid($value) >= 3) { echo "Can not connect to Node" . $value . " because it is already connected with three nodes\n"; $flag = false; break;