def matrix2edges(matrix, graph_type):
    """
    Converts a given binary matrix to the corresponding set of edges of an undirected graph
    :param matrix: Symmetric binary matrix having zero diagonal entries
    :return edges: Set of edges where vertex labels start from 1
    """
    # Get the row and column size
    n = matrix.shape[0]
    m = matrix.shape[1]
    # Ouput edge sequence
    edges = []
    if graph_type == "simple":
        for i in range(n):
            for j in range(i, n):
                if matrix[i, j] == 1:
                    edges.append([i + 1, j + 1])

    if graph_type == "bipartite":
        for i in range(n):
            for j in range(m):
                if matrix[i, j] == 1:
                    edges.append([i + 1, j + n + 1])

    return edges