A network analyser

The problem

Model a small network of towns as a graph and answer questions about it: its degrees, its connected parts, the fewest hops between two towns and whether a route exists that uses every road exactly once.

Requirements

Technologies

Step by step

  1. Parse the roads and build the adjacency list.
  2. Compute the degrees and the sum, and compare the sum with twice the number of roads.
  3. Write BFS for components and for the shortest path with parents.
  4. Add the Euler test and run the analyser on three networks of your own, including a disconnected one.

Expected result

A report on a small network: degrees, components, shortest routes and the Euler verdict, checked against hand calculations.

How it is evaluated

Ways to improve it