From f057d2ec10bdf93bb8ef73cbb3ea80d56159faeb Mon Sep 17 00:00:00 2001 From: Bryan Parno Date: Wed, 1 Jul 2015 11:53:59 -0700 Subject: Add code to calculate various interesting statistics about Dafny files. --- Source/Dafny/SccGraph.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Source/Dafny/SccGraph.cs') diff --git a/Source/Dafny/SccGraph.cs b/Source/Dafny/SccGraph.cs index 01a72fc5..20b4f65e 100644 --- a/Source/Dafny/SccGraph.cs +++ b/Source/Dafny/SccGraph.cs @@ -6,8 +6,8 @@ namespace Microsoft.Dafny { public class Graph where Node : class { - enum VisitedStatus { Unvisited, OnStack, Visited } - class Vertex { + public enum VisitedStatus { Unvisited, OnStack, Visited } + public class Vertex { public readonly Node N; public readonly List/*!*/ Successors = new List(); public List SccMembers; // non-null only for the representative of the SCC @@ -65,6 +65,10 @@ namespace Microsoft.Dafny { { } + public IEnumerable GetVertices() { + return vertices.Values; + } + /// /// Idempotently adds a vertex 'n' to the graph. /// @@ -97,7 +101,7 @@ namespace Microsoft.Dafny { /// /// Returns the vertex for 'n' if 'n' is in the graph. Otherwise, returns null. /// - Vertex FindVertex(Node n) { + public Vertex FindVertex(Node n) { Vertex v; if (vertices.TryGetValue(n, out v)) { Contract.Assert(v != null); // follows from postcondition of TryGetValue (since 'vertices' maps to the type Vertex!) -- cgit v1.2.3