MCPcopy Index your code
hub / github.com/clips/pattern / edges

Function edges

pattern/graph/graph.js:1206–1222  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

1204};
1205
1206function edges(path) {
1207 /* Returns a list of Edge objects for the given list of nodes.
1208 * It contains null where two successive nodes are not connected.
1209 */
1210 // For example, the distance (i.e., edge weight sum) of a path:
1211 // var w = 0;
1212 // var e = Graph.edges(path);
1213 // for (var i=0; i < e.length; i++) w += e[i].weight;
1214 if (path && path.length > 1) {
1215 var e = [];
1216 for (var i=0; i < path.length-1; i++) {
1217 e.push(path[i].links.edge(path[i+1]));
1218 }
1219 return e;
1220 }
1221 return [];
1222};
1223
1224/*--- GRAPH THEORY ---------------------------------------------------------------------------------*/
1225

Callers

nothing calls this directly

Calls 2

pushMethod · 0.45
edgeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…