emory-courses / dsa-java

Data Structures and Algorithms in Java
https://emory.gitbook.io/dsa-java/
42 stars 55 forks source link

[HW#3] only one vertex case #191

Closed chenda2000 closed 3 years ago

chenda2000 commented 3 years ago

For graphs of only one vertex, should we return an empty list or a list with one empty SpanningTree?

Basically, is a spanning tree with no edges still considered a spanning tree?

Edit: I also have the same question for graphs of zero vertices

marvinquiet commented 3 years ago

There will be multiple nodes with edges connecting them.

chenda2000 commented 3 years ago

Are you sure? There are several cases in the test file with no edges (complete graph of size 1, getGraph1a, and getGraph2a)

marvinquiet commented 3 years ago

Yeah, according to what Dr. Choi replied to me earlier. But feel free to go to today's office hours and check with Dr. Choi directly

chenda2000 commented 3 years ago

Dr. Choi said if a graph has no edges we should return an empty list

marvinquiet commented 3 years ago

Thanks! Good to know