             self.addNeighbor($0)
         }
     }
+    var component: PathComponent {
+        var end = self.next!.componentLocation
+        if end == self.pathComponent.startingIndexedLocation {
+            end = self.pathComponent.endingIndexedLocation
+        }
+        return self.pathComponent.split(from: self.componentLocation, to: end)
+    }
+    var backComponent: PathComponent {
+        var end = self.next!.componentLocation
+        if self.componentLocation == self.pathComponent.startingIndexedLocation {
+            return self.pathComponent.split(from: self.pathComponent.endingIndexedLocation, to: end)
+        }
+        return self.pathComponent.split(from: self.componentLocation, to: end)
+    }
 }
 
 private class Edge {
     var visited: Bool = false
     var inSolution: Bool = false
-    let component: PathComponent
-    init(component: PathComponent) {
-        self.component = component
+    init() {
+        self.visited = false
+        self.inSolution = false
     }
 }
 

    case removeCrossings
}

// TODO: revert public scope
public final class AugmentedGraph {
    private let operation: BooleanPathOperation
    private let path1: Path
    private let path2: Path
    private let graph1: [Node]
    private let graph2: [Node]
    public init(path1: Path, path2: Path, intersections: [PathIntersection], operation: BooleanPathOperation) {
        self.operation = operation
        self.path1 = path1
        self.path2 = path2
        // take the pairwise intersections and make two mutually linked lists of intersections, one for each path
        var path1Intersections: [Node] = []
        var path2Intersections: [Node] = []
        intersections.forEach {
            let node1 = Node(location: $0.indexedPathLocation1)
            let node2 = Node(location: $0.indexedPathLocation2)
            node1.addNeighbor(node2)
            node2.addNeighbor(node1)
            path1Intersections.append(node1)

    }
    var next: Node?
    var previous: Node?
    var edge = Edge()
    var neighbors: [Node] = []
    unowned var pathComponent: PathComponent
    init(location: IndexedPathLocation, pathComponent: PathComponent) {
        self.location = location
        self.pathComponent = pathComponent
    }
    func neighborsContain(_ node: Node) -> Bool {
        return self.neighbors.contains(where: { $0 === node })
