diff --git a/src/core/attribution/__snapshots__/pagerankNodeDecomposition.test.js.snap b/src/analysis/__snapshots__/pagerankNodeDecomposition.test.js.snap similarity index 97% rename from src/core/attribution/__snapshots__/pagerankNodeDecomposition.test.js.snap rename to src/analysis/__snapshots__/pagerankNodeDecomposition.test.js.snap index d7d495f..7a8d101 100644 --- a/src/core/attribution/__snapshots__/pagerankNodeDecomposition.test.js.snap +++ b/src/analysis/__snapshots__/pagerankNodeDecomposition.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`core/attribution/pagerankNodeDecomposition decompose has the expected output on a simple asymmetric chain 1`] = ` +exports[`analysis/pagerankNodeDecomposition decompose has the expected output on a simple asymmetric chain 1`] = ` Map { "NodeAddress[\\"n1\\"]" => Object { "score": 0.19117656878499834, diff --git a/src/core/attribution/nodeScore.js b/src/analysis/nodeScore.js similarity index 92% rename from src/core/attribution/nodeScore.js rename to src/analysis/nodeScore.js index 1368808..347e2f7 100644 --- a/src/core/attribution/nodeScore.js +++ b/src/analysis/nodeScore.js @@ -1,7 +1,7 @@ // @flow -import {NodeAddress, type NodeAddressT} from "../graph"; -import type {NodeDistribution} from "./graphToMarkovChain"; +import {NodeAddress, type NodeAddressT} from "../core/graph"; +import type {NodeDistribution} from "../core/attribution/graphToMarkovChain"; export type NodeScore = Map; diff --git a/src/core/attribution/nodeScore.test.js b/src/analysis/nodeScore.test.js similarity index 97% rename from src/core/attribution/nodeScore.test.js rename to src/analysis/nodeScore.test.js index c91b805..696327f 100644 --- a/src/core/attribution/nodeScore.test.js +++ b/src/analysis/nodeScore.test.js @@ -1,8 +1,9 @@ // @flow -import {NodeAddress} from "../graph"; +import {NodeAddress} from "../core/graph"; import {scoreByMaximumProbability, scoreByConstantTotal} from "./nodeScore"; -describe("core/attribution/nodeScore", () => { + +describe("analysis/nodeScore", () => { const foo = NodeAddress.fromParts(["foo"]); const bar = NodeAddress.fromParts(["bar"]); const zod = NodeAddress.fromParts(["zod"]); diff --git a/src/core/attribution/pagerank.js b/src/analysis/pagerank.js similarity index 86% rename from src/core/attribution/pagerank.js rename to src/analysis/pagerank.js index da8feb2..b517d8a 100644 --- a/src/core/attribution/pagerank.js +++ b/src/analysis/pagerank.js @@ -1,12 +1,12 @@ // @flow -import {type Edge, Graph, NodeAddress, type NodeAddressT} from "../graph"; +import {type Edge, Graph, NodeAddress, type NodeAddressT} from "../core/graph"; import { distributionToNodeDistribution, createConnections, createOrderedSparseMarkovChain, type EdgeWeight, -} from "./graphToMarkovChain"; +} from "../core/attribution/graphToMarkovChain"; import { decompose, type PagerankNodeDecomposition, @@ -14,9 +14,9 @@ import { import {scoreByConstantTotal} from "./nodeScore"; -import {findStationaryDistribution} from "./markovChain"; +import {findStationaryDistribution} from "../core/attribution/markovChain"; -export type {NodeDistribution} from "./graphToMarkovChain"; +export type {NodeDistribution} from "../core/attribution/graphToMarkovChain"; export type {PagerankNodeDecomposition} from "./pagerankNodeDecomposition"; export type PagerankOptions = {| +selfLoopWeight?: number, @@ -29,7 +29,7 @@ export type PagerankOptions = {| +totalScoreNodePrefix?: NodeAddressT, |}; -export type {EdgeWeight} from "./graphToMarkovChain"; +export type {EdgeWeight} from "../core/attribution/graphToMarkovChain"; export type EdgeEvaluator = (Edge) => EdgeWeight; function defaultOptions(): PagerankOptions { diff --git a/src/core/attribution/pagerankNodeDecomposition.js b/src/analysis/pagerankNodeDecomposition.js similarity index 89% rename from src/core/attribution/pagerankNodeDecomposition.js rename to src/analysis/pagerankNodeDecomposition.js index e333377..eb16949 100644 --- a/src/core/attribution/pagerankNodeDecomposition.js +++ b/src/analysis/pagerankNodeDecomposition.js @@ -2,15 +2,15 @@ import sortBy from "lodash.sortby"; -import type {NodeAddressT} from "../graph"; +import type {NodeAddressT} from "../core/graph"; import { type Connection, type NodeToConnections, adjacencySource, -} from "./graphToMarkovChain"; +} from "../core/attribution/graphToMarkovChain"; import type {NodeScore} from "./nodeScore"; -import * as MapUtil from "../../util/map"; -import * as NullUtil from "../../util/null"; +import * as MapUtil from "../util/map"; +import * as NullUtil from "../util/null"; export type ScoredConnection = {| +connection: Connection, diff --git a/src/core/attribution/pagerankNodeDecomposition.test.js b/src/analysis/pagerankNodeDecomposition.test.js similarity index 94% rename from src/core/attribution/pagerankNodeDecomposition.test.js rename to src/analysis/pagerankNodeDecomposition.test.js index 7a53edd..08e3c0b 100644 --- a/src/core/attribution/pagerankNodeDecomposition.test.js +++ b/src/analysis/pagerankNodeDecomposition.test.js @@ -1,16 +1,16 @@ // @flow -import {EdgeAddress, Graph, NodeAddress, edgeToStrings} from "../graph"; +import {EdgeAddress, Graph, NodeAddress, edgeToStrings} from "../core/graph"; import { distributionToNodeDistribution, createConnections, createOrderedSparseMarkovChain, -} from "./graphToMarkovChain"; -import {findStationaryDistribution} from "./markovChain"; +} from "../core/attribution/graphToMarkovChain"; +import {findStationaryDistribution} from "../core/attribution/markovChain"; import {decompose} from "./pagerankNodeDecomposition"; -import * as MapUtil from "../../util/map"; +import * as MapUtil from "../util/map"; -import {advancedGraph} from "../graphTestUtil"; +import {advancedGraph} from "../core/graphTestUtil"; /** * Format a decomposition to be shown in a snapshot. This converts @@ -108,7 +108,7 @@ function validateDecomposition(decomposition) { } } -describe("core/attribution/pagerankNodeDecomposition", () => { +describe("analysis/pagerankNodeDecomposition", () => { describe("decompose", () => { it("has the expected output on a simple asymmetric chain", async () => { const n1 = NodeAddress.fromParts(["n1"]); diff --git a/src/app/credExplorer/pagerankTable/Connection.js b/src/app/credExplorer/pagerankTable/Connection.js index 207ba7e..ecedba9 100644 --- a/src/app/credExplorer/pagerankTable/Connection.js +++ b/src/app/credExplorer/pagerankTable/Connection.js @@ -5,7 +5,7 @@ import * as NullUtil from "../../../util/null"; import type {NodeAddressT} from "../../../core/graph"; import type {Connection} from "../../../core/attribution/graphToMarkovChain"; -import type {ScoredConnection} from "../../../core/attribution/pagerankNodeDecomposition"; +import type {ScoredConnection} from "../../../analysis/pagerankNodeDecomposition"; import {DynamicAdapterSet} from "../../adapters/adapterSet"; import {TableRow} from "./TableRow"; import {NodeRow} from "./Node"; diff --git a/src/app/credExplorer/pagerankTable/Table.js b/src/app/credExplorer/pagerankTable/Table.js index cd7a82f..853d866 100644 --- a/src/app/credExplorer/pagerankTable/Table.js +++ b/src/app/credExplorer/pagerankTable/Table.js @@ -5,7 +5,7 @@ import sortBy from "lodash.sortby"; import * as NullUtil from "../../../util/null"; import {type NodeAddressT, NodeAddress} from "../../../core/graph"; -import type {PagerankNodeDecomposition} from "../../../core/attribution/pagerankNodeDecomposition"; +import type {PagerankNodeDecomposition} from "../../../analysis/pagerankNodeDecomposition"; import {DynamicAdapterSet} from "../../adapters/adapterSet"; import type {DynamicPluginAdapter} from "../../adapters/pluginAdapter"; import {FALLBACK_NAME} from "../../adapters/fallbackAdapter"; diff --git a/src/app/credExplorer/pagerankTable/aggregate.js b/src/app/credExplorer/pagerankTable/aggregate.js index c2594e0..47b5796 100644 --- a/src/app/credExplorer/pagerankTable/aggregate.js +++ b/src/app/credExplorer/pagerankTable/aggregate.js @@ -5,7 +5,7 @@ import stringify from "json-stable-stringify"; import * as MapUtil from "../../../util/map"; import {NodeTrie, EdgeTrie} from "../../../core/trie"; import type {NodeType, EdgeType} from "../../adapters/pluginAdapter"; -import type {ScoredConnection} from "../../../core/attribution/pagerankNodeDecomposition"; +import type {ScoredConnection} from "../../../analysis/pagerankNodeDecomposition"; // Sorted by descending `summary.score` export type FlatAggregations = $ReadOnlyArray; diff --git a/src/app/credExplorer/pagerankTable/shared.js b/src/app/credExplorer/pagerankTable/shared.js index 6d3fe5d..c9c0b97 100644 --- a/src/app/credExplorer/pagerankTable/shared.js +++ b/src/app/credExplorer/pagerankTable/shared.js @@ -9,7 +9,7 @@ import { import {DynamicAdapterSet} from "../../adapters/adapterSet"; -import type {PagerankNodeDecomposition} from "../../../core/attribution/pagerankNodeDecomposition"; +import type {PagerankNodeDecomposition} from "../../../analysis/pagerankNodeDecomposition"; export function nodeDescription( address: NodeAddressT, diff --git a/src/app/credExplorer/pagerankTable/sharedTestUtils.js b/src/app/credExplorer/pagerankTable/sharedTestUtils.js index b29256c..4063049 100644 --- a/src/app/credExplorer/pagerankTable/sharedTestUtils.js +++ b/src/app/credExplorer/pagerankTable/sharedTestUtils.js @@ -1,7 +1,7 @@ // @flow import {dynamicAdapterSet} from "../../adapters/demoAdapters"; -import {pagerank} from "../../../core/attribution/pagerank"; +import {pagerank} from "../../../analysis/pagerank"; import {defaultWeightsForAdapterSet} from "../weights/weights"; export const COLUMNS = () => ["Description", "", "Cred"]; diff --git a/src/app/credExplorer/state.js b/src/app/credExplorer/state.js index 3e8704f..963e943 100644 --- a/src/app/credExplorer/state.js +++ b/src/app/credExplorer/state.js @@ -5,12 +5,12 @@ import deepEqual from "lodash.isequal"; import {Graph, type NodeAddressT} from "../../core/graph"; import type {Assets} from "../../app/assets"; import type {RepoId} from "../../core/repoId"; -import {type EdgeEvaluator} from "../../core/attribution/pagerank"; +import {type EdgeEvaluator} from "../../analysis/pagerank"; import { type PagerankNodeDecomposition, type PagerankOptions, pagerank, -} from "../../core/attribution/pagerank"; +} from "../../analysis/pagerank"; import {StaticAdapterSet, DynamicAdapterSet} from "../adapters/adapterSet"; import type {WeightedTypes} from "./weights/weights"; diff --git a/src/app/credExplorer/state.test.js b/src/app/credExplorer/state.test.js index 9f04652..7e796eb 100644 --- a/src/app/credExplorer/state.test.js +++ b/src/app/credExplorer/state.test.js @@ -10,7 +10,7 @@ import { import {Graph, NodeAddress} from "../../core/graph"; import {Assets} from "../assets"; import {makeRepoId, type RepoId} from "../../core/repoId"; -import {type EdgeEvaluator} from "../../core/attribution/pagerank"; +import {type EdgeEvaluator} from "../../analysis/pagerank"; import { type WeightedTypes, defaultWeightsForAdapterSet, @@ -19,7 +19,7 @@ import {StaticAdapterSet, DynamicAdapterSet} from "../adapters/adapterSet"; import type { PagerankNodeDecomposition, PagerankOptions, -} from "../../core/attribution/pagerank"; +} from "../../analysis/pagerank"; import {staticAdapterSet} from "../adapters/demoAdapters"; describe("app/credExplorer/state", () => { diff --git a/src/app/credExplorer/weights/weightsToEdgeEvaluator.js b/src/app/credExplorer/weights/weightsToEdgeEvaluator.js index 15f2a2d..a7693c6 100644 --- a/src/app/credExplorer/weights/weightsToEdgeEvaluator.js +++ b/src/app/credExplorer/weights/weightsToEdgeEvaluator.js @@ -2,7 +2,7 @@ import type {Edge} from "../../../core/graph"; import type {WeightedTypes} from "./weights"; -import type {EdgeEvaluator} from "../../../core/attribution/pagerank"; +import type {EdgeEvaluator} from "../../../analysis/pagerank"; import {NodeTrie, EdgeTrie} from "../../../core/trie"; export function weightsToEdgeEvaluator(weights: WeightedTypes): EdgeEvaluator {