public static EdgeScores tensorToEdgeScores(Tensor t) {
        if (t.getDims().length != 2) {
            throw new IllegalArgumentException("Tensor must be an nxn matrix.");
        }
        int n = t.getDims()[1];
        EdgeScores es = new EdgeScores(n, 0);        
        for (int p = -1; p < n; p++) {
            for (int c = 0; c < n; c++) {
                if (p == c) { continue; }
                int pp = getTensorParent(p, c);
                es.setScore(p, c, t.get(pp, c));
            }
        }
        return es;
    }
public static EdgeScores tensorToEdgeScores ( Tensor t ) { if ( t . getDims ( ) . length != 2 ) { throw new IllegalArgumentException ( "Tensor must be an nxn matrix." ) ; } int n = t . getDims ( ) [ 1 ] ; EdgeScores es = new EdgeScores ( n , 0 ) ; for ( int p = - 1 ; p < n ; p ++ ) { for ( int c = 0 ; c < n ; c ++ ) { if ( p == c ) { continue ; } int pp = getTensorParent ( p , c ) ; es . setScore ( p , c , t . get ( pp , c ) ) ; } } return es ; }
Convert a Tensor object to an EdgeScores, where the wall node is indexed as position n+1 in the Tensor.