 
 		while (top != nil) {
 			path.insert(top!, at: 0)
-			top = top?.parentNode
+			top = top!.parentNode
 		}
 
 		self.resetElements()

		processingLock.lock()

		for e in edges {

			e.from.outEdges.append(e)

			if (e.bidirectional == true) {
				e.to.outEdges.append(Edge(from: e.to, to: e.from,
					cost: e.cost, bidirectional: e.bidirectional))
			}
		}



public class Graph {

	private var edges: [Edge]
	private let processingLock = NSLock()

	public init(edges: [Edge]) {
