From 8b036bb990619b265a6ece0ac5af7bb359783a25 Mon Sep 17 00:00:00 2001 From: Evan Hemsley Date: Sun, 16 Jun 2019 20:12:29 -0700 Subject: [PATCH] optimized directed graph with local functions --- src/graph/DirectedGraph.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/graph/DirectedGraph.cs b/src/graph/DirectedGraph.cs index 1eaaff2..a9f7e61 100644 --- a/src/graph/DirectedGraph.cs +++ b/src/graph/DirectedGraph.cs @@ -129,8 +129,7 @@ namespace Encompass output.Add(vertex, new Dictionary()); } - Action dfsHelper = null; - dfsHelper = (T v) => + void dfsHelper(T v) { discovered.Add(v); time += 1; @@ -259,8 +258,7 @@ namespace Encompass public IEnumerable> SimpleCycles() { - Action, Dictionary>> unblock = null; - unblock = (T thisnode, HashSet blocked, Dictionary> B) => + void unblock(T thisnode, HashSet blocked, Dictionary> B) { var stack = new Stack(); stack.Push(thisnode);