Adjacency matrix to edge list, undirected variant
Problem
A simple undirected graph is defined by an adjacency matrix, print its representation as a list of edges.
Input: Input includes number n
(\( 1<= n<=100\)) – the number of vertices in the graph, followed by n
rows of n
numbers each equal to 0
or 1
, &ndash ; its adjacency matrix.
Output: output list of edges of the given graph (in any order).
Examples
# |
Input |
Output |
1 |
5
0 0 1 0 0
0 0 1 0 1
1 1 0 0 0
0 0 0 0 0
0 1 0 0 0
|
1 3
23
25 |