0

I wanted to assign or associate each node in the network plot with some real value (say some score) in R. Which need to be updated in iterations. Finally to plot the network graph with size of vertex according to its latest value (score).

Which property of a vertex I can use for this purpose and how? If it's not possible in igraph, is there any other way to achieve this purpose in R?

I'm new to R. Anybody please help me to sort out this problem.

user1317221_G
  • 15,087
  • 3
  • 52
  • 78
N D Thokare
  • 1,703
  • 6
  • 35
  • 57
  • create your own, e.g. if your graph is called `g` then `V(g)$Thokare <- 1:10` . Then `plot(g, vertex.size=V(g)$Thokare)`. Have you looked at the `igraph` documentation at all? – user1317221_G Dec 04 '12 at 10:40
  • Why not to give a reproducible example with a sample of your data? what did you try? – agstudy Dec 04 '12 at 13:27

1 Answers1

1

I create my gaph

graph2 <- read.table(text = '1 2 
1 3 
2 5 
3 4 
3 5 
4 5 
5 6 ')                    
par(mfrow =c(1,2)) 
graph2 <- graph.data.frame(graph2, 
           vertices = data.frame(symbols = 1:6,label   = 1:6),directed=FALSE)
plot(graph2,main='simple graph')

I change the weight property , here you can pput yor proper compting process

E(graph2)$weight <- seq(ecount(graph2))
graph.strength(graph2)

I modify property width, to visualize the weight effect

E(graph2)$width <-E(graph2)$weight                     
plot(graph2,main='weighted graph')

enter image description here

agstudy
  • 119,832
  • 17
  • 199
  • 261