Functions
The following functions are available globally.
-
Find the total weight of a list of weighted edges
Declaration
Swift
public func totalWeight<W>(_ edges: [WeightedEdge<W>]) -> W? where W : Decodable, W : Encodable, W : Numeric
-
Pretty print an edge list returned from an MST
Declaration
Swift
public func printMST<V, W>(edges: [WeightedEdge<W>], graph: WeightedGraph<V, W>) where V : Decodable, V : Encodable, V : Equatable, W : Decodable, W : Encodable, W : Numeric
-
Helper function to get easier access to Dijkstra results.
Declaration
Swift
public func distanceArrayToVertexDict<T, W>(distances: [W?], graph: WeightedGraph<T, W>) -> [T : W?] where T : Decodable, T : Encodable, T : Hashable, W : Decodable, W : Encodable, W : Equatable
-
Takes a dictionary of edges to reach each node and returns an array of edges that goes from
from
toto
-
Undocumented
Declaration
Swift
public func pathDictToPath<W>(from: Int, to: Int, pathDict: [Int : WeightedEdge<W>]) -> [WeightedEdge<W>] where W : Decodable, W : Encodable, W : Equatable