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); } }