public static void ExecuteOnEdgesRecursive <TVertex, TEdge>(this IBidirectionalGraph <TVertex, TEdge> graph, TEdge edge, EdgeDirection edgeDirection, Action <TEdge> actionOnEdge) where TEdge : IEdge <TVertex> { actionOnEdge(edge); foreach (var nextEdge in graph.GetEdges(edge.GetEndVertex(edgeDirection), edgeDirection)) { graph.ExecuteOnEdgesRecursive(nextEdge, edgeDirection, actionOnEdge); } }
public static void ExecuteOnVerticesRecursive <TVertex, TEdge>(this IBidirectionalGraph <TVertex, TEdge> graph, TVertex rootVertex, EdgeDirection edgeDirection, Action <TVertex> actionOnVertex) where TEdge : IEdge <TVertex> { actionOnVertex(rootVertex); foreach (var layoutEdge in graph.GetEdges(rootVertex, edgeDirection)) { var nextVertex = layoutEdge.GetEndVertex(edgeDirection); graph.ExecuteOnVerticesRecursive(nextVertex, edgeDirection, actionOnVertex); } }