def run()

in cassovary-core/src/main/scala/com/twitter/cassovary/algorithms/linkanalysis/LinkAnalysis.scala [87:109]


  def run(init: T = defaultInitialState): T = {
    var currentIteration = init


    // Let the user know if they can save memory!
    if (graph.maxNodeId.toDouble / graph.nodeCount > 1.1 && graph.maxNodeId - graph.nodeCount > 1000000)
      log.info("Warning - you may be able to reduce the memory usage by renumbering this graph!")

    log.debug(s"Initializing starting $modelName...")
    val progress = Progress(s"${modelName}_init", 65536, Some(graph.nodeCount))

    def terminate(currState: IterationState): Boolean = if (maxIterations.isDefined)
      currState.iteration >= maxIterations.get || currState.error <= tolerance
    else currState.error <= tolerance

    while (!terminate(currentIteration)) {
      val s = iterate(currentIteration)
      log.debug("Finished %sth iteration".format(s.iteration))
      progress.inc
      currentIteration = s
    }
    postRun(currentIteration)
  }