Construct a Graph from size of components for each node

#include using namespace std;  int constructConnectedComponent(int A[], int N){              bool flag = false;                  map mp;    for (int i = 0; i < N; i++) {        mp[A[i]].push_back(i);        if (A[i] != 1)            flag = true;    }      if (!flag) {        cout