Skip to content

Commit

Permalink
Merge pull request #167 from sebleier/master
Browse files Browse the repository at this point in the history
Add quotes around object attributes that are also keywords to some js pa...
  • Loading branch information
cpettitt committed Dec 17, 2014
2 parents 63631dd + 15d94e9 commit f5dcd8b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions lib/greedy-fas.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function removeNode(g, buckets, zeroIdx, entry, collectPredecessors) {
var weight = g.edge(edge),
w = edge.w,
wEntry = g.node(w);
wEntry.in -= weight;
wEntry["in"] -= weight;
assignBucket(buckets, zeroIdx, wEntry);
});

Expand All @@ -83,7 +83,7 @@ function buildState(g, weightFn) {
maxOut = 0;

_.each(g.nodes(), function(v) {
fasGraph.setNode(v, { v: v, in: 0, out: 0 });
fasGraph.setNode(v, { v: v, "in": 0, out: 0 });
});

// Aggregate weights on nodes, but also sum the weights across multi-edges
Expand All @@ -94,7 +94,7 @@ function buildState(g, weightFn) {
edgeWeight = prevWeight + weight;
fasGraph.setEdge(e.v, e.w, edgeWeight);
maxOut = Math.max(maxOut, fasGraph.node(e.v).out += weight);
maxIn = Math.max(maxIn, fasGraph.node(e.w).in += weight);
maxIn = Math.max(maxIn, fasGraph.node(e.w)["in"] += weight);
});

var buckets = _.range(maxOut + maxIn + 3).map(function() { return new List(); });
Expand All @@ -110,9 +110,9 @@ function buildState(g, weightFn) {
function assignBucket(buckets, zeroIdx, entry) {
if (!entry.out) {
buckets[0].enqueue(entry);
} else if (!entry.in) {
} else if (!entry["in"]) {
buckets[buckets.length - 1].enqueue(entry);
} else {
buckets[entry.out - entry.in + zeroIdx].enqueue(entry);
buckets[entry.out - entry["in"] + zeroIdx].enqueue(entry);
}
}
6 changes: 3 additions & 3 deletions lib/order/resolve-conflicts.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function resolveConflicts(entries, cg) {
_.each(entries, function(entry, i) {
var tmp = mappedEntries[entry.v] = {
indegree: 0,
in: [],
"in": [],
out: [],
vs: [entry.v],
i: i
Expand Down Expand Up @@ -79,7 +79,7 @@ function doResolveConflicts(sourceSet) {

function handleOut(vEntry) {
return function(wEntry) {
wEntry.in.push(vEntry);
wEntry["in"].push(vEntry);
if (--wEntry.indegree === 0) {
sourceSet.push(wEntry);
}
Expand All @@ -89,7 +89,7 @@ function doResolveConflicts(sourceSet) {
while (sourceSet.length) {
var entry = sourceSet.pop();
entries.push(entry);
_.each(entry.in.reverse(), handleIn(entry));
_.each(entry["in"].reverse(), handleIn(entry));
_.each(entry.out, handleOut(entry));
}

Expand Down

0 comments on commit f5dcd8b

Please sign in to comment.