src/io/github/marwlod/word_net/SAP.java
// do unit testing of this class
do unit testing of this class
do unit testing of this class
public static void main(String[] args) {
        In in = new In(args[0]);
        Digraph G = new Digraph(in);
        SAP sap = new SAP(new Digraph(G));
        Iterable<Integer> vs = new ArrayList<>(Arrays.asList(13, 23, 24));
        Iterable<Integer> ws = new ArrayList<>(Arrays.asList(6, 16, 17));
        int length   = sap.length(vs, ws);
        int ancestor = sap.ancestor(vs, ws);
        StdOut.printf("length = %d, ancestor = %d\n", length, ancestor);
        while (!StdIn.isEmpty()) {
            int v = StdIn.readInt();
            int w = StdIn.readInt();
            length   = sap.length(v, w);
            ancestor = sap.ancestor(v, w);
            StdOut.printf("length = %d, ancestor = %d\n", length, ancestor);
        }
    }
public static void main ( String [ ] args ) { In in = new In ( args [ 0 ] ) ; Digraph G = new Digraph ( in ) ; SAP sap = new SAP ( new Digraph ( G ) ) ; Iterable < Integer > vs = new ArrayList < > ( Arrays . asList ( 13 , 23 , 24 ) ) ; Iterable < Integer > ws = new ArrayList < > ( Arrays . asList ( 6 , 16 , 17 ) ) ; int length = sap . length ( vs , ws ) ; int ancestor = sap . ancestor ( vs , ws ) ; StdOut . printf ( "length = %d, ancestor = %d\n" , length , ancestor ) ; while ( ! StdIn . isEmpty ( ) ) { int v = StdIn . readInt ( ) ; int w = StdIn . readInt ( ) ; length = sap . length ( v , w ) ; ancestor = sap . ancestor ( v , w ) ; StdOut . printf ( "length = %d, ancestor = %d\n" , length , ancestor ) ; } }
do unit testing of this class
do unit testing of this class