c# - How to find out if there is a connection between two arbitrary vertices in direction graph? -
i know classes , functions in quickgraph library (c#) should use, find out, if there exists connection between 2 arbitrary vertices in directional graph?
i beginner @ programming, programming alghorithms, kindly ask if can provide me sample code mentioned problem, because quickgraph library doesn't have many problem-specific tutorials beginners.ecially
graph specification:
- directed
- not weighted (distance not important, connectivity between vertices/edges)
- graph dynamic vertices/edges can added/removed or edited.
hm, haven't tested it, basic dfs/bfs should trick, such:
var trygetpaths = _graph.treebreadthfirstsearch(__source__); ienumerable<edge<youritemtype>> path; if (trygetpaths(__target__, out path)) { // have connectivity! }
that 1 checks if there connectivity source target. might want run check vice versa too.
Comments
Post a Comment