Escolar Documentos
Profissional Documentos
Cultura Documentos
L A Santos
7 de outubro de 2019
##
## Attaching package: 'igraph'
rede g1
g1 <- graph(edges = c(1,2,2,3,3,4,4,1))
plot(g1)
matriz de adjacencia g1
g1[ ]
rede g2
g2<- graph(edges = c(1,2,3,2,3,4,2,4,3,5,4,5,5,1))
plot(g2)
matriz adjacencia g2
g2[ ]
## [1] 2 3 3 3 3
degree(g2, mode="in")
## [1] 1 2 0 2 2
degree(g2, mode="out")
## [1] 1 1 3 1 1
## [1] 2 3 3 3 3
## [1] 3
get_diameter(g2)
matriz de adjacencia g3
g3[ ]
vertex_attr(g4)
## $name
## [1] "A" "B" "C"
##
## $Peso
## [1] 30 15 15
E(g4)$weight = c(3, 4, 1, 1, 7, 1)
## A B C
## 4 4 4
a<- vertex_attr(g2)$Peso
a
## [1] 50 30 16 60
b<-edge_attr(g2)$Declividade
b
## [1] 2 -1 -5 3
E(g2)$weight = c(2, 2, 5, 4)
c<-edge_attr(g2)$weight
d<- vertex_attr(g2)$Cor
d
e<- edge_attr(g2)$Cor
e