Search code examples
javagraphjung

calculating Eigenvector value using JUNG


I want to calculate eigenvector centrality measure for vertices of specific graph using JUNG library. Unfortunately my code returns a wrong result. here is some part of my code:

DirectedSparseGraph<Customer, Transaction> tsn=f.getTSN()
EigenvectorCentrality<Customer, Transaction> eScorer=new EigenvectorCentrality<>(tsn);
for(Customer node:tsn.getVertices()){
            System.out.println(node.getName()+" :eigen:"+eScorer.getVertexScore(node));
        }

Would you please tell me what part of using eigenvector with jung library i missed? Regards.


Solution

  • I figure out how to calculate eigenvector using jung. Two line of code need for calculation of Eigenvector:

    eScorer.acceptDisconnectedGraph(true);
    eScorer.evaluate();