Networks in R

HSE; Networks in R

> library(igraph)
 
Attaching package: ‘igraph’
 
The following objects are masked from ‘package:stats’:
 
    decompose, spectrum
 
The following object is masked from ‘package:base’:
 
    union
 
> g1 <- graph( edges=c(1,2, 2,3, 3, 1), n=3, directed=F )
> plot(g1)
> g2 <- graph( edges=c(1,2, 2,3, 3, 1), n=3, directed=TRUE )
> plot(g2)
> plot(graph_from_literal(a--+b, b+--c))
> plot(graph_from_literal(a--+b, b+--c, a--c))
> plot(graph_from_literal(a--+b, b+--c, a-c))
> plot(graph_from_literal(a--+b, b+--c, a++c))
> V(g2)$name
NULL
> V(g2)$name <- c("Ana","Bob","Cak")
> plot(g2)
> edge_attr(g2)
list()
> vertex_attr(g2)
$name
[1] "Ana" "Bob" "Cak"
 
> link_attr=edge_attr
> link_attr(g2)
list()
> node_attr=vertex_attr
> node_attr(g2)
$name
[1] "Ana" "Bob" "Cak"
>
vlado/notes/rnet.txt · Last modified: 2017/09/17 03:26 by vlado
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki