public static BigDecimal subgraftetthet(boolean[][] nabomatrise, int startnode, int len){
		int antallKanter = 0;
		int antallNoderMed = 0;
		
		noderMed = new boolean[len];
		
		dfs(nabomatrise, startnode, len);
				
		for (int i = 0; i < len; i++) {
			if (noderMed[i]) continue;
			antallNoderMed++;
			boolean[] row = nabomatrise[i];
			for (int j = 0; j < len; j++) {
				if (noderMed[j]) continue;
				if (row[j]) antallKanter++;
			}
		}
		
		if (antallNoderMed == 0) {
			antallNoderMed = 1;
			antallKanter = 0;
		}
		return new BigDecimal(antallKanter).divide(new BigDecimal(antallNoderMed*antallNoderMed), 3, BigDecimal.ROUND_HALF_UP);
	}