Exemple #1
0
def createGraph(gtype, n, p, ppitype):
    if (gtype == 'ER'):
        return nx.erdos_renyi_graph(n, p)
    elif (gtype == 'BA'):
        return nx.barabasi_albert_graph(n, int(p * n))
    elif (gtype == 'WS'):
        return nx.connected_watts_strogatz_graph(n, 8, p)
    elif (gtype == 'GEO'):
        return graphGen.geoGraphP(n, 3, p)
    elif (gtype == 'VZ'):
        # Vazquez recommends p = 0.1, q = 0.7
        # Gibson suggests p = 0.24, q = 0.887
        qmap = {0.1: 0.7, 0.24: 0.887}
        assert (p in qmap.keys())
        return graphGen.VazquezGraph(n, p, qmap[p])
    elif (gtype == 'EV'):
        qmap = {0.1: 0.7, 0.24: 0.887}
        assert (p in qmap.keys())
        return graphGen.EVGraph(n, p, qmap[p], n // 5, 0.8)
    elif (gtype == 'SL'):
        # values from Sole paper
        return graphGen.SoleGraph(n, 0.53, 0.06)
    elif (gtype == 'PPI'):
        return ppiGen.ppiGraph(n, ppitype)
    else:
        raise ValueError('Invalid graph type')
def createGraph(gtype, n, p):
    if (gtype == 'ER'):
        return nx.erdos_renyi_graph(n, p)
    elif (gtype == 'BA'):
        return nx.barabasi_albert_graph(n, int(p * n))
    elif (gtype == 'WS'):
        return nx.connected_watts_strogatz_graph(n, 8, p)
    elif (gtype == 'GEO'):
        return graphGen.geoGraphP(n, 3, p)
    elif (gtype == 'VZ'):
        # Vazquez recommends p = 0.1, q = 0.7
        # Gibson suggests p = 0.24, q = 0.887
        qmap = {0.1:0.7, 0.24:0.887}
        assert(p in qmap.keys())
        return graphGen.VazquezGraph(n, p, qmap[p])
    elif (gtype == 'EV'):
        qmap = {0.1:0.7, 0.24:0.887}
        assert(p in qmap.keys())
        return graphGen.EVGraph(n, p, qmap[p], n//5, 0.8)
    elif (gtype == 'SL'):
        # values from Sole paper
        return graphGen.SoleGraph(n, 0.53, 0.06)
    else:
        raise ValueError('Invalid graph type')