From 19fb62a58042b13592ec51d95e8a1a932cf1202d Mon Sep 17 00:00:00 2001 From: Yash Deshpande Date: Sun, 11 Oct 2020 12:37:29 +0530 Subject: [PATCH] Add helper functions Helper functions for number of vertices and edges --- .../jwetherell/algorithms/data_structures/Graph.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/com/jwetherell/algorithms/data_structures/Graph.java b/src/com/jwetherell/algorithms/data_structures/Graph.java index c28bbc6e..7d45ab5a 100644 --- a/src/com/jwetherell/algorithms/data_structures/Graph.java +++ b/src/com/jwetherell/algorithms/data_structures/Graph.java @@ -104,6 +104,14 @@ public List> getVertices() { public List> getEdges() { return allEdges; } + + public int getNumberOfVertices() { + return allVertices.size(); + } + + public int getNumberOfEdges() { + return allEdges.size(); + } /** * {@inheritDoc} @@ -578,4 +586,4 @@ public String toString() { return builder.toString(); } } -} \ No newline at end of file +}