From 00dca1ab44a0035bdc668405f0a74119ce1b4ae5 Mon Sep 17 00:00:00 2001
From: Chirag Arora <98258782+CHIRAGGARORA@users.noreply.github.com>
Date: Sat, 14 Jan 2023 00:56:38 +0530
Subject: [PATCH] Update Graph.swift

Added Docstrings for easier understanding for begginers
---
 Topological Sort/Graph.swift | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/Topological Sort/Graph.swift b/Topological Sort/Graph.swift
index 5032ba1d1..a07648dd0 100644
--- a/Topological Sort/Graph.swift	
+++ b/Topological Sort/Graph.swift	
@@ -1,3 +1,15 @@
+
+/**
+ *  A class that represents a graph data structure.
+ *  It contains an adjacency list which is a dictionary of nodes and their corresponding edges.
+ *  It has the following methods:
+ *  - addNode(value: Node) -> Node: adds a new node to the graph
+ *  - addEdge(fromNode: Node, toNode: Node) -> Bool: adds a directed edge from one node to another
+ *  - adjacencyList(forNode: Node) -> [Node]? : returns the list of nodes that are adjacent to the given node
+ *  - calculateInDegreeOfNodes() -> [Node : InDegree]: returns a dictionary of nodes and their corresponding in-degree values
+ *
+ */
+
 public class Graph: CustomStringConvertible {
   public typealias Node = String
 
@@ -33,6 +45,13 @@ public class Graph: CustomStringConvertible {
 
 extension Graph {
   typealias InDegree = Int
+  
+  /**
+   *  A method that calculates the in-degree of all the nodes in the graph.
+   *  It returns a dictionary with the nodes as keys and their corresponding in-degree values as values.
+   *
+   *  - returns: A dictionary of [Node : InDegree]
+   */
 
   func calculateInDegreeOfNodes() -> [Node : InDegree] {
     var inDegrees = [Node: InDegree]()