 
 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
     

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

public struct SDAtomicGraphGenerator<Value> : GeneratorType {

        lck = SDSpinLock()
    }
    
    public var startIndex : Index {
        return Index(base: graph.startIndex)
    }
    
    public var endIndex : Index {
        return Index(base: graph.endIndex)
    }
    
    public var count: Int {
        return graph.count
    }
    
    public subscript(idx: Index) -> Generator.Element {
        return graph[idx.base]
    }
    
    public subscript(from fromNode: NodeID, to toNode: NodeID) -> Value? {
        get {
            return lck.synchronized { graph[from: fromNode, to: toNode] }
