private LinkedHashMap < HypergraphNode < Variable > , Integer > orderingFromTentativeNewLocations ( final LinkedHashMap < HypergraphNode < Variable > , Double > newLocations ) { final LinkedHashMap < HypergraphNode < Variable > , Integer > ordering = new LinkedHashMap <> ( ) ; final List < Map . Entry < HypergraphNode < Variable > , Double > > list = new ArrayList <> ( newLocations . entrySet ( ) ) ; Collections . sort ( list , COMPARATOR ) ; int count = 0 ; for ( final Map . Entry < HypergraphNode < Variable > , Double > entry : list ) ordering . put ( entry . getKey ( ) , count ++ ) ; return ordering ; } /** * The abortion criteria for the FORCE algorithm. * @param lastOrdering the ordering of the last step * @param currentOrdering the ordering of the current step * @return {@code true} if the algorithm should proceed, {@code false} if it should stop */ private boolean shouldProceed ( final Map < HypergraphNode < Variable > , Integer > lastOrdering , final Map < HypergraphNode < Variable > , Integer > currentOrdering ) { return ! lastOrdering . equals ( currentOrdering ) ; }
Generates a new integer ordering from tentative new locations of nodes with the double weighting .