Menu

5 Processing List Edges 51 Listing Edges 5 Points Write O N 2 Program Whose Input Adjacenc Q43809959

80% 18:35 F DOC-202001... @ t : Processing the list of des ing the pas

5 Processing the list of edges
5.1 Listing all the edges (5 points)
Write an O(n
2
) program whose input is the adjacency matrix of a graph G.
The program should print the list of all the edges (withoutrepetition). For
example, if the vertices of the graph are 0, 1, 2, 3, 4, 5 with 0adjacent to 1 and
5, 1 adjacent to 5 2 adjacent to 3 and 4 and 3 adjacent to 4 thenthe printed
list should be something like.
0 1
0 5
1 5
2 3
2 4
3 4
5.2 Removal of an edge (5 points)
Let G be a graph and e be an edge of G. We denote by Ge the graphobtained
from G by removal fo e. That is, the vertices of G e are the sameas in G and
the edges of G e are all the edges of G but e.
Write a program whose input is the adjacency matrix of a graph Gand two
vertices i and j such that that are adjacent in G. The programshould print the
adjacency matrix of G {i, j} (that is G with the edge between iand j being
removed).
5.3 Listing all the bridges (10 points)
Let G be a connected graph and e be an edge of G. We say that e isa bridge
of G if G e is not connected (put it differently, the removal ofe breaks the
connectivity of G).
Assume that we have a function Connect whose input is theadjacency
matrix of a graph and the output is true if the graph is connectedand f alse
otherwise. Using this procedure, design an algorithm that printsall the bridges
of G.
Hint: Use the algorithm for the first part of that question forexploration of
all the edges. Rather than printing the curretly considered edgestraightaway,
use the Connect procedure to check whether the given edges is abridge (the
whole non-triviality of this task is how to apply Connect in thiscontext). Print
only those edges for which Connect retrns true.

java or python

80% 18:35 F DOC-202001… @ t : Processing the list of des ing the pas Show transcribed image text 80% 18:35 F DOC-202001… @ t : Processing the list of des ing the pas

Expert Answer


Answer to 5 Processing the list of edges 5.1 Listing all the edges (5 points) Write an O(n 2 ) program whose input is the adjacenc…

OR