Sale!

# CS 2110 Lab 10 Heuristic Solutions for Graph Problems

\$30.00 \$18.00

## Description

You are given an undirected simple graph G = (V, E). Let V1 and V2 partition V . Edges of the
form (v1, v2), v1 ∈ V1 and v2 ∈ V2 are called bridges induces by the partition V1 and V2. You
are to report a two-part partition of V such that the number of bridges is maximized.
0.1 Command Line Arguments
Your command line argument for this assignment is a single input file name.
0.2 The Input File Format
Each input file should contain one graph. The format is as follows. First you must have an
integer n which represents the number of vertices on which the graph is defined. Given n, the
n-element vertex set is implicitly understood to be {0, 1, . . . , n − 1}. Then, you will need to
have a n × n binary matrix. The following is an example.
4
1 0 0 1
1 0 1 1
0 0 0 0
0 1 0 1
1
Couple of notes regarding the input:
1. The input may not be a symmetric matrix. If either aij = 1 or aji = 1, then you should
interpret it as an undirected edge between vertex i and vertex j.
2. The input can be in free format. The elements in the matrix need not be formatted
in the proper matrix format. The only guarantee you have is that each element of the
matrix is separated from the next (taken in row major sequence) by some white space.
For example, the following is equivalent to the above input example.
4 1 0 0 1 1 0
1 1
0 0 0
0
0 1
0 1
0.3 Output
For this lab, you again get a reprieve from strict output formatting. You must simply report
all the required information in an understandable way.
You must report:
1. the elements of part V1 in increasing order (note that V2 is implied),
2. the number of bridge edges,
3. a list of bridge edges.