Skip to content

Commit 3c772f7

Browse files
committed
Formatted.
1 parent 500c6a0 commit 3c772f7

2 files changed

Lines changed: 28 additions & 18 deletions

File tree

QuadTree.Tests/Tests.SSSP.fs

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,30 @@ let ``Simple SSSP.`` () =
7373
let ``SSSP with recalculation`` () =
7474
let graph =
7575
let clist =
76-
Matrix.CoordinateList(5UL<nrows>, 5UL<ncols>,
77-
[
78-
0UL<rowindex>, 1UL<colindex>, 1.0
79-
1UL<rowindex>, 2UL<colindex>, 1.0
80-
2UL<rowindex>, 3UL<colindex>, 1.0
81-
2UL<rowindex>, 4UL<colindex>, 4.0
82-
3UL<rowindex>, 4UL<colindex>, 2.0
83-
0UL<rowindex>, 3UL<colindex>, 6.0
84-
])
76+
Matrix.CoordinateList(
77+
5UL<nrows>,
78+
5UL<ncols>,
79+
[ 0UL<rowindex>, 1UL<colindex>, 1.0
80+
1UL<rowindex>, 2UL<colindex>, 1.0
81+
2UL<rowindex>, 3UL<colindex>, 1.0
82+
2UL<rowindex>, 4UL<colindex>, 4.0
83+
3UL<rowindex>, 4UL<colindex>, 2.0
84+
0UL<rowindex>, 3UL<colindex>, 6.0 ]
85+
)
8586

8687
Matrix.fromCoordinateList clist
8788

8889
let expected =
89-
let clist = Vector.CoordinateList(5UL<dataLength>,[(0UL<index>,0.0); (1UL<index>,1.0);(2UL<index>,2.0);(3UL<index>,3.0);(4UL<index>,5.0)])
90+
let clist =
91+
Vector.CoordinateList(
92+
5UL<dataLength>,
93+
[ (0UL<index>, 0.0)
94+
(1UL<index>, 1.0)
95+
(2UL<index>, 2.0)
96+
(3UL<index>, 3.0)
97+
(4UL<index>, 5.0) ]
98+
)
99+
90100
Result.Success(Vector.fromCoordinateList clist)
91101

92102
let actual = Graph.SSSP.sssp graph 0UL

QuadTree/SSSP.fs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type Error<'t1, 't2> =
1010
let sssp graph (startVertex: uint64) =
1111
let op_add x y =
1212
match (x, y) with
13-
| Some(u), Some(v) -> Some(min u v)
13+
| Some(u), Some(v) -> Some(min u v)
1414
| Some(v), _
1515
| _, Some(v) -> Some(v)
1616
| _ -> None
@@ -19,7 +19,7 @@ let sssp graph (startVertex: uint64) =
1919
match (x, y) with
2020
| Some(u), Some(v) -> Some(u + v)
2121
| _ -> None
22-
22+
2323
let rec inner (frontier: Vector.SparseVector<_>) (visited: Vector.SparseVector<_>) =
2424
if frontier.nvals > 0UL<nvals> then
2525

@@ -28,9 +28,9 @@ let sssp graph (startVertex: uint64) =
2828
match new_frontier with
2929
| Result.Failure(e) -> Result.Failure(NewFrontierCalculationProblem(e))
3030
| Result.Success(new_frontier) ->
31-
let op_min x y =
32-
match (x,y) with
33-
| Some v, Some u -> if v < u then Some v else None
31+
let op_min x y =
32+
match (x, y) with
33+
| Some v, Some u -> if v < u then Some v else None
3434
| Some v, _ -> Some v
3535
| _ -> None
3636

@@ -45,11 +45,11 @@ let sssp graph (startVertex: uint64) =
4545
match visited with
4646
| Result.Failure(e) -> Result.Failure(VisitedCalculationProblem(e))
4747
| Result.Success(visited) -> inner frontier visited
48-
else
48+
else
4949
Result.Success visited
5050

51-
let frontier =
52-
Vector.CoordinateList((uint64 graph.ncols) * 1UL<Vector.dataLength>,[startVertex * 1UL<Vector.index>, 0.0])
51+
let frontier =
52+
Vector.CoordinateList((uint64 graph.ncols) * 1UL<Vector.dataLength>, [ startVertex * 1UL<Vector.index>, 0.0 ])
5353
|> Vector.fromCoordinateList
5454

5555
inner frontier frontier

0 commit comments

Comments
 (0)