home page -> teaching -> graph algorithms -> practical work no. 4

Graph algorithms - practical work no. 4

Due: week 11-12.

Solve the assigned problem from those below. Additionaly, you may solve one or more of the bonus problems at the end of the page. Use the abstract data type created for lab. 1; modify it if necessary.

Assigned problems

1. Write a program that, given a list of activities with duration and list of prerequisites for each activity, does the following:

2. Write a program that, given a list of activities with duration and list of prerequisites for each activity, does the following:

3. Write a program that, given a graph with costs, does the following:

4. Write a program that, given a graph with costs, does the following:

5. Write a program that, given an undirected connected graph, constructs a minumal spanning tree using the Kruskal's algorithm.

6. Write a program that, given an undirected connected graph, constructs a minumal spanning tree using the Prim's algorithm.

Optional, "bonus" problems

1B. For an unknown tree, we are given two of the three lists representing the vertices parsed in pre-order, post-order an in-order. Reconstruct the tree.

2B. Write a program that, given a graph, does the following:

3B. Write a program that, given a graph with costs, does the following:

Radu-Lucian LUPŞA
2021-04-15