Skip to content

Commit

Permalink
add credGraph.node and credGraph.scoringNodes
Browse files Browse the repository at this point in the history
  • Loading branch information
teamdandelion committed Feb 17, 2020
1 parent d3c24a0 commit 721606f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/core/credGraph.js
Expand Up @@ -67,6 +67,12 @@ export class CredGraph {
return srcCred * edge.transitionProbability;
}

node(addr: NodeAddressT): ?Node {
const node = this._mpg._nodes.get(addr);
if (node == null) return undefined;
return {...node, cred: this._cred(addr)};
}

*nodes(): Iterator<Node> {
for (const node of this._mpg.nodes()) {
yield {...node, cred: this._cred(node.address)};
Expand All @@ -79,6 +85,12 @@ export class CredGraph {
}
}

*scoringNodes(): Iterator<Node> {
for (const addr of this._mpg.scoringAddresses()) {
yield NullUtil.get(this.node(addr));
}
}

*inNeighbors(addr: NodeAddressT): Iterator<Edge> {
for (const edge of this._mpg.inNeighbors(addr)) {
yield {...edge, credFlow: this._credFlow(edge)};
Expand Down

0 comments on commit 721606f

Please sign in to comment.