 	/// Executes Dijkstra's search algorithm over `graph` from `startVertex` using edge weights from
 	/// `edgeWeightMap`, calling `visitor` along the way.
 	static func dijkstraSearch<
-		Graph: IncidenceGraph & VertexListGraph,
+		SearchSpace: IncidenceGraph & VertexListGraph,
 		Distance: GraphDistanceMeasure,
 		EdgeWeightMap: GraphEdgePropertyMap,
 		Visitor: DijkstraVisitor
 	>(
-		_ graph: inout Graph,
+		_ graph: inout SearchSpace,
 		visitor: inout Visitor,
 		edgeWeightMap: EdgeWeightMap,
-		startAt startVertex: Graph.VertexId
-	) throws -> TableVertexPropertyMap<Graph, Distance>
+		startAt startVertex: SearchSpace.VertexId
+	) throws -> TableVertexPropertyMap<SearchSpace, Distance>
 	where
-		Graph.VertexId: IdIndexable,
-		EdgeWeightMap.Graph == Graph,
+		SearchSpace.VertexId: IdIndexable,
+		EdgeWeightMap.Graph == SearchSpace,
 		EdgeWeightMap.Value == Distance,
-		Visitor.Graph == Graph
+		Visitor.Graph == SearchSpace
 	{
 		var colorMap = TableVertexPropertyMap(repeating: VertexColor.white, for: graph)
 		var vertexDistanceMap = TableVertexPropertyMap(

	/// The visitor to be called throughout execution.
	var visitor: Visitor

	init(visitor: Visitor, edgeWeightMap: EdgeWeightMap, vertexDistanceMap: VertexDistanceMap, startVertex: Graph.VertexId) {
		self.visitor = visitor
		self.edgeWeightMap = edgeWeightMap
		self.vertexDistanceMap = vertexDistanceMap
	}

	public mutating func popVertex() -> Graph.VertexId? {
		let tmp = queue.popFront()
		return tmp
	}

	public mutating func discover(vertex: Graph.VertexId, _ graph: inout Graph) throws {
		queue.add(vertex, with: Distance.effectiveInfinity)  // Add to the back of the queue.
		try visitor.discover(vertex: vertex, &graph)
	}

	public mutating func examine(vertex: Graph.VertexId, _ graph: inout Graph) throws {
		try visitor.examine(vertex: vertex, &graph)
	}

	public mutating func examine(edge: Graph.EdgeId, _ graph: inout Graph) throws {
		try visitor.examine(edge: edge, &graph)
	}

	public mutating func treeEdge(_ edge: Graph.EdgeId, _ graph: inout Graph) throws {
		let decreased = relaxTarget(edge, &graph)
		if decreased {
			try visitor.edgeRelaxed(edge, &graph)

	/// graph algorithms. Use this overload if you are interested in manually controlling every
	/// aspect. If you would like a higher-level abstraction, consider `dijkstraSearch`.
	static func dijkstraSearchNoInit<
		SearchSpace: IncidenceGraph & VertexListGraph,
		Distance: GraphDistanceMeasure,
		EdgeWeightMap: GraphEdgePropertyMap,
		VertexDistanceMap: MutableGraphVertexPropertyMap,
		ColorMap: MutableGraphVertexPropertyMap,
		Visitor: DijkstraVisitor
	>(
		_ graph: inout SearchSpace,
		visitor: inout Visitor,
		colorMap: inout ColorMap,
		vertexDistanceMap: inout VertexDistanceMap,
		edgeWeightMap: EdgeWeightMap,
		startAt startVertex: SearchSpace.VertexId
	) throws
	where
		SearchSpace.VertexId: IdIndexable,
		EdgeWeightMap.Graph == SearchSpace,
		EdgeWeightMap.Value == Distance,
		VertexDistanceMap.Graph == SearchSpace,
		VertexDistanceMap.Value == Distance,
		ColorMap.Graph == SearchSpace,
		ColorMap.Value == VertexColor,
		Visitor.Graph == SearchSpace
	{
		vertexDistanceMap.set(vertex: startVertex, in: &graph, to: Distance.zero)
		var dijkstraVisitor = DijkstraBFSVisitor(
