public static < T > Partition < T > singletons ( Collection < T > nodes ) { final Map < T , T > parents = Maps . newHashMap ( ) ; final Map < T , Integer > ranks = Maps . newHashMap ( ) ; for ( T node : nodes ) { parents . put ( node , node ) ; // each node is its own head ranks . put ( node , 0 ) ; // every node has depth 0 to start } return new Partition < T > ( parents , ranks ) ; }
Constructs a new partition of singletons