def getEdgeListFromAdjMtx(adj, threshold=0.0, is_undirected=True,
    edge_pairs=None):
    """Function to get edgelist from adjaceny matrix."""
    result = []
    node_num = adj.shape[0]
    if edge_pairs:
        for st, ed in edge_pairs:
            if adj[st, ed] >= threshold:
                result.append((st, ed, adj[st, ed]))
    else:
        for i in range(node_num):
            for j in range(node_num):
                if j == i:
                    continue
                if is_undirected and i >= j:
                    continue
                if adj[i, j] > threshold:
                    result.append((i, j, adj[i, j]))
    return result
