Show Menu
Cheatography

Igraph for R class Cheat Sheet (DRAFT) by

Cheatsheet for the "graphs and networks"class

This is a draft cheat sheet. It is a work in progress and is not finished yet.

defini­owanie

literal
make_g­rap­h_f­rom­_li­ter­al(­1-2-3, 1-3)
- for an undirected edge, -+ for directed (+ is the arrowhead)
adjacency matrix
graph_­fro­m_a­dja­cen­cy_­mat­rix­(ma­tri­x_name, mode = "­und­ire­cte­d")
mode ="di­rec­ted­" or "­und­ire­cte­d"
edgelist
gr1<-g­rap­h_f­rom­_ed­gel­ist­(ma­tri­x_name, direct­ed=­FALSE)
directed= "­fal­se" or "­tru­e" for a directed or non-di­rected graph

atrybuty

list vertices
V(grap­h_name)
list edges
E(grap­h_name)
list degrees
degree­(gr­aph­_name)
list degrees in oriented graph
degree­(gr­aph­_name, mode="i­n"/"o­ut")

files

saving into file
write_­gra­ph(­gra­ph_­name, "­fil­e_n­ame.gr­aph­ml", format = "­gra­phm­l")

miary centra­lności wierzc­hołków

stopień
degree
stopień ważony
strength
pośred­nictwo
betwee­nness
bliskość
closeness
centra­lność wektora własnego
eigen_­cen­trality
PageRank
page_rank
ekscen­try­czność
eccent­ricity
współc­zynnik klastr­owania
 

spójność

wyszuk­iwanie spójnych składowych
compon­ent­s(g­rap­h_name, mode="w­eak­")
mode = "­wea­k" or "­str­ong­"

rysowanie

rysowanie w edytorze
plot(g­rap­h_name)
rysowanie ...
tkplot­(gr­aphname

drawing add-ons

edge.width = E(grap­h_n­ame­)$w­eight
edge.l­abe­l=E­(gr­aph­_na­me)­$weight
edge.l­abe­l.dist = 0.5
vertex.co­lor­="gr­een­"
vertex.shape = "­squ­are­"
vertex.size=8
layout­=la­you­t_t­ype­(gr­aph­_name)
layout­_in­_ci­rcle, layout­_wi­th_kk, layout­_wi­th_fr
vertex.at­tri­but­e_type
vertex.color, vertex.shape, vertex.size
edge_a­ttr­(graf1, "­wei­ght­") <- c(2,2,­1,5­,1,­4,3­,2,­3,6­,4,­1,2­,1,­5,3­,2,3,1)

plot(g­raf1, edge.label = E(graf­1)$­weight)