Thak you for helping me, now everything is fine. Sorry if I wrote you the same question more times, I was not sure I was in the mailing list. D.N.
2017-05-30 12:43 GMT+02:00 Tamas Nepusz <[email protected]>: > Hi, > > This question was already answered here on the mailing list: > > https://lists.nongnu.org/archive/html/igraph-help/2017-05/msg00042.html > > T. > > On Tue, May 30, 2017 at 12:34 PM, Daniele Notarmuzi < > [email protected]> wrote: > >> 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 >> >> About the first question I was suggested here ( >> https://lists.nongnu.org/archive/html/igraph-help/2011-04/msg00043.html) >> 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 >> https://stackoverflow.com/questions/10067721/can-i-change-th >> e-colour-of-edges-containing-specific-vertices-in-igraph-python >> 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. >> >> _______________________________________________ >> igraph-help mailing list >> [email protected] >> https://lists.nongnu.org/mailman/listinfo/igraph-help >> >> > > _______________________________________________ > igraph-help mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/igraph-help > >
_______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
