# 8.6. Homework

## Finding All Minimum Spanning Trees

Your task is to write a program that finds all minimum spanning trees given an undirected graph.

## Tasks

* Create a class called [`MSTAllHW`](https://github.com/emory-courses/dsa-java/blob/master/src/main/java/edu/emory/cs/graph/span/MSTAllHW.java)  that inherits the [`MSTAll`](https://github.com/emory-courses/dsa-java/blob/master/src/main/java/edu/emory/cs/graph/span/MSTAll.java) interface.
* Override the `getMinimumSpanningTrees()` method.
* Feel free to use any classes in the [graph](https://github.com/emory-courses/dsa-java/tree/master/src/main/java/edu/emory/cs/graph) package without modifying.
* Write a report that explains the logic and worst-case complexity of your program and save it as `hw3.pdf`.

{% hint style="info" %}
You may want to start with the implementation of either [Prim's](/dsa-java/minimum-spanning-trees/prims-algorithm.md) or [Kruskal's](/dsa-java/minimum-spanning-trees/kruskals-algorithm.md) algorithm and update the code to find all minimum spanning trees.
{% endhint %}

## Extra Credit

* Create an interesting graph and submit both the source code (as in [`MSTAllHWTest`](https://github.com/emory-courses/dsa-java/blob/master/src/test/java/edu/emory/cs/graph/span/MSTAllHWTest.java)) and the diagram representing your graph (up to 1 point).

## Notes

* Test your code with graphs consisting of zero to many spanning trees.
* Your output must include only minimum spanning trees.
* Your output should not include redundant trees.  For example, if there are three vertices, 0, 1, and 2, {`0 -> 1`, `0 -> 2`} is considered the same as {`0 -> 1`, `0 <- 2`} or {`0 <- 1`, `0 -> 2`} or {`0 <-1`, `0 <- 2`}.

&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://emory.gitbook.io/dsa-java/minimum-spanning-trees/homework.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
