Move default pagerank settings to pagerankGraph (#1112)

This commit moves the default Pagerank options out of
`analysis/pagerank` and to `core/pagerankGraph`. This reflects the
gradual migration of core pagerank logic into `pagerankGraph`.

Test plan: `yarn test` should suffice. It's a trivial change.
This commit is contained in:
Dandelion Mané 2019-03-07 23:04:07 -07:00 committed by GitHub
parent c48b2cd52e
commit 441d6df255
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -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,
};

View File

@ -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"};