mirror of
https://github.com/status-im/sourcecred.git
synced 2025-02-11 03:56:41 +00:00
cleanup: remove unused field on ScoredConnection (#994)
This resolves an outstanding TODO in pagerankNodeDecomposition to remove the unused sourceScore field. I have removed it, and it was indeed unused. Test plan: `yarn test` passes.
This commit is contained in:
parent
beccac822f
commit
8666f9ac1a
@ -19,7 +19,6 @@ Map {
|
|||||||
},
|
},
|
||||||
"connectionScore": 0.1102941261444197,
|
"connectionScore": 0.1102941261444197,
|
||||||
"source": "NodeAddress[\\"sink\\"]",
|
"source": "NodeAddress[\\"sink\\"]",
|
||||||
"sourceScore": 0.5882353394369051,
|
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"connection": Object {
|
"connection": Object {
|
||||||
@ -35,7 +34,6 @@ Map {
|
|||||||
},
|
},
|
||||||
"connectionScore": 0.066176427533429,
|
"connectionScore": 0.066176427533429,
|
||||||
"source": "NodeAddress[\\"n2\\"]",
|
"source": "NodeAddress[\\"n2\\"]",
|
||||||
"sourceScore": 0.22058809177809668,
|
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"connection": Object {
|
"connection": Object {
|
||||||
@ -46,7 +44,6 @@ Map {
|
|||||||
},
|
},
|
||||||
"connectionScore": 0.014705889906538334,
|
"connectionScore": 0.014705889906538334,
|
||||||
"source": "NodeAddress[\\"n1\\"]",
|
"source": "NodeAddress[\\"n1\\"]",
|
||||||
"sourceScore": 0.19117656878499834,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -67,7 +64,6 @@ Map {
|
|||||||
},
|
},
|
||||||
"connectionScore": 0.1102941261444197,
|
"connectionScore": 0.1102941261444197,
|
||||||
"source": "NodeAddress[\\"sink\\"]",
|
"source": "NodeAddress[\\"sink\\"]",
|
||||||
"sourceScore": 0.5882353394369051,
|
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"connection": Object {
|
"connection": Object {
|
||||||
@ -83,7 +79,6 @@ Map {
|
|||||||
},
|
},
|
||||||
"connectionScore": 0.08823533943923001,
|
"connectionScore": 0.08823533943923001,
|
||||||
"source": "NodeAddress[\\"n1\\"]",
|
"source": "NodeAddress[\\"n1\\"]",
|
||||||
"sourceScore": 0.19117656878499834,
|
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"connection": Object {
|
"connection": Object {
|
||||||
@ -94,7 +89,6 @@ Map {
|
|||||||
},
|
},
|
||||||
"connectionScore": 0.02205880917780967,
|
"connectionScore": 0.02205880917780967,
|
||||||
"source": "NodeAddress[\\"n2\\"]",
|
"source": "NodeAddress[\\"n2\\"]",
|
||||||
"sourceScore": 0.22058809177809668,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -115,7 +109,6 @@ Map {
|
|||||||
},
|
},
|
||||||
"connectionScore": 0.2205882522888394,
|
"connectionScore": 0.2205882522888394,
|
||||||
"source": "NodeAddress[\\"sink\\"]",
|
"source": "NodeAddress[\\"sink\\"]",
|
||||||
"sourceScore": 0.5882353394369051,
|
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"connection": Object {
|
"connection": Object {
|
||||||
@ -131,7 +124,6 @@ Map {
|
|||||||
},
|
},
|
||||||
"connectionScore": 0.132352855066858,
|
"connectionScore": 0.132352855066858,
|
||||||
"source": "NodeAddress[\\"n2\\"]",
|
"source": "NodeAddress[\\"n2\\"]",
|
||||||
"sourceScore": 0.22058809177809668,
|
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"connection": Object {
|
"connection": Object {
|
||||||
@ -147,7 +139,6 @@ Map {
|
|||||||
},
|
},
|
||||||
"connectionScore": 0.1102941261444197,
|
"connectionScore": 0.1102941261444197,
|
||||||
"source": "NodeAddress[\\"sink\\"]",
|
"source": "NodeAddress[\\"sink\\"]",
|
||||||
"sourceScore": 0.5882353394369051,
|
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"connection": Object {
|
"connection": Object {
|
||||||
@ -163,7 +154,6 @@ Map {
|
|||||||
},
|
},
|
||||||
"connectionScore": 0.08823533943923001,
|
"connectionScore": 0.08823533943923001,
|
||||||
"source": "NodeAddress[\\"n1\\"]",
|
"source": "NodeAddress[\\"n1\\"]",
|
||||||
"sourceScore": 0.19117656878499834,
|
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"connection": Object {
|
"connection": Object {
|
||||||
@ -174,7 +164,6 @@ Map {
|
|||||||
},
|
},
|
||||||
"connectionScore": 0.03676470871480657,
|
"connectionScore": 0.03676470871480657,
|
||||||
"source": "NodeAddress[\\"sink\\"]",
|
"source": "NodeAddress[\\"sink\\"]",
|
||||||
"sourceScore": 0.5882353394369051,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -15,8 +15,6 @@ import * as NullUtil from "../util/null";
|
|||||||
export type ScoredConnection = {|
|
export type ScoredConnection = {|
|
||||||
+connection: Connection,
|
+connection: Connection,
|
||||||
+source: NodeAddressT,
|
+source: NodeAddressT,
|
||||||
// TODO(@decentralion): Consider removing this unused field
|
|
||||||
+sourceScore: number,
|
|
||||||
+connectionScore: number,
|
+connectionScore: number,
|
||||||
|};
|
|};
|
||||||
|
|
||||||
@ -42,7 +40,7 @@ export function decompose(
|
|||||||
const source = adjacencySource(target, connection.adjacency);
|
const source = adjacencySource(target, connection.adjacency);
|
||||||
const sourceScore = NullUtil.get(pr.get(source));
|
const sourceScore = NullUtil.get(pr.get(source));
|
||||||
const connectionScore = connection.weight * sourceScore;
|
const connectionScore = connection.weight * sourceScore;
|
||||||
return {connection, source, sourceScore, connectionScore};
|
return {connection, source, connectionScore};
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
(x) => -x.connectionScore,
|
(x) => -x.connectionScore,
|
||||||
|
@ -22,13 +22,12 @@ function formatDecomposition(d) {
|
|||||||
{
|
{
|
||||||
score,
|
score,
|
||||||
scoredConnections: scoredConnections.map(
|
scoredConnections: scoredConnections.map(
|
||||||
({connection, source, sourceScore, connectionScore}) => ({
|
({connection, source, connectionScore}) => ({
|
||||||
connection: {
|
connection: {
|
||||||
adjacency: formatAdjacency(connection.adjacency),
|
adjacency: formatAdjacency(connection.adjacency),
|
||||||
weight: connection.weight,
|
weight: connection.weight,
|
||||||
},
|
},
|
||||||
source: NodeAddress.toString(source),
|
source: NodeAddress.toString(source),
|
||||||
sourceScore,
|
|
||||||
connectionScore,
|
connectionScore,
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
@ -117,31 +117,26 @@ describe("explorer/pagerankTable/aggregate", () => {
|
|||||||
loop5: {
|
loop5: {
|
||||||
connection: connections.loop5,
|
connection: connections.loop5,
|
||||||
source: nodes.root,
|
source: nodes.root,
|
||||||
sourceScore: 0.2,
|
|
||||||
connectionScore: 5,
|
connectionScore: 5,
|
||||||
},
|
},
|
||||||
rfz4: {
|
rfz4: {
|
||||||
connection: connections.rfz4,
|
connection: connections.rfz4,
|
||||||
source: nodes.zap,
|
source: nodes.zap,
|
||||||
sourceScore: 0.2,
|
|
||||||
connectionScore: 4,
|
connectionScore: 4,
|
||||||
},
|
},
|
||||||
kfr3: {
|
kfr3: {
|
||||||
connection: connections.kfr3,
|
connection: connections.kfr3,
|
||||||
source: nodes.kif,
|
source: nodes.kif,
|
||||||
sourceScore: 0.2,
|
|
||||||
connectionScore: 3,
|
connectionScore: 3,
|
||||||
},
|
},
|
||||||
rbk2: {
|
rbk2: {
|
||||||
connection: connections.rbk2,
|
connection: connections.rbk2,
|
||||||
source: nodes.kif,
|
source: nodes.kif,
|
||||||
sourceScore: 0.2,
|
|
||||||
connectionScore: 2,
|
connectionScore: 2,
|
||||||
},
|
},
|
||||||
rfk1: {
|
rfk1: {
|
||||||
connection: connections.rfk1,
|
connection: connections.rfk1,
|
||||||
source: nodes.kif,
|
source: nodes.kif,
|
||||||
sourceScore: 0.2,
|
|
||||||
connectionScore: 1,
|
connectionScore: 1,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user