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

Graph algorithms - practical work no. 1

Due: week 5-6.

Design and implement an abstract data type directed graph and a function (either a member function or an external one, as your choice) for reading a directed graph from a text file.

The vertices will be specified as integers from 0 to n-1, where n is the number of vertices.

Edges may be specified either by the two endpoints (that is, by the source and target), or by some abstract data type Edge_id (that data type may be a pointer or reference to the edge representation, but without exposing the implementation details of the graph).

Additionally, create a map that associates to an edge an integer value (for instance, a cost).

Required operations:

The operations must take no more than:

Other requirements:

Note: You are allowed to use, from existing libraries, data structures such as linked lists, double-linked lists, maps, etc. However, you are not allowed to use already-implemented graphs (though, you are encouraged to take a look at them).

Text file format: the graph will be read from a text file having the following format:

Example

Sample (partial) documentation

Random generator gen-digraph.cpp

Large input files:

Optional operations (bonus)

Radu-Lucian LUPŞA
2020-02-27