Skip to content

Commit

Permalink
add project for SSSP with Bellman-Ford implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
armcknight committed Jun 5, 2016
1 parent 495303b commit dd3ba8d
Show file tree
Hide file tree
Showing 15 changed files with 1,059 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,26 @@ osx_image: xcode7.3

script:

- xcodebuild test -project ./All-Pairs\ Shortest\ Paths/APSP/APSP.xcodeproj -scheme APSPTests
- xcodebuild test -project ./Array2D/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./AVL\ Tree/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Binary\ Search/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Binary\ Search\ Tree/Solution\ 1/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Bloom\ Filter/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Breadth-First\ Search/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Bucket\ Sort/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Heap/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Heap\ Sort/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Insertion\ Sort/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./K-Means/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Linked\ List/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Longest\ Common\ Subsequence/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Priority\ Queue/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Queue/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Quicksort/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Run-Length\ Encoding/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Select\ Minimum\ Maximum/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Selection\ Sort/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Shell\ Sort/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Stack/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Longest\ Common\ Subsequence/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Bucket\ Sort/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./All-Pairs\ Shortest\ Paths/APSP/APSP.xcodeproj -scheme APSPTests
- xcodebuild test -project ./Single-Source\ Shortest\ Paths\ \(Weighted\)/SSSP.xcodeproj -scheme SSSPTests
- xcodebuild test -project ./Stack/Tests/Tests.xcodeproj -scheme Tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import Graph
import SSSP

let graph = AdjacencyMatrixGraph<String>()
let s = graph.createVertex("s")
let t = graph.createVertex("t")
let x = graph.createVertex("x")
let y = graph.createVertex("y")
let z = graph.createVertex("z")

graph.addDirectedEdge(s, to: t, withWeight: 6)
graph.addDirectedEdge(s, to: y, withWeight: 7)

graph.addDirectedEdge(t, to: x, withWeight: 5)
graph.addDirectedEdge(t, to: y, withWeight: 8)
graph.addDirectedEdge(t, to: z, withWeight: -4)

graph.addDirectedEdge(x, to: t, withWeight: -2)

graph.addDirectedEdge(y, to: x, withWeight: -3)
graph.addDirectedEdge(y, to: z, withWeight: 9)

graph.addDirectedEdge(z, to: s, withWeight: 2)
graph.addDirectedEdge(z, to: x, withWeight: 7)

let result = BellmanFord<String>.apply(graph, source: s)!

let path = result.path(z, inGraph: graph)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='osx'>
<timeline fileName='timeline.xctimeline'/>
</playground>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit dd3ba8d

Please sign in to comment.