第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定

R包—iGraph

这几天收到师兄的任务,熟悉iGRaph包的使用,通过查资料,外加自己的实践,在此做个简单的学习笔记。

以下例子均是在R 3.0.1版本下测试的。

1.用igraph创建图表

 g<- graph(c(1,2, 1,3, 1,4, 2,4, 3,4), directed=T)
 > g IGRAPH D--- 4 5 --
 
 > plot(g, layout=layout.fruchterman.reingold)
2.创建多种图形的图表
 
 > g1 <- graph.full(4) > g1 IGRAPH U--- 4 6 -- Full graph + attr: name (g/c), loops (g/x)
 > g2 <- graph.ring(3) > g2 IGRAPH U--- 3 3 -- Ring graph + attr: name (g/c), mutual (g/x), circular (g/x)
 > g3 = graph.lattice(c(3,4,2))#create a lattice > g3 IGRAPH U--- 24 46 -- Lattice graph + attr: name (g/c), dimvector (g/n), nei (g/n), mutual (g/x), circular (g/x)
 >g4 = graph.tree(50, children=2)#create a tree > g4 IGRAPH D--- 50 49 -- Tree + attr: name (g/c), children (g/n), mode (g/c)
 
 
 
 
 
 4.简单图表的算法
 
 g <- erdos.renyi.game(12, 0.35) > g IGRAPH U--- 12 21 -- Erdos renyi (gnp) graph + attr: name (g/c), type (g/c), loops (g/x), p (g/n)
 > E(g)$weight <- round(runif(length(E(g))),2) * 50#Create the graph and assign random edge weights
 
 > mst <- minimum.spanning.tree(g)#Compute the minimum spanning tree > mst IGRAPH U-W- 12 11 -- Erdos renyi (gnp) graph + attr: name (g/c), type (g/c), loops (g/x), p (g/n), weight (e/n)
 
 
最短路径算法:
 
 > pa <- get.shortest.paths(g, 5, 9)[[1]]
> pa
[1] 5 3 9
> V(g)[pa]$color <- 'green'
> E(g)$color <- 'grey'
> E(g, path=pa)$color <- 'red'
> E(g, path=pa)$width <- 3
> plot(g, layout=layout.fruchterman.reingold)

 > plot(mst, layout=layout.reingold.tilford, edge.label=E(mst)$weight)
 > plot(g, layout=layout.fruchterman.reingold, edge.label=E(g)$weight)
 
http://blog.sina.com.cn/s/blog_60034d4a0101e12h.html


點(diǎn)擊查看更多內(nèi)容
TA 點(diǎn)贊

若覺得本文不錯,就分享一下吧!

評論

作者其他優(yōu)質(zhì)文章

正在加載中
  • 推薦
  • 評論
  • 收藏
  • 共同學(xué)習(xí),寫下你的評論
感謝您的支持,我會繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊有機(jī)會得

100積分直接送

付費(fèi)專欄免費(fèi)學(xué)

大額優(yōu)惠券免費(fèi)領(lǐng)

立即參與 放棄機(jī)會
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號

舉報

0/150
提交
取消