Latest 0.1.2
Homepage https://github.com/horothesun/ImmutableGraph
License MIT
Platforms ios 8.0
Authors

CI Status
codecov.io
Version
License
Platform

Examples

Directed graph:

let u = "☝️", v = "✌️"
let vertices = Set(arrayLiteral: u, v)

let e = Edge(source: u, destination: v)
let edges = Set(arrayLiteral: e)

let graph = Graph(vertices: vertices, edges: edges)

Weighted directed graph:

let w_e = WeightedEdge(source: u, destination: v, weight: 3.9)
let weightedEdges = Set(arrayLiteral: w_e)

let weightedGraph = Graph(vertices: vertices, edges: weightedEdges)

DFS from source:

let simpleGraphAnnotation = dfs(graph, source: v)

DFS on graph:

let simpleGraphAnnotation = dfs(graph)

BFS from source:

let simpleGraphAnnotation = bfs(graph, source: v)

Finding paths from graph annotations:

let parentByVertex = simpleGraphAnnotation.parentByVertex
let result = findPath(parentByVertex: parentByVertex, source: s, destination: d)

Requirements

Xcode 9 beta or higher (Swift 4).

Installation

ImmutableGraph is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "ImmutableGraph"

Notes

This library was built using TDD.

Some of the graphs used to unit test BFS and DFS algorithms come from Algorithms with Attitude YouTube channel’s related videos:

Author

Nicola Di Pol, [email protected]

License

ImmutableGraph is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "ImmutableGraph",
    "version": "0.1.2",
    "summary": "Functional Swift graph algorithms.",
    "description": "Functional Swift graph algorithms: DFS, BFS and FindPath on immutable graphs developed using TDD.",
    "homepage": "https://github.com/horothesun/ImmutableGraph",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "horothesun": "[email protected]"
    },
    "source": {
        "git": "https://github.com/horothesun/ImmutableGraph.git",
        "tag": "0.1.2"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "ImmutableGraph/Classes/**/*",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This