def dpa(n, m):
    outgraph = graph.make_complete_graph(m)
    dpat = DPATrial.DPATrial(m)
    i = m
    while i < n:
        outgraph[i] = dpat.run_trial(m)
        i += 1
    return outgraph
Exemplo n.º 2
0
def dpa(n, m):
    outgraph = graph.make_complete_graph(m)
    dpat = DPATrial.DPATrial(m)
    i = m
    while i < n:
        outgraph[i] = dpat.run_trial(m)
        i += 1
    return outgraph
Exemplo n.º 3
0
def upa(n,m):
    result_graph = graph.make_complete_graph(m)
    for i in range(m,n):
        edeg = []
        for count in range(m):
            edeg.append(random.choice(result_graph.keys()))
        result_graph[i] = set(edeg)
        
    return result_graph
def dpa_generator(n, m):
    """
    This method generates a random directed graph
    based on DPA algorithm
    Input: n nodes, m connections
    """
    new_graph = graph.make_complete_graph(m)
    dpa = DPATrial(m)
    for idx in range(m, n):
        neighbors = dpa.run_trial(m)
        new_graph[idx] = neighbors
    return new_graph
Exemplo n.º 5
0
def dpa_generator(n, m):
    """
    This method generates a random directed graph
    based on DPA algorithm
    Input: n nodes, m connections
    """
    new_graph = graph.make_complete_graph(m)
    dpa = DPATrial(m)
    for idx in range(m, n):
        neighbors = dpa.run_trial(m)
        new_graph[idx] = neighbors
    return new_graph
Exemplo n.º 6
0
def upa_generator(n, m):
    """
    This method generates a random directed graph
    based on UPA algorithm
    Input: n nodes, m connections
    """
    new_graph = graph.make_complete_graph(m)
    #print new_graph
    upa = UPATrial(m)
    for idx in range(m, n):
        neighbors = upa.run_trial(m)
        #print neighbors
        new_graph[idx] = neighbors
        for node in neighbors:
            new_graph[node].add(idx)
    return new_graph
Exemplo n.º 7
0
def upa_generator(n, m):
    """
    This method generates a random directed graph
    based on UPA algorithm
    Input: n nodes, m connections
    """
    new_graph = graph.make_complete_graph(m)
    #print new_graph
    upa = UPATrial(m)
    for idx in range(m, n):
        neighbors = upa.run_trial(m)
        #print neighbors
        new_graph[idx] = neighbors
        for node in neighbors:
            new_graph[node].add(idx)
    return new_graph