コード例 #1
0
def generate_graph(n, beta, mean_degree):
    """
    Test Graph generation
    """
    G = nx.empty_graph(n)
    
    degreeArray = utils.degreeDistribution(beta, n, mean_degree)
    
    utils.randPairings(G, degreeArray)
    
    # output of the RGG
    if not os.path.exists('generated'):
        os.mkdir('generated')
    
    txtName = "generated/adj-%s-%s-%s-.txt" % (str(n), str(beta), str(mean_degree))
    nx.write_adjlist(G, txtName)
    
    # plotting
    utils.drawDegreeHistogram(G)
    if n < 1000:
        utils.drawGraph(G)
    pngname = "generated/graph-%s-%s-%s-.png" % (str(n), str(beta), str(mean_degree))
    plt.savefig(pngname)
    
    if not os.path.exists('feed'):
        os.mkdir('feed')
    
    utils.generateFeed(n)
コード例 #2
0
def generate_graph(n, beta, mean_degree):
    """
    Test Graph generation
    """
    G = nx.empty_graph(n)

    degreeArray = utils.degreeDistribution(beta, n, mean_degree)

    utils.randPairings(G, degreeArray)

    # output of the RGG
    if not os.path.exists('generated'):
        os.mkdir('generated')

    txtName = "generated/adj-%s-%s-%s-.txt" % (str(n), str(beta),
                                               str(mean_degree))
    nx.write_adjlist(G, txtName)

    # plotting
    utils.drawDegreeHistogram(G)
    if n < 1000:
        utils.drawGraph(G)
    pngname = "generated/graph-%s-%s-%s-.png" % (str(n), str(beta),
                                                 str(mean_degree))
    plt.savefig(pngname)

    if not os.path.exists('feed'):
        os.mkdir('feed')

    utils.generateFeed(n)
コード例 #3
0
def RGG(n, beta, mean_degree):
    G = nx.empty_graph(n)
    degreeArray = utils.degreeDistribution(beta, n, mean_degree)
    utils.randPairings(G, degreeArray)
    txtName = "generated/adj-%s-%s-%s-.txt" % (str(n), str(beta), str(mean_degree))
    nx.write_adjlist(G, txtName)
    utils.drawDegreeHistogram(G)
    if n < 1000:
        utils.drawGraph(G)
    pngname = "generated/graph-%s-%s-%s-.png" % (str(n), str(beta), str(mean_degree))
    plt.savefig(pngname)
コード例 #4
0
def RGG(n, beta, mean_degree):
    G = nx.empty_graph(n)
    degreeArray = utils.degreeDistribution(beta, n, mean_degree)
    utils.randPairings(G, degreeArray)
    txtName = "generated/adj-%s-%s-%s-.txt" % (str(n), str(beta),
                                               str(mean_degree))
    nx.write_adjlist(G, txtName)
    utils.drawDegreeHistogram(G)
    if n < 1000:
        utils.drawGraph(G)
    pngname = "generated/graph-%s-%s-%s-.png" % (str(n), str(beta),
                                                 str(mean_degree))
    plt.savefig(pngname)