diff --git a/src/analysis/pagerank.js b/src/analysis/pagerank.js index 20a79f8..7aec9dc 100644 --- a/src/analysis/pagerank.js +++ b/src/analysis/pagerank.js @@ -1,6 +1,11 @@ // @flow import {type Edge, Graph, NodeAddress, type NodeAddressT} from "../core/graph"; +import { + DEFAULT_MAX_ITERATIONS, + DEFAULT_CONVERGENCE_THRESHOLD, + DEFAULT_SYNTHETIC_LOOP_WEIGHT, +} from "../core/pagerankGraph"; import { distributionToNodeDistribution, createConnections, @@ -35,9 +40,9 @@ export type EdgeEvaluator = (Edge) => EdgeWeight; function defaultOptions(): PagerankOptions { return { verbose: false, - selfLoopWeight: 1e-3, - convergenceThreshold: 1e-7, - maxIterations: 255, + selfLoopWeight: DEFAULT_SYNTHETIC_LOOP_WEIGHT, + convergenceThreshold: DEFAULT_CONVERGENCE_THRESHOLD, + maxIterations: DEFAULT_MAX_ITERATIONS, totalScore: 1000, totalScoreNodePrefix: NodeAddress.empty, }; diff --git a/src/core/pagerankGraph.js b/src/core/pagerankGraph.js index 8bf2f8a..3b9d80f 100644 --- a/src/core/pagerankGraph.js +++ b/src/core/pagerankGraph.js @@ -70,6 +70,8 @@ export type PagerankConvergenceReport = {| |}; export const DEFAULT_SYNTHETIC_LOOP_WEIGHT = 1e-3; +export const DEFAULT_MAX_ITERATIONS = 255; +export const DEFAULT_CONVERGENCE_THRESHOLD = 1e-7; const COMPAT_INFO = {type: "sourcecred/pagerankGraph", version: "0.1.0"};