From 66c6353705723932f5e80fdeae185302da843d9e Mon Sep 17 00:00:00 2001 From: rmakynen <43169683+rmakynen@users.noreply.github.com> Date: Tue, 9 Oct 2018 09:05:59 +0300 Subject: [PATCH] Update Dijkstra.java --- Others/Dijkstra.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Others/Dijkstra.java b/Others/Dijkstra.java index dd671547c..5df11f027 100644 --- a/Others/Dijkstra.java +++ b/Others/Dijkstra.java @@ -63,13 +63,11 @@ class Graph { public Vertex previous = null; public final Map neighbours = new HashMap<>(); - public Vertex(String name) - { + public Vertex(String name){ this.name = name; } - private void printPath() - { + private void printPath(){ if (this == this.previous) { System.out.printf("%s", this.name); @@ -85,16 +83,14 @@ class Graph { } } - public int compareTo(Vertex other) - { + public int compareTo(Vertex other){ if (dist == other.dist) return name.compareTo(other.name); return Integer.compare(dist, other.dist); } - @Override public String toString() - { + @Override public String toString(){ return "(" + name + ", " + dist + ")"; } } @@ -175,4 +171,4 @@ class Graph { System.out.println(); } } -} \ No newline at end of file +}