简体   繁体   中英

C# generic graph search framework

I have now coded up various graph search (A*, DFS, BFS, etc..) algorithms many times over. Every time, the only real difference is the actual search states I am searching over, and how new states are generated from existing ones.

I am now faced with yet another search-heavy project, and would like to avoid having to code and debug a general search algorithm again. It would be really nice if I could define a search state class, including information for generating successive states, heuristic cost, etc, and just plug it in to some kind of existing search framework that can do all of the heavy lifting for me. I know the algorithms aren't particularly difficult to code, but there are always enough tricks involved to make it annoying.

Does anything like this exist? I couldn't find anything.

Perhaps QuickGraph will be of interest.

QuickGraph provides generic directed/undirected graph datastructures and algorithms for .Net 2.0 and up. QuickGraph comes with algorithms such as depth first seach, breath first search, A* search, shortest path, k-shortest path, maximum flow, minimum spanning tree, least common ancestors, etc

This sounds like a perfect use case for either a Delegate or a Lambda Expression.

Using Lambda Expressions for Tree Traversal – C#
http://blog.aggregatedintelligence.com/2010/05/using-lambda-expressions-for-tree.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM