Latest 1.0.0
Homepage https://github.com/ollieatkinson/OKAMutableDirectedGraph
License MIT
Platforms ios 5.0, osx 10.7, requires ARC
Authors

image

OKAMutableDirectedGraph is an implementation of a directed graph in Objective-C.

OKAMutableDirectedGraph was developed originally for managing dependencies – but it can be used for path finding, sorting, garbage collection and much more.


Example Usage

 NSString *a = @"a";
 NSString *b = @"b";
 NSString *c = @"c";

 OKAMutableDirectedGraph *graph = [[OKAMutableDirectedGraph alloc] init];

 for (NSString *job in @[ a, b, c ]) {
   [graph addNode:job];
 }

 [graph addEdgeFrom:c to:b];
 [graph addEdgeFrom:b to:a];

 NSMutableArray *sorted = [NSMutableArray array];

 do {

   NSArray *heads = graph.heads;

   for (NSString *job in heads) {
     [graph removeNode:job];
     [sorted addObject:job];
   }

 } while (graph.heads.count != 0);

 (lldb) sorted => @[ c, b, a ]

Documentation & Research

Princeton University – Directed Graphs

Contact

Oliver Atkinson

Licence

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

Latest podspec

{
    "name": "OKAMutableDirectedGraph",
    "version": "1.0.0",
    "summary": "OKAMutableDirectedGraph is an implementation of a directed graph in Objective-C.",
    "description": "n                   OKAMutableDirectedGraph was developed originally for managing dependencies - but it can be used for path finding, sorting, garbage collection and much more.nn",
    "homepage": "https://github.com/ollieatkinson/OKAMutableDirectedGraph",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Oliver Atkinson": "[email protected]"
    },
    "platforms": {
        "ios": "5.0",
        "osx": "10.7"
    },
    "source": {
        "git": "https://github.com/ollieatkinson/OKAMutableDirectedGraph.git",
        "tag": "1.0.0"
    },
    "source_files": "OKAMutableDirectedGraph",
    "exclude_files": "Classes/Exclude",
    "requires_arc": true
}

Pin It on Pinterest

Share This