Graph to Loops Decomposition

Problem #464  

Tags: c-1 implementation graphs

Who solved this?

No translations... yet
graph nodes marked on multivibrator schematic
Representing electronic circuit as a graph - marking nodes

You need not know much about electricity or electronics for solving this problem - just it is a practical problem from this field, hence this intro. One of the methods of analyzing (calculating, modelling) of electric circuits uses the "Method of Current Loops".

Such approach allows to reduce a number of unknown values (and equations) - to the number of chosen loops. English wikipedia seemingly calls it Mesh Analysis but this seems to be a special case of planar graph.

Method works with non-planar graphs either - just picking the loops becomes somewhat more tedious. That is the goal of this problem.

For example, the picture above represents symmetric multivibrator with amplifying cascade on the right. you see that every wire connecting several components represents a node (marked with red numbers). Components with more than 2 terminals (transistors here) couldn't be represented as edges and we need to put them as additional nodes. This circuit is used in the example below.

Problem statement

Given a graph description, produce a set of loops, suitable for the method described above. If something is wrong the checker will give you a hint.

Input data have the first line with the numbers of nodes V and edges E. Then some more lines follow with E pairs of numbers describing edges (edges are not directional).

Answer should give a space-separated list of loops, each as a sequnce of nodes. Start and end of a loop should be on the same node.

Example

input:
12 19
0:1 0:5 0:6 0:7 0:11 0:4 1:5 1:2 2:4 2:6 5:3 6:7 3:7 3:4 7:8 8:9 9:4 9:10 10:11

answer:
0-7-6-0 1-0-4-2-1 4-0-7-8-9-4 3-5-0-4-3 9-4-0-11-10-9 2-1-0-6-2 3-5-0-7-3 1-0-5-1

P.S. the graph generated for this problem is subject to some intuitive limitations:

You need to login to get test data and submit solution.