public static void main(String[] args) throws Exception {
        String baseFilename = args[0];
        int numShards = Integer.parseInt(args[1]);

        FriendsOfFriends fof = new FriendsOfFriends(baseFilename, numShards, false);

        BufferedReader cmdIn = new BufferedReader(new InputStreamReader(System.in));
        while(true) {
            System.out.print("Enter vertex id to get friends-of-friends >> :: ");
            String ln = cmdIn.readLine();
            if (ln.startsWith("q")) break;

            if (ln.startsWith("t")) {
                for(int i=10; i < 1000; i++) {
                    fof.recommendFriends(i, 1000);
                }
                break;
            }
            if (ln.startsWith("b")) {
                // Benchmark
                fof.queryEngine.shutdown();
                fof = new FriendsOfFriends(baseFilename, numShards, false);
                int numVertices = ChiFilenames.numVertices(baseFilename, numShards);

                Random r = new Random();
                for(int i=0; i<1000000; i++) {
                    int vId = r.nextInt(numVertices);

                    if (vId % 10 <= 4) {    // 50% of time look for lower ids which have higher degree
                        vId = r.nextInt(numVertices % 100000);
                    }

                    fof.recommendFriends(vId, 4000);

                    if (i % 1000 == 0) {
                        logger.info("Benchmark round " + i);
                    }
                    fof.logWriter.flush();
                }
            }

            int queryId = Integer.parseInt(ln);
            fof.recommendFriends(queryId, 500);
        }
        fof.queryEngine.shutdown();
    }