I'm really new to python and igraph, so the question may be really easy.

I have a network with 128 nodes and an array of 128 numbers, each between 0 and 1. Numbers represent a feature of nodes.

I want two things:

* the color of nodes `i` and `j` has to be the same if `array[i] == array[j]`
* the color of the edge between `i` and `j` has to be given according to this criterion: `if array[i]<=array[j] -> color_edge[ij] = color_node[i]
else color_edge[ij] = color_node[j]`

I tried many thing, and I think the major problems are:

* `g.vs[i]["color"] = number` doesn't work.I have to insert a string of the type "red" or "HTML notation for color". But how can I associate each number of my array to a string?
* `g.es["color"]` gives a color to all links. However `g.es[i]["color"]` doesn't work (here `g` is my graph and in `g.es[i][".."]`, `i` is the ID of the edge).

About the first question, the only solution I can propose is to assign MANUALLY a color to each node like 

`g.vs[0]["color"] = "red"
.
.
.
g.vs[127]["color"] = "blue"`

then check the condition on `array` and eventually change the color of one of the two nodes (`g.vs[i]["color"] = g.vs[j]["color"]`). But it's a huge loss of time and is not a general way to do that (what if the network has 10^6 nodes?). I was suggested in this [here](https://lists.nongnu.org/archive/html/igraph-help/2011-04/msg00043.html)

About the second question, I tried to adapt the code in [here](https://stackoverflow.com/questions/10067721/can-i-change-the-colour-of-edges-containing-specific-vertices-in-igraph-python) to my case but the best I obtained was two different colors (and morover I don't understand how they are "the choosen two")

How can I solve this?

P.s. I know I asked two questions, but I think they're very related. However, if necessary, I can edit this post and create a new one.

Thanks in advance.