src/Matchers/SpatialMatch.php
protected static function calcAverageDegree($graph)
    {
        $sum = 0;
        foreach ($graph as $neighbors) {
            foreach ($neighbors as $neighbor) {
                // Ignore empty neighbors.
                if (null !== $neighbor) {
                    ++$sum;
                }
            }
        }

        return $sum / count(array_keys($graph));
    }
protected static function calcAverageDegree($graph)
    {
        $sum = 0;
        foreach ($graph as $neighbors) {
            foreach ($neighbors as $neighbor) {
                // Ignore empty neighbors.
                if (null !== $neighbor) {
                    ++$sum;
                }
            }
        }

        return $sum / count(array_keys($graph));
    }
protected static function calcAverageDegree ( $ graph ) { $ sum = 0 ; foreach ( $ graph as $ neighbors ) { foreach ( $ neighbors as $ neighbor ) { // Ignore empty neighbors. if ( null !== $ neighbor ) { ++ $ sum ; } } } return $ sum / count ( array_keys ( $ graph ) ) ; }
Calculate the average degree for all keys in a adjancency graph.

@param array $graph

@return float
Calculate the average degree for all keys in a adjancency graph .