Fantastic Network |
An undirected weighted graph G = (V, E) is defined as a Fantastic network if it has the following properties:
Here, cycle is defined as a path < v0, v1,..., vk > in any graph such that the following statements hold:
An edge dominating set for an undirected graph G = (V, E) is a subset F of E such that every edge not included in F is adjacent to (i.e. shares a vertex with) some edge in F. The weight of an edge dominating set is the sum of the weights of all edges in that set. Given a Fantastic network with positive edge weights, you need to determine the weight of the minimum weight edge dominating set.
First line of the input contains a positive integer T (T100). The first line of each of the T cases contains two integers N ( 2N5000) and M ( 1M2*N), representing the number of nodes and edges, respectively, in a Fantastic network. Each of the following M lines contains 3 integers ui, vi, wi, which means there is an edge from ui to vi ( 1ui, vin) with weight wi ( 1wi10000).
For each case, print a line of the form `Case x: y', where x is the case number and y is the weight of minimum weight edge dominating set of the given Fantastic network.
2 3 2 1 2 1 1 3 2 7 6 1 2 2 1 3 1 2 4 2 2 5 1 3 6 2 3 7 1
Case 1: 1 Case 2: 2
Problemsetter: Anindya Das
Special Thanks: Md. Shiplu Hawlader