问题
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.
回答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')
来源:https://stackoverflow.com/questions/13699931/assign-a-numeric-real-value-to-vertex-in-network-graph