Rename core/attribution to core/algorithm (#1631)

As part of my cleanup to make it easy to document and re-implement the
SourceCred algorithm, I want a place in core where we can consolidate
the js implementation. I'm renaming `core/attribution` to
`core/algorithm` to make this clearer.

Test plan: It's just a rename. `yarn test` passing is sufficient to
assure us of correctness.
This commit is contained in:
Dandelion Mané 2020-02-05 10:51:57 -08:00 committed by GitHub
parent e97a1209d0
commit 36264ed85b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 25 additions and 25 deletions

View File

@ -1,7 +1,7 @@
// @flow
import {NodeAddress, type NodeAddressT} from "../core/graph";
import type {NodeDistribution} from "../core/attribution/nodeDistribution";
import type {NodeDistribution} from "../core/algorithm/nodeDistribution";
export type NodeScore = Map<NodeAddressT, number>;

View File

@ -6,7 +6,7 @@ import {
createConnections,
createOrderedSparseMarkovChain,
type EdgeWeight,
} from "../core/attribution/graphToMarkovChain";
} from "../core/algorithm/graphToMarkovChain";
import {
decompose,
type PagerankNodeDecomposition,
@ -18,10 +18,10 @@ import {
findStationaryDistribution,
type PagerankParams,
type PagerankOptions as CorePagerankOptions,
} from "../core/attribution/markovChain";
import {uniformDistribution} from "../core/attribution/distribution";
} from "../core/algorithm/markovChain";
import {uniformDistribution} from "../core/algorithm/distribution";
export type {NodeDistribution} from "../core/attribution/nodeDistribution";
export type {NodeDistribution} from "../core/algorithm/nodeDistribution";
export type {PagerankNodeDecomposition} from "./pagerankNodeDecomposition";
export type FullPagerankOptions = {|
+selfLoopWeight: number,
@ -35,7 +35,7 @@ export type FullPagerankOptions = {|
|};
export type PagerankOptions = $Shape<FullPagerankOptions>;
export type {EdgeWeight} from "../core/attribution/graphToMarkovChain";
export type {EdgeWeight} from "../core/algorithm/graphToMarkovChain";
export type EdgeEvaluator = (Edge) => EdgeWeight;
export const DEFAULT_SYNTHETIC_LOOP_WEIGHT = 1e-3;

View File

@ -7,7 +7,7 @@ import {
type Connection,
type NodeToConnections,
adjacencySource,
} from "../core/attribution/graphToMarkovChain";
} from "../core/algorithm/graphToMarkovChain";
import type {NodeScore} from "./nodeScore";
import * as MapUtil from "../util/map";
import * as NullUtil from "../util/null";

View File

