Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Python: draw a figure about graph theory and networks

Options
  • 11-02-2016 2:50pm
    #1
    Registered Users Posts: 3


    I would like to draw a figure from complex formula about graph theory and networks by python. The formula is λmin(H)/λmax(H)<2k/nd(H). Let G1 , G2 be two graphs on n1 and n2 vertices, respectively, and let H be the graph obtained by adding k edges between G1 and G2. λ is eigenvalue.

    Then, the ratio 􏰁λmin/λ􏰁max for two copies of a random graph G of 500 vertices connected to each other by 20 links.

    I tried like following but it must be wrong.

    from __future__ import division
    import pylab
    import numpy as np
    import matplotlib.pyplot as plt

    plt.plot( [0])
    plt.legend()

    x = np.linspace(0,120,121)
    y = 2*20 / 500*x
    plt.plot(x,y)

    plt.xlim([0,120])
    plt.ylim([0.0001,100])

    plt.yscale("log")

    plt.title("Graph Synchronization")
    plt.xlabel("p")
    plt.ylabel("lamda-min / lamda-max")
    plt.show()
    Tagged:


Advertisement