Here I upload a very basic Barabasi-Albert network generator and then a percolator which conducts percolation over the network following some rule. I have used openmp to parallelize the loops. Here 3 arrays, `maxclus`,`delmx` and `entropycalc` are shared between the parallel threads and `netmap1`,`netmap2`,`ptr` and `random` are made private to the threads. What it basically does is that, suppose you have a vector, and two arrays, then,  

    int* arrayresult = new int [N];
    int* array;
    #pragma omp parallel shared(arrayresult) private(array)
    {
       vector<int> someVec;
       array = new int [N]
       for(int k=0;k<somenum;k++) array[k] = 0;
       #pragma omp for 
       for(int i=0;i<somenum;i++)
       {
         
          // do something with someVec;
          // do something with array;
          for(int j=0;j<somenum1;j++)
          #pragma omp atomic
          arrayresult[j] += someResult;
       }
       delete [] array;
    }

Now this snippet describes the main gist of the code I am posting here. This shows a performance degradation proportional to the number of cores or threads being used. I am providing both the linear code and the parallel code. Please be kind to let me know how to make the parallel one more efficient. 

 
  
   

[Parallel Code with OpenMP][1]

[Linear Code][2]

Thank you
  [1]: https://pastebin.com/i9smRx5M
  [2]: https://pastebin.com/St97Z8HN