@ -5,12 +5,12 @@ import {
distributionToNodeDistribution,
createConnections,
createOrderedSparseMarkovChain,
} from "../core/attribution/graphToMarkovChain";
} from "../core/algorithm/graphToMarkovChain";
import {
findStationaryDistribution,
type PagerankParams,
} from "../core/attribution/markovChain";
import {uniformDistribution} from "../core/attribution/distribution";
} from "../core/algorithm/markovChain";
import {uniformDistribution} from "../core/algorithm/distribution";
import {
decompose,
type PagerankNodeDecomposition,

View File

@ -16,17 +16,17 @@ import {
type NodeWeightEvaluator,
type EdgeWeightEvaluator,
} from "../weightEvaluator";
import {weightedDistribution} from "../../core/attribution/nodeDistribution";
import {type Distribution} from "../../core/attribution/distribution";
import {weightedDistribution} from "../../core/algorithm/nodeDistribution";
import {type Distribution} from "../../core/algorithm/distribution";
import {
createOrderedSparseMarkovChain,
createConnections,
} from "../../core/attribution/graphToMarkovChain";
} from "../../core/algorithm/graphToMarkovChain";
import {
findStationaryDistribution,
type PagerankParams,
type SparseMarkovChain,
} from "../../core/attribution/markovChain";
} from "../../core/algorithm/markovChain";
/**
* Represents raw PageRank distributions on a graph over time.

View File

@ -9,8 +9,8 @@ import {
createConnections,
createOrderedSparseMarkovChain,
type EdgeWeight,
} from "../../core/attribution/graphToMarkovChain";
import {type SparseMarkovChain} from "../../core/attribution/markovChain";
} from "../../core/algorithm/graphToMarkovChain";
import {type SparseMarkovChain} from "../../core/algorithm/markovChain";
describe("src/analysis/timeline/timelinePagerank", () => {
describe("_timelineNodeWeights", () => {

View File

@ -12,8 +12,8 @@ import * as githubDeclaration from "../plugins/github/declaration";
import * as githubEdges from "../plugins/github/edges";
import * as githubNodes from "../plugins/github/nodes";
import * as graph from "../core/graph";
import * as graphToMarkovChain from "../core/attribution/graphToMarkovChain";
import * as markovChain from "../core/attribution/markovChain";
import * as graphToMarkovChain from "../core/algorithm/graphToMarkovChain";
import * as markovChain from "../core/algorithm/markovChain";
import * as timelineCred from "../analysis/timeline/timelineCred";
export default deepFreeze({
@ -24,7 +24,7 @@ export default deepFreeze({
},
core: {
address,
attribution: {
algorithm: {
markovChain,
graphToMarkovChain,
},

View File

@ -2,7 +2,7 @@
import {uniformDistribution, computeDelta} from "./distribution";
describe("core/attribution/distribution", () => {
describe("core/algorithm/distribution", () => {
describe("uniformDistribution", () => {
describe("errors for: ", () => {
[

View File

@ -14,7 +14,7 @@ import * as MapUtil from "../../util/map";
import {node, advancedGraph, edge} from "../graphTestUtil";
describe("core/attribution/graphToMarkovChain", () => {
describe("core/algorithm/graphToMarkovChain", () => {
const n1 = node("n1");
const n2 = node("n2");
const n3 = node("n3");

View File

@ -14,7 +14,7 @@ import {
type PagerankParams,
} from "./markovChain";
describe("core/attribution/markovChain", () => {
describe("core/algorithm/markovChain", () => {
/** A distribution that is 1 at the chosen index, and 0 elsewhere.*/
function singleIndexDistribution(size: number, index: number): Distribution {
if (!isFinite(size) || size !== Math.floor(size) || size <= 0) {

View File

@ -6,7 +6,7 @@ import {
distributionToNodeDistribution,
} from "./nodeDistribution";
describe("core/attribution/nodeDistribution", () => {
describe("core/algorithm/nodeDistribution", () => {
const n1 = NodeAddress.fromParts(["n1"]);
const n2 = NodeAddress.fromParts(["n2"]);

View File

@ -5,7 +5,7 @@ import * as NullUtil from "../../../util/null";
import {type PluginDeclaration} from "../../../analysis/pluginDeclaration";
import {type NodeAddressT, Graph} from "../../../core/graph";
import type {Connection} from "../../../core/attribution/graphToMarkovChain";
import type {Connection} from "../../../core/algorithm/graphToMarkovChain";
import type {ScoredConnection} from "../../../analysis/pagerankNodeDecomposition";
import {TableRow} from "./TableRow";
import {NodeRow} from "./Node";

View File

@ -4,7 +4,7 @@ import React from "react";
import {shallow} from "enzyme";
import * as NullUtil from "../../../util/null";
import type {Connection} from "../../../core/attribution/graphToMarkovChain";
import type {Connection} from "../../../core/algorithm/graphToMarkovChain";
import {ConnectionRowList, ConnectionRow, ConnectionView} from "./Connection";
import {example} from "./sharedTestUtils";
import {TableRow} from "./TableRow";