设为首页 加入收藏

TOP

R语言构建蛋白质网络并实现GN算法(三)
2019-09-23 11:11:47 】 浏览:201
Tags:语言 构建 蛋白质 网络 实现 算法
ze=4
V(g)[deg>=2]$size=6
V(g)[deg>=3]$size=8
V(g)[deg>=4]$size=10
V(g)[deg>=5]$size=12
V(g)[deg>=6]$size=14

vertex.color 设置节点的颜色

color<-read.csv("c:/color.csv",header=F)
col<-c("red","skyblue")
V(g)$color=col[color[,1]]

vertex.label 设置节点的标记

V(g)$label=V(g)$name
vertex.label=V(g)$label

vertex.label.cex 设置节点标记的大小
edge.color 设置边的颜色

E(g)$color="grey"
for(i in 1:length(pa3[,1])){
E(g,path=pa3[i,])$color="red"
}
edge.color=E(g)$color

edge.arrow.mode 设置边的连接方式
edge.arrow.size 设置箭头的大小
E(g)$width=1 设置边的宽度

2)聚类分析

边的中介度聚类

system.time(ec <- edge.betweenness.community(g))  
print(modularity(ec))  
plot(ec, g,vertex.size=5,vertex.label=NA)  

随机游走

system.time(wc <- walktrap.community(g))
print(modularity(wc))
#membership(wc)
plot(wc , g,vertex.size=5,vertex.label=NA)  

特征值(个人理解觉得类似谱聚类)

system.time(lec <-leading.eigenvector.community(g))
print(modularity(lec))
plot(lec,g,vertex.size=5,vertex.label=NA)  

贪心策略

system.time(fc <- fastgreedy.community(g))
print(modularity(fc))
plot(fc, g,vertex.size=5,vertex.label=NA)  

多层次聚类

system.time(mc <- multilevel.community(g, weights=NA))
print(modularity(mc))
plot(mc, g,vertex.size=5,vertex.label=NA)  

标签传播

system.time(lc <- label.propagation.community(g))
print(modularity(lc))
plot(lc , g,vertex.size=5,vertex.label=NA)  

文件输出

zz<-file("d:/test.txt","w")
cat(x,file=zz,sep="\n")
close(zz)  

查看变量数据类型和长度

mode(x)
length(x)

参考链接

1.易百R语言教程

2.R语言igraph包构建网络图——详细展示构建图的基本过程

3.官方R语言igraph说明文档

4.官方R语言手册

5.R包igraph探究

6.模块度(Modularity)与Fast Newman算法讲解

7.模块发现算法综述

首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇osx使用alfred集成有道查词 下一篇R实战 第11篇:处理缺失值

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目