Visualizing News Diffusion Process Using Heat Graph

Published by chengjun on September 8th, 2011

# visualize diffusion according to diffusion time
# chengjunwang @ office, CMC, 2011/09/06

This is the network of diffusion, yellow node denotes those nodes who don’t diffuse the news, while the red denotes the diffuser. You can find that most of people do not diffuse the news. To reduce this misleading information, we need to merge those nodes who connects with diffusers but don’t diffuse the news. This makes the giant node in the figure below, the white node.

#~~~~~~~~~~~~~~~~~~~~~~~~~read csv~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
digg <- read.csv(file= "d:/micro-blog/digg/digg_votes1.csv", head=FALSE,na.string='NA')
 
net <- read.csv(file= "d:/micro-blog/digg/digg_net.csv", head=T) # getdirected friends network
 
# V1 is friend_date: Unix time stamp of when the friendship link was created
# user_id: anonymized unique id of a user
# friend_id: anonymized unique id of a user
#~~~~~~~~~~~~~~~~~get the name list~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
namelist<-subset(digg,digg[,3]==299) #get the name list of who votes for story 1
name<-data.frame(namelist[,2])
dim(namelist)       # number of diffuers
subnet=subset(net,net[,3]%in%name[,1])
dim(subnet)         # edge numbers
length(unique(c(subnet[,3], subnet[,4]))) # unique nodes number
########################################################################
#      merging nodes for visualization                                 #
########################################################################
g1<-subnet[,3:4]
g1[,2]<-replace(g1[,2], !(g1[,2]%in%namelist[,2]), 0)
 
library(igraph)     # install.packages("igraph")
g1<-graph.data.frame(g1, directed=T)
summary(g1)
 
V(g1)$size=log(degree(g1))
 
time<-namelist[,1][match(V(g1)$name,namelist[,2])]
time[is.na(time)]<-max(time)+1
# subset(namelist, namelist[,2]==333807) ## use this to test the sequence
code=sort(unique(time))
time=match(time,code)
# This sorts the values and assigns a unique id for each ID number
# This matches the IDs of column 1 in the edgelist to the unique IDs
V(g1)$color <- rainbow(max(time))[time]
V(g1)$color <-heat.colors(266, alpha = 1)[time]
 
par(mfrow=c(1,2))
plot(g1, vertex.label= NA,edge.arrow.size=0.2,layout=layout.kamada.kawai)
plot(rep(2,266), col=heat.colors(266),axes = FALSE, ann = FALSE)

In this figure, the nodes with dark color diffuse first, the larges nodes of white color is the merged cluster of non-diffusers. You can find that many diffusers connect with this non-diffuser giant, but they are not connected with each other, apparently, they are not influenced by the people they followed. So whom are they influence by? This is the starting point of my study of news diffusion.

# pie(rep(1,max(time)), col=rainbow(max(time)))
# plot(g1, vertex.label= NA,edge.arrow.size=0.2,layout=layout.fruchterman.reingold )
 
setwd("D:/NKS & SFI/")
savePlot(filename = "diffusion 5 news3 digg266 of 9496 users 58 isolates neglected",
         type = c( "png"),
         device = dev.cur(),
         restoreConsole = TRUE)

    分享到:


16 Responses

  1. The very heart of your writing whilst sounding reasonable initially, did not really work well with me after some time. Someplace throughout the paragraphs you actually managed to make me a believer unfortunately just for a while. I still have got a problem with your jumps in logic and you might do nicely to fill in all those breaks. In the event that you can accomplish that, I would certainly be amazed.

  2. Thanks for this helpful thread!

  3. Mulberry says:

    Grateful to the author’s share. Interesting things – hope you can pst anthor things for this have a nice day 🙂

  4. Wow that was odd. I just wrote an very long comment but after I clicked submit my comment didn’t appear. Grrrr… well I’m not writing all that over again. Anyways, just wanted to say fantastic blog!

  5. Rarely am I happy about the standard from your online content I just read today. This is certainly precisely the material I prefer to read since it makes me think.

  6. Im impressed, I must say. Incredibly rarely do I come across a weblog thats both informative and entertaining, and let me let you know, youve hit the nail on the head. Your blog is critical; the problem is some thing that not enough people are talking intelligently about. Im actually pleased that I stumbled across this in my search for some thing relating to this issue.

  7. Appreciation for that terrific weblog post. I’m glad I’ve taken the time to discover this.

  8. Cletus Dess says:

    Excellent post! I’ve bookmark this site to return later. cheers!arkadas

  9. Loving the info on this web site , you have done outstanding job on the content .

  10. Amaze! I am searching yahoo all night for this i ultimately found it outlined in this article!

  11. You made some good points there. I did a search on the issue and found most folks will go along with with your blog.

  12. Canada Goose says:

    Your post is an inspiration for me to search out out much more about this subject. I have to confess your clarity broadened my sentiments and I’ll correct away snatch your rss feed to keep as much as date on any upcoming articles you may write. You deserve thanks to get a work well executed!

  13. Aw, this was a very nice post. In concept I wish to put in writing like this additionally – taking time and precise effort to make an excellent article… however what can I say… I procrastinate alot and on no account seem to get something done.

  14. I just wanted to give a big thank you to all the wonderful people I have met in the last few weeks – a lot of us are working together and profiting very nicely =). If you missed the boat don’t worry, you can still learn how we’re making $200-$900 per day using http://Instant-Weekly-Income.info with private coaching and all that. When you’re in, just shoot me a message and I’ll be happy to add you to our group. Cheers!!

  15. nootropic says:

    You have mentioned very interesting details! ps nice site.


Leave a Reply

Your email address will not be published. Required fields are marked *