From 6363b94c0a915657349a4f25d2e35d1917ed6944 Mon Sep 17 00:00:00 2001 From: Owen Jones <71284174+OwenJRJones@users.noreply.github.com> Date: Thu, 29 Feb 2024 08:58:39 -0400 Subject: [PATCH] impr(quotes): add Python quote (OwenJRJones) (#5139) * Updated code_python.json * Updated code_python.json --- frontend/static/quotes/code_python.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/static/quotes/code_python.json b/frontend/static/quotes/code_python.json index 6504a8c45..bf55c18b7 100644 --- a/frontend/static/quotes/code_python.json +++ b/frontend/static/quotes/code_python.json @@ -450,6 +450,12 @@ "source": "Python 3.11.0 documentation - Python HOWTOs", "id": 74, "length": 372 + }, + { + "text": "class Graph():\n\ndef __init__(self, vertices):\nself.V = vertices\nself.graph = [[0 for column in range(vertices)]\nfor row in range(vertices)]\n\ndef printSolution(self, dist):\nprint('Vertex \t Distance from Source')\nfor node in range(self.V):\nprint(node, '\t\t', dist[node])\n\ndef minDistance(self, dist, sptSet):\nmin = 1e7\n\nfor v in range(self.V):\nif dist[v] < min and sptSet[v] == False:\nmin = dist[v]\nmin_index = v\n\nreturn min_index\n\ndef dijkstra(self, src):\n\ndist = [1e7] * self.V\ndist[src] = 0\nsptSet = [False] * self.V\n\nfor cout in range(self.V):\n\nu = self.minDistance(dist, sptSet)\n\nsptSet[u] = True\n\nfor v in range(self.V):\nif (self.graph[u][v] > 0 and\nsptSet[v] == False and\ndist[v] > dist[u] + self.graph[u][v]):\ndist[v] = dist[u] + self.graph[u][v]\n\nself.printSolution(dist)", + "source": "https://www.geeksforgeeks.org/python-program-for-dijkstras-shortest-path-algorithm-greedy-algo-7/", + "id": 75, + "length": 777 } ] }