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 // @flow
import {type Edge, Graph, NodeAddress, type NodeAddressT} from "../core/graph"; 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 { import {
distributionToNodeDistribution, distributionToNodeDistribution,
createConnections, createConnections,
@ -35,9 +40,9 @@ export type EdgeEvaluator = (Edge) => EdgeWeight;
function defaultOptions(): PagerankOptions { function defaultOptions(): PagerankOptions {
return { return {
verbose: false, verbose: false,
selfLoopWeight: 1e-3, selfLoopWeight: DEFAULT_SYNTHETIC_LOOP_WEIGHT,
convergenceThreshold: 1e-7, convergenceThreshold: DEFAULT_CONVERGENCE_THRESHOLD,
maxIterations: 255, maxIterations: DEFAULT_MAX_ITERATIONS,
totalScore: 1000, totalScore: 1000,
totalScoreNodePrefix: NodeAddress.empty, totalScoreNodePrefix: NodeAddress.empty,
}; };

View File

@ -70,6 +70,8 @@ export type PagerankConvergenceReport = {|
|}; |};
export const DEFAULT_SYNTHETIC_LOOP_WEIGHT = 1e-3; 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"}; const COMPAT_INFO = {type: "sourcecred/pagerankGraph", version: "0.1.0"};