mathNEWS Issue 111.5: Friday, November 20, 2009

Thor's CS Problem of the Fortnight

Your morning algorithmic constitutional

Last Fortnight's Question: You are an army general in a combat situation. Your intelligence staff has acquired the plans to your enemies' communications network, a map of base stations and the cables connecting them. You wish to efficiently disrupt your opponent's communications, cutting them off from each other, by blowing up base stations. How can you determine which base stations will segment communications for the enemy force when they are destroyed?

Its Answer: As was probably obvious from the presence of the word 'network' in the problem, this is a graph theory question. A good way to determine where to strike would be to look for stations that you could destroy which would sever the communication network into two separate components. A base station (vertex) that meets this definition is called an articulation vertex. Articulation vertices can be located with a linear-time algorithm.

The algorithm first involves finding the depth first search tree. The vertices of this tree are then examined, to see if they are "cut-nodes", vertices that can be deleted to render a disconnected component. In this algorithm, we employ the concept of "earliest reachable vertex" to mean the "earliest" vertex (in the Depth First Search sense) that we can reach via a back-edge from this vertex. We examine each vertex of the DFS tree to see if it has any of the following properties: 1) It is the root node of the DFS tree, and it has two or more children. In this case, it is an articulation vertex. 2) The earliest reachable vertex from it is itself. In this case, your vertex's parent is an articulation vertex, as is the vertex itself unless it is a leaf vertex. 3) The earliest reachable vertex from it is its parent. In this case, the parent must be an articulation vertex.

This Fortnight's Question: Imagine that you look in your kitchen, and you notice that you have three ingredients for your next recipe: eggs, milk, and sugar. Assuming that a "dish" is a combination of ingredients, list the dishes that you can produce using these ingredients (don't forget the empty dish!). In general, what is an efficient way to generate all of the dishes for a set of ingredients?



Copyright © 1998 mathNEWS.