 
 import Foundation
 
-public class SDAtomicGraph<Value> : SequenceType {
-    
+public class SDAtomicGraph<Value> : CollectionType {
+    
+    public typealias Index = SDAtomicGraphIndex<Value>
     public typealias Generator = SDAtomicGraphGenerator<Value>
     public typealias NodeID = SDAtomicNode.Identifier
     

        lck = SDSpinLock()
    }
    
    public subscript(from fromNode: NodeID, to toNode: NodeID) -> Value? {
        get {
            return lck.synchronized { graph[from: fromNode, to: toNode] }

    public func generate() -> Generator {
        return Generator(base: graph.generate())
    }
}

public struct SDAtomicGraphIndex<Value> : ForwardIndexType {
    
    public typealias NodeID = SDAtomicNode.Identifier
    
    private let base: Graph<NodeID, Value>.Index
    
    public func successor() -> SDAtomicGraphIndex<Value> {
        return SDAtomicGraphIndex(base: base.successor())
    }
}

public func == <Value>(lhs: SDAtomicGraphIndex<Value>, rhs: SDAtomicGraphIndex<Value>) -> Bool {
    return lhs.base == rhs.base
}

public struct SDAtomicGraphGenerator<Value> : GeneratorType {
