Search code examples
javaperformancejung

how to estimate time for StructuralHoles to perform


I have a UndirectedSparseGraph< String, String > g with 5000 nodes and 200000 links. I am trying to run StructuralHoles() on it on my macbook air with 4GB. Is there a way to estimate how long will it take to finish the task?


Solution

  • First, I should mention that the StructuralHoles class has a few different public methods, so you'd need to specify which measure you were calculating: http://jung.sourceforge.net/doc/api/edu/uci/ics/jung/algorithms/metrics/StructuralHoles.html

    Once you've clarified that point, there are a few ways to do this sort of estimate.

    (1) Look at the source code (or the referenced paper), and get an idea of what the time complexity of the algorithm is. That will give you a basis for understanding how the time required will change with the size of the graph.

    (2) Extract subgraphs (of node size 50, 100, and 500, say) and measure how long the algorithm takes with each of them. Then extrapolate, ideally using the analysis from (1) (and taking into account the number of edges in each subgraph, as well).

    (3) Add some logging to the existing code so that you can determine how long it's taking it to process a batch of N nodes (or M edges), and then run it.