public bool Test([NotNull] TVertex vertex) { if (vertex == null) { throw new ArgumentNullException(nameof(vertex)); } return(_visitedGraph.IsInEdgesEmpty(vertex) && _visitedGraph.IsOutEdgesEmpty(vertex)); }
private static IEnumerable <TVertex> RootsIterator <TVertex, TEdge>( IBidirectionalGraph <TVertex, TEdge> visitedGraph) where TEdge : IEdge <TVertex> { foreach (var v in visitedGraph.Vertices) { if (visitedGraph.IsInEdgesEmpty(v)) { yield return(v); } } }
public static IEnumerable <TVertex> Roots <TVertex, TEdge>( IBidirectionalGraph <TVertex, TEdge> visitedGraph) where TEdge : IEdge <TVertex> { GraphContracts.AssumeNotNull(visitedGraph, "visitedGraph"); foreach (var v in visitedGraph.Vertices) { if (visitedGraph.IsInEdgesEmpty(v)) { yield return(v); } } }