a Swift path-finding library. Its primary goal is to extend Apple's GameplayKit framework.
- [x] Weighted connections.
- [x] Total path weight.
- [x] Associated values support.
- [x] Find the shortest path between multiple origins and destinations.
import Connection // Create nodes. let nodeA = Node(value: "A") let nodeB = Node(value: "B") let nodeC = Node(value: "C") // Make connections. nodeA.addConnection(to: nodeB, bidirectional: false, weight: 1) nodeB.addConnection(to: nodeC, bidirectional: true, weight: 2) // Create graph. let graph = Graph([nodeA, nodeB, nodeC]) // Find path. let shortestAtoCPath = graph.findPath(from: nodeA, to: nodeC) print(shortestAtoCPath) // ["A", "B", "C"]
You can find many more examples in the
Subscribe to iOS Example
Get the latest posts delivered right to your inbox