{"id":20987452,"url":"https://github.com/jasonnam/connection","last_synced_at":"2025-12-11T22:53:05.708Z","repository":{"id":63921278,"uuid":"239420291","full_name":"jasonnam/Connection","owner":"jasonnam","description":"A path-finding library powered by GameplayKit 👾","archived":false,"fork":false,"pushed_at":"2021-01-18T14:02:42.000Z","size":38,"stargazers_count":75,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-23T10:26:50.413Z","etag":null,"topics":["gameplaykit","ios","macos","package","path-finding","pathfinding","pathfinding-algorithm","spm","swift"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jasonnam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-10T03:36:13.000Z","updated_at":"2024-04-03T07:22:43.000Z","dependencies_parsed_at":"2023-01-14T14:15:20.098Z","dependency_job_id":null,"html_url":"https://github.com/jasonnam/Connection","commit_stats":null,"previous_names":["zntfdr/connection"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonnam%2FConnection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonnam%2FConnection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonnam%2FConnection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonnam%2FConnection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jasonnam","download_url":"https://codeload.github.com/jasonnam/Connection/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225303940,"owners_count":17453037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gameplaykit","ios","macos","package","path-finding","pathfinding","pathfinding-algorithm","spm","swift"],"created_at":"2024-11-19T06:16:59.766Z","updated_at":"2025-12-11T22:53:05.670Z","avatar_url":"https://github.com/jasonnam.png","language":"Swift","readme":"# Connection\n\n\u003cp\u003e\n    \u003cimg src=\"https://img.shields.io/badge/swift-5.1-orange.svg\" /\u003e\n    \u003ca href=\"https://github.com/zntfdr/Connection/actions?query=workflow%3A%22Build+%26+Test%22\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/workflow/status/zntfdr/Connection/Build \u0026 Test?label=CI\u0026logo=GitHub\" alt=\"Build status\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://swift.org/package-manager\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/swiftpm-compatible-brightgreen.svg?style=flat\" alt=\"Swift Package Manager\" /\u003e\n    \u003c/a\u003e\n     \u003cimg src=\"https://img.shields.io/badge/platforms-macOS+iOS+iPadOS+tvOS-brightgreen.svg?style=flat\" alt=\"MacOS + iOS + iPadOS + tvOS\" /\u003e\n    \u003ca href=\"https://twitter.com/zntfdr\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/twitter-@zntfdr-blue.svg?style=flat\" alt=\"Twitter: @zntfdr\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\nWelcome to **Connection**, a Swift path-finding library. Its primary goal is to extend Apple's [`GameplayKit`](https://developer.apple.com/documentation/gameplaykit) framework.\n\n## Features\n\n- [x] Weighted connections.\n- [x] Total path weight.\n- [x] Associated values support.\n- [x] Find the shortest path between multiple origins and destinations.\n\n## Usage\nConnection defines two new generic classes: `Node` and `Graph`, which are, respectively, [`GKGraphNode`](https://developer.apple.com/documentation/gameplaykit/gkgraphnode) and [`GKGraph`](https://developer.apple.com/documentation/gameplaykit/gkgraph) counterparts.\n\n```swift\nimport Connection\n\n// Create nodes.\nlet nodeA = Node(value: \"A\")\nlet nodeB = Node(value: \"B\")\nlet nodeC = Node(value: \"C\")\n\n// Make connections.\nnodeA.addConnection(to: nodeB, bidirectional: false, weight: 1)\nnodeB.addConnection(to: nodeC, bidirectional: true, weight: 2)\n\n// Create graph.\nlet graph = Graph([nodeA, nodeB, nodeC])\n\n// Find path.\nlet shortestAtoCPath = graph.findPath(from: nodeA, to: nodeC)\n\nprint(shortestAtoCPath) // [\"A\", \"B\", \"C\"]\n```\nYou can find many more examples in the [`Tests`](https://github.com/zntfdr/Connection/tree/master/Tests) folder.\n\n## Installation\n\nConnection is distributed using the [Swift Package Manager](https://swift.org/package-manager). To install it into a project, follow [this tutorial](https://developer.apple.com/documentation/swift_packages/adding_package_dependencies_to_your_app) and use this repository URL: `https://github.com/zntfdr/Connection.git`.\n\n## Credits\n\nConnection was built by [Federico Zanetello](https://twitter.com/zntfdr) as a component of [Bangkok Metro](http://yourmetro.app).\n\nIf you'd like to dive deeper into iOS path-finding algorithms, please read this two-part serie:\n\n- [Dijkstra’s Algorithm In Swift](https://www.fivestars.blog/code/dijkstra-algorithm-swift.html#swift-time)\n- [The Right Way To Write Dijkstra’s Algorithm In Swift 👾](https://www.fivestars.blog/code/dijkstra-algorithm-swift-2.html)\n\n## Contributions and Support\n\nAll users are welcome and encouraged to become active participants in the project continued development — by fixing any bug that they encounter, or by improving the documentation wherever it’s found to be lacking.\n\nIf you'd like to make a change, please [open a Pull Request](https://github.com/zntfdr/Connection/pull/new), even if it just contains a draft of the changes you’re planning, or a test that reproduces an issue.\n\nThank you and please enjoy using **Connection**!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonnam%2Fconnection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjasonnam%2Fconnection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonnam%2Fconnection/lists"}