Showing posts with label R Language Graph. Show all posts
Showing posts with label R Language Graph. Show all posts

R Language Graph

Graph-R
 graph_attr(g4)
named list()
> plot(g4, edge.arrow.size=.5, vertex.label.color="black", vertex.label.dist=1.5,
+      vertex.color=c( "pink", "skyblue")[1+(V(g4)$gender=="male")] )
> g4s <- simplify( g4, remove.multiple = T, remove.loops = F,
+                  edge.attr.comb=c(weight="sum", type="ignore") )
> plot(g4s, vertex.label.dist=1.5)
>
> eg <- make_empty_graph(40)
> plot(eg, vertex.size=10, vertex.label=NA)
> fg <- make_full_graph(40)
> plot(fg, vertex.size=10, vertex.label=NA)
> st <- make_star(40)
> plot(st, vertex.size=10, vertex.label=NA)
> tr <- make_tree(40, children = 3, mode = "undirected")
>
> plot(tr, vertex.size=10, vertex.label=NA)
> rn <- make_ring(40)
> plot(rn, vertex.size=10, vertex.label=NA)
> er <- sample_gnm(n=100, m=40)
>
> plot(er, vertex.size=6, vertex.label=NA)
>
> sw <- sample_smallworld(dim=2, size=10, nei=1, p=0.1)
>
> plot(sw, vertex.size=6, vertex.label=NA, layout=layout_in_circle)
> ba <- sample_pa(n=100, power=1, m=1, directed=F)
> plot(ba, vertex.size=6, vertex.label=NA)
> zach <- graph("Zachary")
> plot(zach, vertex.size=10, vertex.label=NA)
> rn.rewired <- rewire(rn, each_edge(prob=0.1))
>
> plot(rn.rewired, vertex.size=10, vertex.label=NA)
> rn.neigh = connect.neighborhood(rn, 5)
> plot(rn.neigh, vertex.size=8, vertex.label=NA)