I have two data files. One file contains all the date relationship like "A B", which means A has connection with B. I use this relationship to create the network with igraph
. The other one has the data which I want to color these nodes in the igraph
and of course all of these data exist in the first file.
I wrote these codes below but I'm not sure how to color them.
code:
library(igraph)
dat <-read.graph("data.txt", format = "edgelist", directed = FALSE )
answer <-read.table("color.txt")
plot.igraph(dat,vertex.size =3,vertex.label=NA,layout=layout.regionld(g,circular=T))
For example:
data.txt:
A B
B C
D A
A C
Color.txt
A
B
I want to draw network with line connected between two data in each row in data.txt and also color the data in the color.txt in the network.
I want to know how could I color these data from the answer in the igraph
.