def __init__(self):
        #Total number of people in population
        self.M = 1000
        numInitialInfected = 5

        #The graph is one in which edges represent a contact
        undirected = True
        self.graph = HIVGraph(self.M, undirected)

        for i in range(self.M):
            vertex = self.graph.getVertex(i)

            #Set the infection time of a number of individuals to 0
            if i < numInitialInfected:
                vertex[HIVVertices.stateIndex] = HIVVertices.infected
            

        p = 0.01
        generator = ErdosRenyiGenerator(p)
        self.graph = generator.generate(self.graph)
        
        perm1 = numpy.random.permutation(self.M)
        perm2 = numpy.random.permutation(self.M)        
        
        sizes = [200, 300, 500, 1000]
        self.summary1 = [] 
        self.summary2 = [] 

        for size in sizes: 
            self.summary1.append(self.graph.subgraph(perm1[0:size]))
            self.summary2.append(self.graph.subgraph(perm2[0:int(size/10)]))
        
        print(self.graph)
Example #2
0
    sigmaSqSum = (sigma[0:r2]**2).sum()
    bound = gammaSqSum + lmbdaSqSum - 2*sigmaSqSum
    print("r=" + str(r))
    
    print("gammaSqSum=" + str(gammaSqSum))    
    print("lmbdaSqSum=" + str(lmbdaSqSum))    
    print("sigmaSqSum=" + str(sigmaSqSum))    
    
    return bound 

#Change to work with real Laplancian 
numRows = 100 
graph = SparseGraph(GeneralVertexList(numRows))

p = 0.1 
generator = ErdosRenyiGenerator(p)
graph = generator.generate(graph)

print(graph)

AA = graph.normalisedLaplacianSym()



p = 0.001
generator.setP(p)
graph = generator.generate(graph, requireEmpty=False)

AA2 = graph.normalisedLaplacianSym()

"""
Name: Generate Graph:
Author: Jia_qiu Wang(王佳秋)
Data: December, 2016
function:
"""

from apgl.graph.DenseGraph import DenseGraph
from apgl.graph.GeneralVertexList import GeneralVertexList
from apgl.generator.ErdosRenyiGenerator import *

numVertices = 20
graph = DenseGraph(GeneralVertexList(numVertices))
p = 0.2
generator = ErdosRenyiGenerator(p)
graph = generator.generate(graph)


Example #4
0
    bound = gammaSqSum + lmbdaSqSum - 2 * sigmaSqSum
    print("r=" + str(r))

    print("gammaSqSum=" + str(gammaSqSum))
    print("lmbdaSqSum=" + str(lmbdaSqSum))
    print("sigmaSqSum=" + str(sigmaSqSum))

    return bound


#Change to work with real Laplancian
numRows = 100
graph = SparseGraph(GeneralVertexList(numRows))

p = 0.1
generator = ErdosRenyiGenerator(p)
graph = generator.generate(graph)

print(graph)

AA = graph.normalisedLaplacianSym()

p = 0.001
generator.setP(p)
graph = generator.generate(graph, requireEmpty=False)

AA2 = graph.normalisedLaplacianSym()

U = AA2 - AA

#print(U)