def SIR_process(G, degree_prob, tau, gamma, tmax=10):
    N = G.order()
    plt.figure(2)
    plt.clf()
    plt.figure(3)
    plt.clf()
    plt.figure(5)
    plt.clf()
    for index, starting_node in enumerate([x * N / 100. for x in range(100)]):
        plt.figure(2)
        t, S, I, R = EoN.fast_SIR(G,
                                  tau,
                                  gamma,
                                  initial_infecteds=[starting_node])
        subt = scipy.linspace(0, t[-1], 101)
        subI, subR = EoN.subsample(subt, t, I, R)
        plt.plot(subt, subI)
        if R[-1] > 500:
            plt.figure(3)
            shift = EoN.get_time_shift(t, R, threshold)
            plt.plot(subt - shift, subI)
            plt.figure(5)
            plt.plot(subt - shift, subR)
    #t, S, I, R = EoN.EBCM(degree_prob, tau, gamma, rho)
    rho = 1. / N

    def psi(x):
        return sum(degree_prob[k] * x**k for k in degree_prob)

    def psiPrime(x):
        return sum(k * degree_prob[k] * x**(k - 1) for k in degree_prob)

    t, S, I, R = EoN.EBCM_uniform_introduction(N,
                                               psi,
                                               psiPrime,
                                               tau,
                                               gamma,
                                               rho,
                                               tmax=tmax)
    shift = EoN.get_time_shift(t, R, threshold)

    plt.figure(2)
    #plt.savefig('sw_SIR_epi_N{}_p{}_k{}_tau{}.pdf'.format(N,p,k,tau))
    plt.figure(3)
    plt.plot(t - shift, I, '--')
    plt.xlabel('$t$', fontsize=18)
    plt.ylabel('$I$', fontsize=18)
    #plt.set_xtick_labels(fontsize = 15)
    xmax = get_xmax(t - shift, I)
    plt.axis(xmax=xmax)
    plt.savefig('sw_SIR_epi_N{}_p{}_k{}_tau{}_shifted.pdf'.format(
        N, p, k, tau))
    plt.figure(5)
    plt.plot(t - shift, R, '--')
def SIS_process(G, degree_prob, tmax, tau, gamma):
    N = G.order()
    plt.figure(5)
    plt.clf()
    plt.figure(6)
    plt.clf()
    for index, starting_node in enumerate([x * N / 10. for x in range(10)]):
        plt.figure(5)
        t, S, I = EoN.fast_SIS(G,
                               tau,
                               gamma,
                               initial_infecteds=[starting_node],
                               tmax=tmax)
        #print(I[-1])
        subt = scipy.linspace(0, tmax, 501)
        subI = EoN.subsample(subt, t, I)
        plt.plot(subt, subI)
        if I[-1] > 100:
            plt.figure(6)
            shift = EoN.get_time_shift(t, I, 1000)
            plt.plot(subt - shift, subI)
    plt.figure(5)
    plt.savefig('sw_SIS_epi_N{}_p{}_k{}_tau{}.pdf'.format(N, p, k, tau))
    plt.figure(6)
    plt.savefig('sw_SIS_epi_N{}_p{}_k{}_tau{}_shifted.pdf'.format(
        N, p, k, tau))