Input specification: the first line contains n and m (the number of vertices and edges of the graph). The vertices are labeled with numbers 1, 2, ..., n. The first line is followed by m lines, each of these lines describes an edge. The i-th of these lines contains four numbers. The first two numbers specify the end-point vertices, the third number is the weight and the fourth number is either 0 or 1 (1 means the edge belongs to F, 0 means the edge is not in F).
Output specification: the output contains one line with either the cost of a minimum-cost F-containing spanning tree, or -1 if no such spanning tree exists.
Example:
Input:
6 8
1 2 3 1
2 3 7 0
1 4 4 0
3 6 3 0
3 4 2 0
4 5 2 1
5 6 6 1
4 6 1 0
Output:
17

Respuesta :

The minimum cost F-containing spanning tree is (1, 4, 5, 6) with cost 17.

What is spanning tree?
A loop-free logical architecture for Ethernet networks is produced by the computer network method spanning tree. To ensure that there is just one channel at all between the two network nodes, it works by turning off some of the connections between network nodes. This lessens the possibility of loops, that can result in network slowdowns and disruptions. Because it only utilizes the links which are truly required, spanning trees also make efficient use of the linkages that are already accessible. In order to divide the network into more manageable chunks, it is also employed to build virtual LANs.

To learn more about spanning tree
https://brainly.com/question/29741391
#SPJ4