Skip to content

Commit

Permalink
Merge pull request #64 from ciena-blueplanet/Issue62
Browse files Browse the repository at this point in the history
Address dependency management issues
  • Loading branch information
notmessenger committed Jan 2, 2018
2 parents a8c863a + 1a86264 commit 4718d47
Show file tree
Hide file tree
Showing 24 changed files with 346 additions and 357 deletions.
1 change: 1 addition & 0 deletions .remarkignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CHANGELOG.md
13 changes: 10 additions & 3 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@ The MIT License (MIT)

Copyright (c) 2017

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18 changes: 0 additions & 18 deletions blueprints/ember-graphlib/index.js

This file was deleted.

6 changes: 1 addition & 5 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
const EmberAddon = require('ember-cli/lib/broccoli/ember-addon')

module.exports = function (defaults) {
var app = new EmberAddon(defaults, {
'ember-cli-mocha': {
useLintTree: false
}
})
const app = new EmberAddon(defaults, {})

return app.toTree()
}
30 changes: 17 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"lint": "lint-all-the-things",
"start": "ember server",
"test": "npm run lint && npm run test-addon",
"test-addon": "EMBER_TRY_SCENARIO=${EMBER_TRY_SCENARIO:=ember-default} && ember try:one $EMBER_TRY_SCENARIO --- COVERAGE=true ember test"
"test-addon": "EMBER_TRY_SCENARIO=${EMBER_TRY_SCENARIO:=ember-default} && ember try:one $EMBER_TRY_SCENARIO --- ember test"
},
"repository": {
"type": "git",
Expand All @@ -25,24 +25,28 @@
"devDependencies": {
"bower": "^1.8.2",
"broccoli-asset-rev": "^2.4.5",
"ciena-graphlib": "^1.0.1",
"chai-jquery": "^2.0.0",
"ember-cli": "2.12.3",
"ember-cli-chai": "^0.3.2",
"ember-cli-chai": "0.4.3",
"ember-cli-dependency-checker": "^1.3.0",
"ember-cli-htmlbars": "^1.1.1",
"ember-cli-htmlbars-inline-precompile": "^0.3.6",
"ember-cli-htmlbars-inline-precompile": "0.3.12",
"ember-cli-inject-live-reload": "^1.4.1",
"ember-cli-mocha": "0.13.2",
"ember-cli-mocha": "0.14.4",
"ember-cli-shims": "^1.0.2",
"ember-cli-uglify": "^1.2.0",
"ember-disable-prototype-extensions": "^1.1.0",
"ember-export-application-global": "^1.0.5",
"ember-frost-test": "^4.0.0",
"ember-hook": "1.4.2",
"ember-load-initializers": "^0.6.0",
"ember-lodash-shim": "^2.0.0",
"ember-lodash-shim": "^2.0.7",
"ember-resolver": "^2.0.3",
"ember-sinon": "^0.7.0",
"ember-source": "~2.12.0",
"ember-test-utils": "^1.11.0",
"loader.js": "^4.2.3"
"ember-test-utils": "^8.0.0",
"loader.js": "^4.2.3",
"sinon-chai": "^2.14.0"
},
"keywords": [
"algorithm",
Expand All @@ -55,12 +59,12 @@
"undirected"
],
"dependencies": {
"broccoli-funnel": "^1.0.0",
"broccoli-merge-trees": "^1.0.0",
"ember-cli-babel": "^5.1.7",
"npm-install-security-check": "^1.0.2"
"broccoli-funnel": "^2.0.1",
"broccoli-merge-trees": "^2.0.0",
"ciena-graphlib": "^1.0.8",
"ember-cli-babel": "^5.1.7"
},
"ember-addon": {
"configPath": "tests/dummy/config"
}
}
}
2 changes: 1 addition & 1 deletion testem.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-env node */
var Reporter = require('ember-test-utils/reporter')
const Reporter = require('ember-test-utils/reporter')

