コード例 #1
0
        # directory of new graph
        x = dir.graph() + "/hyperbolicGraph_" + str(numberNodes1) + "nodes_2.5exp.txt"

        # make command
        st = dir.graphExplorer()
        seed = i
        cmd = st + "/graphExplorerExe EA " \
                 + x + " 1 " \
                 + str(int(8 * numberNodes1 * math.log(numberNodes1))) + " " \
                 + str(random.randint(1, 100))

        # 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
        file.write("EA " + str(numberNodes1) + " "
                         + out[1]
                         + " 2.5 "
                         + str(int(8 * numberNodes1 * math.log(numberNodes1)))
                         + " " + out[2]
                         + " " + out[3]
                         + " " + dir.str_subtract(out[4], "'"))
        file.write("\n")

file.close()
コード例 #2
0
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
    out = str(process.stdout.read()).split(" ")

    # print to file
    file.write("greedy " + str(numberNodes) + " " + out[1] + " " + str(exp) +
               " " + str(int(8 * numberNodes * math.log(numberNodes))) + " " +
               out[2] + " " + out[3] + " " + dir.str_subtract(out[4], "'"))
    file.write("\n")

    #increase exponent
    exp = round(exp + 0.05, 2)

file.close()