Update package to swift-tools 5.0
This commit is contained in:
parent
b55c0d8e96
commit
5369124c60
|
@ -1,4 +1,4 @@
|
|||
// swift-tools-version:4.2
|
||||
// swift-tools-version:5.0
|
||||
|
||||
import PackageDescription
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ extension Matrix where Element == Bool {
|
|||
for (offset, node) in nodes.enumerated() {
|
||||
if let adjacentNodes = adjacencyDictionary[node] {
|
||||
for adjacentNode in adjacentNodes {
|
||||
guard let adjacentIndex = nodes.index(of: adjacentNode) else {
|
||||
guard let adjacentIndex = nodes.firstIndex(of: adjacentNode) else {
|
||||
throw Error.indexNotFound(node: adjacentNode, nodes: nodes)
|
||||
}
|
||||
matrix[offset][adjacentIndex] = true
|
||||
|
|
|
@ -168,7 +168,7 @@ public class ElementaryCyclesSearch<Node> {
|
|||
}
|
||||
}
|
||||
|
||||
if let index = stack.index(of: v) {
|
||||
if let index = stack.firstIndex(of: v) {
|
||||
stack.remove(at: index)
|
||||
}
|
||||
return f
|
||||
|
|
|
@ -83,7 +83,7 @@ extension Vector where Element: Equatable {
|
|||
|
||||
@discardableResult
|
||||
func remove(element: Element) -> Bool {
|
||||
if let index = array.index(of: element) {
|
||||
if let index = array.firstIndex(of: element) {
|
||||
array.remove(at: -index.distance(to: 0))
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -31,10 +31,10 @@ final class AdjacencyMatrixShould: XCTestCase {
|
|||
"IT": ["FR"]]
|
||||
let nodes = AdjacencyMatrix.getNodes(graph: graph, sort: nil)
|
||||
let adjacencyMatrix = try! AdjacencyMatrix.getAdjacencyMatrix(nodes: nodes, adjacencyDictionary: graph)
|
||||
let es = nodes.index(of: "ES")!
|
||||
let pt = nodes.index(of: "PT")!
|
||||
let fr = nodes.index(of: "FR")!
|
||||
let it = nodes.index(of: "IT")!
|
||||
let es = nodes.firstIndex(of: "ES")!
|
||||
let pt = nodes.firstIndex(of: "PT")!
|
||||
let fr = nodes.firstIndex(of: "FR")!
|
||||
let it = nodes.firstIndex(of: "IT")!
|
||||
XCTAssertTrue(adjacencyMatrix[es][pt] ?? adjacencyMatrix[pt][es] ?? false)
|
||||
XCTAssertTrue(adjacencyMatrix[es][fr] ?? adjacencyMatrix[fr][es] ?? false)
|
||||
XCTAssertTrue(adjacencyMatrix[fr][it] ?? adjacencyMatrix[it][fr] ?? false)
|
||||
|
|
Loading…
Reference in New Issue