public double getDensity(String kamName) {
        final int nodes = getKamNodeCount(kamName);
        final int edges = getKamEdgeCount(kamName);
        return (nodes > 1 ? ((double) edges) / (nodes * (nodes - 1)) : 0.0);
    }
public double getDensity ( String kamName ) { final int nodes = getKamNodeCount ( kamName ) ; final int edges = getKamEdgeCount ( kamName ) ; return ( nodes > 1 ? ( ( double ) edges ) / ( nodes * ( nodes - 1 ) ) : 0.0 ) ; }
Returns the density of the KAM calculated as the number of
KAM edges divided by the maximum number of edges possible between
the KAM nodes:
{@code E / (N * (N - 1))}
where N is the number of KAM nodes and E is the number of KAM edges.
Zero is returned in the cases that the above expression is undefined.