R语言igraph包学习(2)——生成无向图

小微 科技R语言igraph包学习(2)——生成无向图已关闭评论99字数 724阅读模式
摘要与大部分R语言包不同,igraph包没有自带的数据集。生成图对象是,进行图分析的前提。前面说了,igraph包有8中图对象。薛薇老师的《R语言数据挖掘方法及应用》提供了igraph...

与大部份R语言包不同,igraph包没有自带的数据集。

生成图对象是,进行图分析的条件。前面说了,igraph包有8中图对象。文章源自微观生活(93wg.com)微观生活-https://93wg.com/2205.html

薛薇老师的《R语言数据发掘办法及利用》提供了igraph包的利用教程。文章源自微观生活(93wg.com)微观生活-https://93wg.com/2205.html

然而在学习中,我也发现薛老师书中有很过错,需要调剂。文章源自微观生活(93wg.com)微观生活-https://93wg.com/2205.html

下面是相干代码及解释。文章源自微观生活(93wg.com)微观生活-https://93wg.com/2205.html

library文章源自微观生活(93wg.com)微观生活-https://93wg.com/2205.html

薛老师原书是画出四个图,并不好,这句代码不要。文章源自微观生活(93wg.com)微观生活-https://93wg.com/2205.html

set.seed文章源自微观生活(93wg.com)微观生活-https://93wg.com/2205.html

G1<-graph.formula再用plot,就能够看到G1对应图文章源自微观生活(93wg.com)微观生活-https://93wg.com/2205.html

V$label.cex<-0.7文章源自微观生活(93wg.com)微观生活-https://93wg.com/2205.html

E$label<-c文章源自微观生活(93wg.com)微观生活-https://93wg.com/2205.html

E$curved<-TRUE

vcount

ecount

plot

G1<-simplify

G2<-graph.empty

V$name<-V$label<-LETTERS[1:4]

G2<-add.edges)

E$label<-c

E$curved<-TRUE

V$label.cex<-0.7

plot

G3<-graph.empty

V$name<-V$label<-LETTERS[1:9]

G3<-add.edges)

E$label<-c

G3<-set.vertex.attribute)

V[discrete]$shape<-&34;

V[!discrete]$shape<-&34;

G3<-set.vertex.attribute)

E$curved<-TRUE

V$label.cex<-0.7

is.connected

sapply,FUN=subcomponent,graph=G3)

G4<-k.regular.game

V$name<-V$label<-LETTERS[1:10]

以上就是微观生活(93wg.com)关于“R语言igraph包学习(2)——生成无向图”的详细内容,希望对大家有所帮助!

 
小微
  • 版权声明: 本文部分文字与图片资源来自于网络,转载此文是出于传递更多信息之目的,若有来源标注错误或侵犯了您的合法权益,请立即通知我们(管理员邮箱:81118366@qq.com),情况属实,我们会第一时间予以删除,并同时向您表示歉意,谢谢!
  • 转载请务必保留本文链接:https://93wg.com/2205.html