Here you can find the source of invert(int[][] clustered)
Parameter | Description |
---|---|
clustered | a parameter |
public static Map<Integer, Integer> invert(int[][] clustered)
//package com.java2s; import java.util.HashMap; import java.util.Map; public class Main { /**/*from ww w. java2s . c o m*/ * Map index to cluster from cluster array * @param clustered * @return index to cluster */ public static Map<Integer, Integer> invert(int[][] clustered) { int cluster = 0; Map<Integer, Integer> ret = new HashMap<Integer, Integer>(); for (int[] is : clustered) { for (int index : is) { ret.put(index, cluster); } cluster++; } return ret; } }