File tree 4 files changed +7
-9
lines changed
src/main/java/com/thealgorithms/datastructures/graphs
4 files changed +7
-9
lines changed Original file line number Diff line number Diff line change 140
140
<!-- TODO <module name="NoWhitespaceAfter"/> -->
141
141
<module name =" NoWhitespaceBefore" />
142
142
<module name =" OperatorWrap" />
143
- <!-- TODO < module name="ParenPad"/> -- >
143
+ <module name =" ParenPad" />
144
144
<module name =" TypecastParenPad" />
145
145
<module name =" WhitespaceAfter" />
146
146
<!-- TODO <module name="WhitespaceAround"/> -->
Original file line number Diff line number Diff line change 222
222
<Match >
223
223
<Bug pattern =" IMC_IMMATURE_CLASS_BAD_SERIALVERSIONUID" />
224
224
</Match >
225
- <Match >
226
- <Bug pattern =" SUI_CONTAINS_BEFORE_ADD" />
227
- </Match >
228
225
<Match >
229
226
<Bug pattern =" DRE_DECLARED_RUNTIME_EXCEPTION" />
230
227
</Match >
Original file line number Diff line number Diff line change @@ -57,9 +57,11 @@ public static void main(String[] args) {
57
57
obj .go ();
58
58
}
59
59
60
- public void go () { // shows distance to all vertices // Interactive run for understanding the
61
- try ( // class first time. Assumes source vertex is 0 and
62
- Scanner sc = new Scanner (System .in )) {
60
+ public void go () {
61
+ // shows distance to all vertices
62
+ // Interactive run for understanding the
63
+ // class first time. Assumes source vertex is 0 and
64
+ try (Scanner sc = new Scanner (System .in )) {
63
65
int i ;
64
66
int v ;
65
67
int e ;
Original file line number Diff line number Diff line change @@ -81,8 +81,7 @@ public int countGraphs() {
81
81
Set <Node > markedNodes = new HashSet <Node >();
82
82
83
83
for (Node n : nodeList ) {
84
- if (!markedNodes .contains (n )) {
85
- markedNodes .add (n );
84
+ if (markedNodes .add (n )) {
86
85
markedNodes .addAll (depthFirstSearch (n , new ArrayList <Node >()));
87
86
count ++;
88
87
}
You can’t perform that action at this time.
0 commit comments