Content-Length: 406005 | pFad | http://github.com/davecom/SwiftGraph/commit/152baa75457e2ed90cf1614a307ebf7e68026915

A8 Rename edgeExists parameter to avoid ambiguity · davecom/SwiftGraph@152baa7 · GitHub
Skip to content

Commit 152baa7

Browse files
Rename edgeExists parameter to avoid ambiguity
1 parent 6d7de14 commit 152baa7

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

Sources/SwiftGraph/UnweightedGraph.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ extension Graph where E == UnweightedEdge {
106106
//github.com/ - parameter from: The index of the starting vertex of the edge.
107107
//github.com/ - parameter to: The index of the ending vertex of the edge.
108108
//github.com/ - returns: True if there is an edge from the starting vertex to the ending vertex.
109-
public func edgeExists(from: Int, to: Int) -> Bool {
110-
return edgeExists(E(u: from, v: to))
109+
public func edgeExists(fromIndex: Int, toIndex: Int) -> Bool {
110+
return edgeExists(E(u: fromIndex, v: toIndex))
111111
}
112112

113113
//github.com/ Check whether there is an edge from one vertex to another vertex.
@@ -121,7 +121,7 @@ extension Graph where E == UnweightedEdge {
121121
public func edgeExists(from: V, to: V) -> Bool {
122122
if let u = indexOfVertex(from) {
123123
if let v = indexOfVertex(to) {
124-
return edgeExists(from: u, to: v)
124+
return edgeExists(fromIndex: u, toIndex: v)
125125
}
126126
}
127127
return false

Sources/SwiftGraph/WeightedGraph.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ extension Graph where E: WeightedEdgeProtocol {
7373
//github.com/ - parameter from: The index of the starting vertex of the edge.
7474
//github.com/ - parameter to: The index of the ending vertex of the edge.
7575
//github.com/ - returns: True if there is an edge from the starting vertex to the ending vertex.
76-
public func edgeExists(from: Int, to: Int, withWeight weight: W) -> Bool {
77-
return edgeExists(E(u: from, v: to, weight: weight))
76+
public func edgeExists(fromIndex: Int, toIndex: Int, withWeight weight: W) -> Bool {
77+
return edgeExists(E(u: fromIndex, v: toIndex, weight: weight))
7878
}
7979

8080
//github.com/ Check whether there is an edge from one vertex to another vertex with a specific weight.
@@ -88,7 +88,7 @@ extension Graph where E: WeightedEdgeProtocol {
8888
public func edgeExists(from: V, to: V, withWeight weight: W) -> Bool {
8989
if let u = indexOfVertex(from) {
9090
if let v = indexOfVertex(to) {
91-
return edgeExists(from: u, to: v, withWeight: weight)
91+
return edgeExists(fromIndex: u, toIndex: v, withWeight: weight)
9292
}
9393
}
9494
return false
@@ -99,8 +99,8 @@ extension Graph where E: WeightedEdgeProtocol {
9999
//github.com/ - parameter from: The index of the starting vertex of the edge.
100100
//github.com/ - parameter to: The index of the ending vertex of the edge.
101101
//github.com/ - returns: True if there is an edge from the starting vertex to the ending vertex.
102-
public func edgeExists(from: Int, to: Int) -> Bool {
103-
return edges[from].map({$0.v}).contains(to)
102+
public func edgeExists(fromIndex: Int, toIndex: Int) -> Bool {
103+
return edges[fromIndex].map({$0.v}).contains(toIndex)
104104
}
105105

106106
//github.com/ Check whether there is an edge from one vertex to another vertex.
@@ -114,7 +114,7 @@ extension Graph where E: WeightedEdgeProtocol {
114114
public func edgeExists(from: V, to: V) -> Bool {
115115
if let u = indexOfVertex(from) {
116116
if let v = indexOfVertex(to) {
117-
return edgeExists(from: u, to: v)
117+
return edgeExists(fromIndex: u, toIndex: v)
118118
}
119119
}
120120
return false

Tests/SwiftGraphTests/SwiftGraphTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class SwiftGraphTests: XCTestCase {
9292
graph.addEdge(from: "4", to: "5", directed: false)
9393

9494
graph.removeAllEdges(from: 2, to: 3, bidirectional: true)
95-
XCTAssertFalse(graph.edgeExists(from: 2, to: 3))
96-
XCTAssertFalse(graph.edgeExists(from: 3, to: 2))
95+
XCTAssertFalse(graph.edgeExists(fromIndex: 2, toIndex: 3))
96+
XCTAssertFalse(graph.edgeExists(fromIndex: 3, toIndex: 2))
9797
}
9898
}

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/davecom/SwiftGraph/commit/152baa75457e2ed90cf1614a307ebf7e68026915

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy