MiniDigraph

main

A teeny-tiny-weeny directed graph library written in Swift available as a Swift Package.
LuizZak/MiniDigraph

MiniDigraph

A teeny-tiny-weeny directed graph library written in Swift available as a Swift Package.

Mostly used as a dependency by my other OSS projects.

Sample usage:

var graph = DirectedGraph<String>()
graph.addNodes(["start", "node 1", "node 2", "node 3", "node 4"])

graph.addEdge(from: "start", to: "node 1")
graph.addEdge(from: "node 1", to: "node 2")
graph.addEdge(from: "node 2", to: "node 3")
graph.addEdge(from: "node 2", to: "node 4")
graph.addEdge(from: "node 4", to: "node 2")

let result = graph.stronglyConnectedComponents()

print(result)

prints:

[Set(["node 3"]), Set(["node 4", "node 2"]), Set(["node 1"]), Set(["start"])]

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

  • None
Last updated: Mon Jan 12 2026 01:44:41 GMT-1000 (Hawaii-Aleutian Standard Time)