module.exports = {
disable_watching: true,
Expand Down
2 changes: 1 addition & 1 deletion tests/dummy/config/environment.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-env node */
module.exports = function (environment) {
var ENV = {
const ENV = {
modulePrefix: 'dummy',
environment: environment,
rootURL: '/',
Expand Down
3 changes: 1 addition & 2 deletions tests/test-helper.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {setResolver} from 'ember-mocha'

import resolver from './helpers/resolver'
import {setResolver} from 'ember-mocha'

setResolver(resolver)
20 changes: 10 additions & 10 deletions tests/unit/alg/all-shortest-paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ exports.tests = tests

function tests (sp) {
describe('allShortestPaths', function () {
it('returns 0 for the node itself', function () {
var g = new Graph()
it('should return 0 for the node itself', function () {
let g = new Graph()
g.setNode('a')
expect(sp(g)).to.eql({a: {a: {distance: 0}}})
})

it('returns the distance and path from all nodes to other nodes', function () {
var g = new Graph()
it('should return the distance and path from all nodes to other nodes', function () {
let g = new Graph()
g.setEdge('a', 'b')
g.setEdge('b', 'c')
expect(sp(g)).to.eql({
Expand All @@ -35,8 +35,8 @@ function tests (sp) {
})
})

it('uses an optionally supplied weight function', function () {
var g = new Graph()
it('should use an optionally supplied weight function', function () {
let g = new Graph()
g.setEdge('a', 'b', 2)
g.setEdge('b', 'c', 3)

Expand All @@ -59,8 +59,8 @@ function tests (sp) {
})
})

it('uses an optionally supplied incident function', function () {
var g = new Graph()
it('should use an optionally supplied incident function', function () {
let g = new Graph()
g.setEdge('a', 'b')
g.setEdge('b', 'c')

Expand All @@ -83,8 +83,8 @@ function tests (sp) {
})
})

it('works with undirected graphs', function () {
var g = new Graph({directed: false})
it('should work with undirected graphs', function () {
let g = new Graph({directed: false})
g.setEdge('a', 'b', 1)
g.setEdge('b', 'c', 2)
g.setEdge('c', 'a', 4)
Expand Down
22 changes: 11 additions & 11 deletions tests/unit/alg/components-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,36 @@ import _ from 'lodash'
import {describe, it} from 'mocha'

describe('alg.components', function () {
it('returns an empty list for an empty graph', function () {
it('should return an empty list for an empty graph', function () {
expect(components(new Graph({directed: false}))).to.eql([])
})

it('returns singleton lists for unconnected nodes', function () {
var g = new Graph({directed: false})
it('should return singleton lists for unconnected nodes', function () {
let g = new Graph({directed: false})
g.setNode('a')
g.setNode('b')

var result = _.sortBy(components(g), function (arr) { return _.min(arr) })
const result = _.sortBy(components(g), function (arr) { return _.min(arr) })
expect(result).to.eql([['a'], ['b']])
})

it('returns a list of nodes in a component', function () {
var g = new Graph({directed: false})
it('should return a list of nodes in a component', function () {
let g = new Graph({directed: false})
g.setEdge('a', 'b')
g.setEdge('b', 'c')

var result = _.map(components(g), function (xs) { return _.sortBy(xs) })
const result = _.map(components(g), function (xs) { return _.sortBy(xs) })
expect(result).to.eql([['a', 'b', 'c']])
})

it('returns nodes connected by a neighbor relationship in a digraph', function () {
var g = new Graph()
it('should return nodes connected by a neighbor relationship in a digraph', function () {
let g = new Graph()
g.setPath(['a', 'b', 'c', 'a'])
g.setEdge('d', 'c')
g.setEdge('e', 'f')

var result = _.sortBy(_.map(components(g), function (xs) { return _.sortBy(xs) }),
'0')
const result = _.sortBy(_.map(components(g), function (xs) { return _.sortBy(xs) }),
'0')
expect(result).to.eql([['a', 'b', 'c', 'd'], ['e', 'f']])
})
})
4 changes: 2 additions & 2 deletions tests/unit/alg/dijkstra-all-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import allShortestPathsTest from './all-shortest-paths'
describe('alg.dijkstraAll', function () {
allShortestPathsTest.tests(dijkstraAll)

it('throws an Error if it encounters a negative edge weight', function () {
var g = new Graph()
it('should throw an Error if it encounters a negative edge weight', function () {
let g = new Graph()
g.setEdge('a', 'b', 1)
g.setEdge('a', 'c', -2)
g.setEdge('b', 'd', 3)
Expand Down
28 changes: 14 additions & 14 deletions tests/unit/alg/dijkstra-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ const {dijkstra} = alg
import {describe, it} from 'mocha'

describe('alg.dijkstra', function () {
it('assigns distance 0 for the source node', function () {
var g = new Graph()
it('should assign distance 0 for the source node', function () {
let g = new Graph()
g.setNode('source')
expect(dijkstra(g, 'source')).to.eql({source: {distance: 0}})
})

it('returns Number.POSITIVE_INFINITY for unconnected nodes', function () {
var g = new Graph()
it('should return Number.POSITIVE_INFINITY for unconnected nodes', function () {
let g = new Graph()
g.setNode('a')
g.setNode('b')
expect(dijkstra(g, 'a')).to.eql({
Expand All @@ -20,8 +20,8 @@ describe('alg.dijkstra', function () {
})
})

it('returns the distance and path from the source node to other nodes', function () {
var g = new Graph()
it('should return the distance and path from the source node to other nodes', function () {
let g = new Graph()
g.setPath(['a', 'b', 'c'])
g.setEdge('b', 'd')
expect(dijkstra(g, 'a')).to.eql({
Expand All @@ -32,8 +32,8 @@ describe('alg.dijkstra', function () {
})
})

it('works for undirected graphs', function () {
var g = new Graph({directed: false})
it('should work for undirected graphs', function () {
let g = new Graph({directed: false})
g.setPath(['a', 'b', 'c'])
g.setEdge('b', 'd')
expect(dijkstra(g, 'a')).to.eql({
Expand All @@ -44,8 +44,8 @@ describe('alg.dijkstra', function () {
})
})

it('uses an optionally supplied weight function', function () {
var g = new Graph()
it('should use an optionally supplied weight function', function () {
let g = new Graph()
g.setEdge('a', 'b', 1)
g.setEdge('a', 'c', 2)
g.setEdge('b', 'd', 3)
Expand All @@ -59,8 +59,8 @@ describe('alg.dijkstra', function () {
})
})

it('uses an optionally supplied edge function', function () {
var g = new Graph()
it('should use an optionally supplied edge function', function () {
let g = new Graph()
g.setPath(['a', 'c', 'd'])
g.setEdge('b', 'c')

Expand All @@ -72,8 +72,8 @@ describe('alg.dijkstra', function () {
})
})

it('throws an Error if it encounters a negative edge weight', function () {
var g = new Graph()
it('should throw an Error if it encounters a negative edge weight', function () {
let g = new Graph()
g.setEdge('a', 'b', 1)
g.setEdge('a', 'c', -2)
g.setEdge('b', 'd', 3)
Expand Down
22 changes: 11 additions & 11 deletions tests/unit/alg/find-cycles-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,36 @@ import _ from 'lodash'
import {describe, it} from 'mocha'

describe('alg.findCycles', function () {
it('returns an empty array for an empty graph', function () {
it('should return an empty array for an empty graph', function () {
expect(findCycles(new Graph())).to.eql([])
})

it('returns an empty array if the graph has no cycles', function () {
var g = new Graph()
it('should return an empty array if the graph has no cycles', function () {
let g = new Graph()
g.setPath(['a', 'b', 'c'])
expect(findCycles(g)).to.eql([])
})

it('returns a single entry for a cycle of 1 node', function () {
var g = new Graph()
it('should return a single entry for a cycle of 1 node', function () {
let g = new Graph()
g.setPath(['a', 'a'])
expect(sort(findCycles(g))).to.eql([['a']])
})

it('returns a single entry for a cycle of 2 nodes', function () {
var g = new Graph()
it('should return a single entry for a cycle of 2 nodes', function () {
let g = new Graph()
g.setPath(['a', 'b', 'a'])
expect(sort(findCycles(g))).to.eql([['a', 'b']])
})

it('returns a single entry for a triangle', function () {
var g = new Graph()
it('should return a single entry for a triangle', function () {
let g = new Graph()
g.setPath(['a', 'b', 'c', 'a'])
expect(sort(findCycles(g))).to.eql([['a', 'b', 'c']])
})

it('returns multiple entries for multiple cycles', function () {
var g = new Graph()
it('should return multiple entries for multiple cycles', function () {
let g = new Graph()
g.setPath(['a', 'b', 'a'])
g.setPath(['c', 'd', 'e', 'c'])
g.setPath(['f', 'g', 'g'])
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/alg/floyd-warshall-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import allShortestPathsTest from './all-shortest-paths'
describe('alg.floydWarshall', function () {
allShortestPathsTest.tests(floydWarshall)

it('handles negative weights', function () {
var g = new Graph()
it('should handle negative weights', function () {
let g = new Graph()
g.setEdge('a', 'b', 1)
g.setEdge('a', 'c', -2)
g.setEdge('b', 'd', 3)
Expand Down Expand Up @@ -43,8 +43,8 @@ describe('alg.floydWarshall', function () {
})
})

it('does include negative weight self edges', function () {
var g = new Graph()
it('should include negative weight self edges', function () {
let g = new Graph()
g.setEdge('a', 'a', -1)

// In the case of a negative cycle the distance is not well-defined beyond
Expand Down

0 comments on commit 4718d47

Please sign in to comment.