Changeset - b9486351acf3
[Not reviewed]
0 1 0
Tom Bannink - 8 years ago 2017-06-03 15:49:45
tom.bannink@cwi.nl
Modify successrates cpp file for non-timeevol
1 file changed with 10 insertions and 4 deletions:
0 comments (0 inline, 0 general)
cpp/switchchain_successrates.cpp
Show inline comments
 
@@ -213,13 +213,13 @@ int main(int argc, char* argv[]) {
 

	
 
    std::ofstream outfile;
 

	
 
    if (argc >= 2)
 
        outfile.open(argv[1]);
 
    else   
 
        outfile.open("graphdata_successrates_timeevol.m");
 
        outfile.open("graphdata_successrates.m");
 

	
 
    if (!outfile.is_open()) {
 
        std::cout << "ERROR: Could not open output file.\n";
 
        return 1;
 
    }
 

	
 
@@ -233,13 +233,13 @@ int main(int argc, char* argv[]) {
 
            powerlaw_distribution degDist(tau, 1, numVertices);
 
            //std::poisson_distribution<> degDist(12);
 

	
 
            // For a single n,tau take samples over several instances of
 
            // the degree distribution.
 
            // 500 samples seems to give reasonable results
 
            for (int degreeSample = 0; degreeSample < 5; ++degreeSample) {
 
            for (int degreeSample = 0; degreeSample < 2000; ++degreeSample) {
 
                // Generate a graph
 
                // might require multiple tries
 
                for (int i = 1; ; ++i) {
 
                    std::generate(ds.begin(), ds.end(),
 
                                  [&degDist, &rng] { return degDist(rng); });
 
                    // First make the sum even
 
@@ -312,15 +312,21 @@ int main(int argc, char* argv[]) {
 
                // std::cout << std::endl;
 

	
 
                if (outputComma)
 
                    outfile << ',' << '\n';
 
                outputComma = true;
 

	
 
                std::sort(ds.begin(), ds.end());
 
                long long trianglesTotal = 0;
 
                for (int i = 0; i < measurements; ++i)
 
                    trianglesTotal += triangles[i];
 

	
 
                float avgTriangles =
 
                    float(trianglesTotal) / float(measurements);
 

	
 
                outfile << '{' << '{' << numVertices << ',' << tau << '}';
 
                outfile << ',' << triangles;
 
                outfile << ',' << avgTriangles;
 
                outfile << ',' << successRates;
 
                outfile << '}' << std::flush;
 

	
 
                std::cout << std::endl;
 
            }
 
        }
0 comments (0 inline, 0 general)