MCPcopy Index your code
hub / github.com/trekhleb/javascript-algorithms / getWeight

Method getWeight

src/data-structures/graph/Graph.js:135–139  ·  view source on GitHub ↗

* @return {number}

()

Source from the content-addressed store, hash-verified

133 * @return {number}
134 */
135 getWeight() {
136 return this.getAllEdges().reduce((weight, graphEdge) => {
137 return weight + graphEdge.weight;
138 }, 0);
139 }
140
141 /**
142 * Reverse all the edges in directed graph.

Callers 3

Graph.test.jsFile · 0.80
prim.test.jsFile · 0.80
kruskal.test.jsFile · 0.80

Calls 1

getAllEdgesMethod · 0.95

Tested by

no test coverage detected