public static bool IsEdgeRedundant <TVertex, TEdge>(this IBidirectionalGraph <TVertex, TEdge> graph, TEdge edge) where TEdge : IEdge <TVertex> { var paths = graph.GetShortestPaths(edge.Source, edge.Target, 2); return(paths.Count() > 1); }
public static bool PathExists <TVertex, TEdge>(this IBidirectionalGraph <TVertex, TEdge> graph, TVertex source, TVertex target) where TEdge : IEdge <TVertex> { // TODO: use more efficient algo for the purpose + caching? return(graph.GetShortestPaths(source, target, 1).Any()); }