Example #1
0
def experiment4():
    graph = graphs.randomGraph(20, 30)  #graphs.prefAttach(15, 4)
    col = cnum.greedy(graph,
                      strategy=nx.coloring.strategy_connected_sequential_dfs)
    pos = nx.spring_layout(graph, iterations=2000)
    nx.draw(graph, pos, node_color=[col[i] for i in range(20)])
    plt.show()
Example #2
0
def clusterChromatic(nodes, maxedges, avgrepeat, strategy):
    clist = []
    suma = 0
    for edges in range(maxedges):
        for i in range(avgrepeat):
            graph = graphs.clusterGraph(nodes, edges + 1, 0.9)
            c = cnum.chromaticNumber(cnum.greedy(graph, strategy))
            suma += c
        average = suma / avgrepeat
        suma = 0
        clist.append(average)
    return clist