How can I make A* to skip particular edges?

Topics: algorithm, graph
Jan 13, 2013 at 4:18 PM
Edited Jan 13, 2013 at 4:32 PM

I conduct a path finding library. QuickGraph fits all my requirements but I have met one problem. I need the shortest path algorithms to skip an edges which are impassable by current moving agent. What i want is something like this:

 



Func<SEquatableEdge<VectorD3>, double> cityDistances = delegate(SEquatableEdge<VectorD3> edge) { if(edge.IsPassableBy(agent)) return edgeWeight; // Edge is passable, return its weight else return -1; // Edge is impassable, return -1, which means, that path finder should skip it }; Func<VectorD3, double> heuristic = ...; TryFunc<VectorD3, IEnumerable<SEquatableEdge<VectorD3>>> tryGetPath = graph2.ShortestPathsAStar(cityDistances, heuristic, sourceCity);

 


 

I could imagine solving this problem by creating a copy of graph and deleting the impassable edges, but it is unnecessary waste of computer's resources. Could one, please, hint me on how to solve this problem? Or there is no solution and I should update the source?

Thanks in advance!