@@ -317,13 +317,13 @@ extension Graph {
317317 /// - parameter fromIndex: The index of the starting vertex.
318318 /// - parameter toIndex: The index of the ending vertex.
319319 /// - returns: `true` if a path exists
320- func pathExists( fromIndex: Int , toIndex: Int ) -> Bool {
320+ public func pathExists( fromIndex: Int , toIndex: Int ) -> Bool {
321321 var visited : [ Bool ] = [ Bool] ( repeating: false , count: vertexCount)
322322 var stack : [ Int ] = [ ]
323323 stack. append ( fromIndex)
324324 while !stack. isEmpty {
325- if let v: Int = stack. popLast ( ) {
326- if ( visited [ v] ) {
325+ if let v = stack. popLast ( ) {
326+ if visited [ v] {
327327 continue
328328 }
329329 visited [ v] = true
@@ -347,7 +347,7 @@ extension Graph {
347347 /// - parameter toIndex: the index of the destination vertex
348348 /// - parameter visited: a set of vertex indices which will be considered to have been visited already
349349 /// - returns: the number of paths that exist going from the start to the destinatin
350- func countPaths( fromIndex startIndex: Int , toIndex endIndex: Int , visited: inout Set < Int > ) -> Int {
350+ public func countPaths( fromIndex startIndex: Int , toIndex endIndex: Int , visited: inout Set < Int > ) -> Int {
351351 if startIndex == endIndex { return 1 }
352352 visited. insert ( startIndex)
353353 var total = 0
@@ -382,7 +382,7 @@ extension Graph {
382382 }
383383
384384 /// Computes whether or not a given vertex (by index) is reachable, for every vertex in the graph.
385- func reachabilityOf( _ index: Int ) -> [ Int : Bool ] {
385+ public func reachabilityOf( _ index: Int ) -> [ Int : Bool ] {
386386 var answers : [ Int : Bool ] = [ : ]
387387 for vi in vertices. indices {
388388 answers [ vi] = pathExists ( fromIndex: vi, toIndex: index)
0 commit comments