Skip to content

Commit f967dc3

Browse files
committed
Adjacency List
1 parent f400b71 commit f967dc3

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

19-Dijkstras-Shortest-Path-Algorithm/03-dijkstra-heap-priority-queue.js

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,3 +254,86 @@ graph.addEdge('D', 'F', 1);
254254
graph.addEdge('E', 'F', 1);
255255

256256
console.log(graph.Dijkstra('A', 'E'));
257+
258+
/**
259+
* Adjacency List:
260+
*
261+
* {
262+
* "A": [
263+
* {
264+
* "node": "B",
265+
* "weight": 4
266+
* },
267+
* {
268+
* "node": "C",
269+
* "weight": 2
270+
* }
271+
* ],
272+
* "B": [
273+
* {
274+
* "node": "A",
275+
* "weight": 4
276+
* },
277+
* {
278+
* "node": "E",
279+
* "weight": 3
280+
* }
281+
* ],
282+
* "C": [
283+
* {
284+
* "node": "A",
285+
* "weight": 2
286+
* },
287+
* {
288+
* "node": "D",
289+
* "weight": 2
290+
* },
291+
* {
292+
* "node": "F",
293+
* "weight": 4
294+
* }
295+
* ],
296+
* "D": [
297+
* {
298+
* "node": "C",
299+
* "weight": 2
300+
* },
301+
* {
302+
* "node": "E",
303+
* "weight": 3
304+
* },
305+
* {
306+
* "node": "F",
307+
* "weight": 1
308+
* }
309+
* ],
310+
* "E": [
311+
* {
312+
* "node": "B",
313+
* "weight": 3
314+
* },
315+
* {
316+
* "node": "D",
317+
* "weight": 3
318+
* },
319+
* {
320+
* "node": "F",
321+
* "weight": 1
322+
* }
323+
* ],
324+
* "F": [
325+
* {
326+
* "node": "C",
327+
* "weight": 4
328+
* },
329+
* {
330+
* "node": "D",
331+
* "weight": 1
332+
* },
333+
* {
334+
* "node": "E",
335+
* "weight": 1
336+
* }
337+
* ]
338+
* }
339+
*/

0 commit comments

Comments
 (0)