Skip to content

Commit

Permalink
Merge ba2bf37 into c2dd9b8
Browse files Browse the repository at this point in the history
  • Loading branch information
cammanderson committed Apr 12, 2018
2 parents c2dd9b8 + ba2bf37 commit 46f5419
Show file tree
Hide file tree
Showing 12 changed files with 7,662 additions and 452 deletions.
148 changes: 113 additions & 35 deletions README.md

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions dist/graph.es6.js
Expand Up @@ -50,7 +50,7 @@ const _expectNoConnectedEdges = Symbol("expect no connected edges");
* [['Amsterdam', 'Leiden'], { distance: "40km" }] // edge
* );
*/
export default class Graph {
class Graph {

constructor(...parts) {
/* storage */
Expand Down Expand Up @@ -1253,7 +1253,7 @@ export default class Graph {
}
return JSON.stringify(result);
}

/**
* Deserialize a string returned from `.toJSON()`
* into a new `Graph` instance equal to the original.
Expand All @@ -1268,12 +1268,12 @@ export default class Graph {
static fromJSON(json) {
return new this(...JSON.parse(json));
}


////////////////////////////////
////////// Assertions //////////
////////////////////////////////

[_expectVertices](...keys) {
let missingVertices = keys.filter(k => !this.hasVertex(k));
if (missingVertices.length) { throw new Graph.VertexNotExistsError(...missingVertices) }
Expand Down Expand Up @@ -1471,3 +1471,5 @@ Graph.BranchlessCycleError = class BranchlessCycleError extends Graph.CycleError
this.message = `This graph contains a branch-less cycle: ${cycle}`;
}
};

module.exports = Graph;

0 comments on commit 46f5419

Please sign in to comment.