开发者

Plotting graph edge density with R

开发者 https://www.devze.com 2023-04-01 15:11 出处:网络
I\'m plotting the vertex degree (# of incident edges) of the graph g. deg <- degree(g, v=V(g), mode = c(\"in\"), loops = TRUE)

I'm plotting the vertex degree (# of incident edges) of the graph g.

deg <- degree(g, v=V(g), mode = c("in"), loops = TRUE)  
histdata <- hist( deg, breaks=1000, plot=FALSE )
plot(histdata$count, log="xy", type="p", col="blue", bg = "blue", pch=20,
        xlim=c(1,max(deg)),
        ylim=c(1,max(histdata$count)),
        ylab="Frequency", xlab="Degree")

This code plots this scatterplot,

Plotting graph edge density with R

which is very close to what I need but has a few issues:

1) the x labels are wrong, as they don't represent the degrees but the histogram breaks.

2) the axis bars are messy. How can I remove the empty ones?

3) how can I plot a regression line? I tried with abline a开发者_如何转开发nd lm(histdata$mids~histdata$count) but nothing gets plotted.

Thanks for any hint!

UPDATE: this plot is probably plain wrong. See http://www.hpl.hp.com/research/idl/papers/ranking/ranking.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号