Good morning,
I use python 2.7.5 on ubuntu 14.04 and python-igraph 0.6.5
I have the following problem: I have a network with N nodes and and array of N numbers, each between O and 1.
I need:
1) the color of nodes i and j has to be the same if array[i] == array[j]
2) the color of edge ij has to be given according to this criterion:
if( array[i] <= array[j] ):
color_of_edge_ij = color_of_node_j
else:
color_of_egde_ij = color of node_j
to assign manually the color to each node:
g.vs[0]["color"] = "red"
g.vs[1]["color"] = "blue"
.
.
.
g.vs[N]["color"] = "black"
then I can do
for i in (0,N):
for j in (i+1,N):
if (array[i] == array[j]):
g.vs[i]["color"] = g.vs[j]["color"]
This works but if N is a big number is not practicable to assign manually a color to each node.
About the second question, I'vs tried to adapt the code in
to my case but the best I obtained was two different colors.
In practice, I need a way to have univocal correspondence between numbers in [0,1] and colors. How can I obtain this? (maybe using palette?)
thanks in advance.