コード例 #1
0
import graphGenerator
import random
import subprocess
import math
import dir

st = dir.results() + "/fourthExperiment.txt"
file = open(st, 'w')
file.write("Algorithm " + "nodes " + "edges " + "power_exponent " + "steps " +
           "covering_size " + "edges_covered " + "fitness\n")

numberNodes = 500
exp = 2.1

while (exp < 3.0):

    # control status
    print("Status: graph of " + str(numberNodes) + " nodes being processed.")

    # make command
    st = dir.graph() + "/powerLawGraph_" + str(numberNodes) + "nodes_" + str(
        exp) + "deg.txt"
    cmd = dir.graphExplorer() + "/graphExplorerExe greedy " + st

    # make subprocess
    process = subprocess.Popen(cmd,
                               shell=True,
                               stdout=subprocess.PIPE,
                               stderr=subprocess.PIPE)

    # wait for the process to terminate
コード例 #2
0
import graphGenerator
import os

import random
import subprocess
import math
import dir




# (1) We first set up a text file in the
# right folder, to save the results

st = dir.results() + "/eightExperiment.txt"
print(st)
file = open(st, 'w')
file.write("Algorithm "
           + "nodes "
           + "edges "
           + "power_exponent "
           + "steps "
           + "covering_size "
           + "edges_covered "
           + "time\n")

nNodes = (100, 149, 196, 246, 296, 341, 386, 444, 489, 542, 590, 626, 673, 718, 761, 810, 855, 903)

for numberNodes1 in nNodes :
    
    # (2) We then run the algorithm via a C++
コード例 #3
0
import graphGenerator
import os

import random
import subprocess
import math
import dir
import numpy

# (1) We first set up a text file in the
# right folder, to save the results

st = dir.results() + "/sixtExperiment.txt"
file = open(st, 'w')
file.write("Algorithm " + "nodes " + "edges " + "power_exponent " + "steps " +
           "covering_size " + "edges_covered " + "fitness\n")

for numberNodes in range(100, 1000, 50):

    # (2) We first generate a random graph that has a
    # given number of nodes and with exp = 2.5

    sn = "cd " + dir.hyperbolic()
    process = subprocess.Popen(sn,
                               shell=True,
                               stdout=subprocess.PIPE,
                               stderr=subprocess.PIPE)

    #process = subprocess.Popen(sn, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    hypCmd = sn + "; " + "scons;" "./build_debug/singleexperiment --seed=1" \
                + " --save_graph=testoutput/graph --rgmodel=hyperbolic --sort --n=" \
コード例 #4
0
import graphGenerator
import random
import subprocess
import math
import dir

# (1) We first set up a text file in the
# right folder, to save the results

st = dir.results() + "/firstExperiment.txt"
file = open(st, 'w')
file.write("Algorithm " + "nodes " + "edges " + "power_exponent " + "steps " +
           "covering_size " + "edges_covered " + "fitness\n")

for numberNodes in range(100, 150, 50):

    # (2) We first generate a random graph that has a
    # given number of nodes and with exp = 2.5

    x = graphGenerator.makeGraph(numberNodes, exp=2.5)

    # (3) We then run the algorithm via a C++
    # executable and save the results 100 times

    # control status
    print("Status: graph of " + str(numberNodes) + " nodes being processed.")

    for i in range(1, 100):

        # make command
        st = dir.graphExplorer()
コード例 #5
0
import graphGenerator
import random
import subprocess
import math
import dir

st = dir.results() + "/seventhExperiment.txt"
file = open(st, 'w')
file.write("Algorithm " + "nodes " + "edges " + "power_exponent " + "steps " +
           "covering_size " + "edges_covered " + "fitness\n")

nNodes = (100, 149, 196, 246, 296, 341, 386, 444, 489, 542, 590, 626, 673, 718,
          761, 810, 855, 903)

for numberNodes in nNodes:

    # control status
    print("Status: graph of " + str(numberNodes) + " nodes being processed.")

    # make command
    st = dir.graph() + "/hyperbolicGraph_" + str(
        numberNodes) + "nodes_2.5exp.txt"
    print(st)
    cmd = dir.graphExplorer() + "/graphExplorerExe greedy " + st

    # make subprocess
    process = subprocess.Popen(cmd,
                               shell=True,
                               stdout=subprocess.PIPE,
                               stderr=subprocess.PIPE)
コード例 #6
0
import graphGenerator
import os

import random
import subprocess
import math
import dir

# (1) We first set up a text file in the
# right folder, to save the results

st = dir.results() + "/ninthExperiment.txt"
print(st)
file = open(st, 'w')
file.write("Algorithm " + "nodes " + "edges " + "power_exponent " + "steps " +
           "covering_size " + "edges_covered " + "time\n")

nNodes = (100, 149, 196, 246, 296, 341, 386, 444, 489, 542, 590, 626, 673, 718,
          761, 810, 855, 903)

for numberNodes1 in nNodes:

    # (2) We first generate a random graph that has a
    # given number of nodes and with exp = 2.5

    # (3) We then run the algorithm via a C++
    # executable and save the results 100 times

    # control status
    print("Status: graph of " + str(numberNodes1) + " nodes being processed.")
コード例 #7
0
import graphGenerator
import random
import subprocess
import math
import dir

st = dir.results() + "/secondExperiment.txt"
file = open(st, 'w')
file.write("Algorithm " + "nodes " + "edges " + "power_exponent " + "steps " +
           "covering_size " + "edges_covered " + "fitness\n")

for numberNodes in range(100, 1000, 50):

    # control status
    print("Status: graph of " + str(numberNodes) + " nodes being processed.")

    # make command
    st = dir.graph() + "/powerLawGraph_" + str(
        numberNodes) + "nodes_2.5deg.txt"
    cmd = dir.graphExplorer() + "/graphExplorerExe greedy " + st

    # make subprocess
    process = subprocess.Popen(cmd,
                               shell=True,
                               stdout=subprocess.PIPE,
                               stderr=subprocess.PIPE)

    # wait for the process to terminate
    out = str(process.stdout.read()).split(" ")

    # print to file