Definisi Social Network Analysis

Social Network Analysis adalah suatu metode analisis untuk mengetahui hubungan antar individu terhadap individu lain maupun dalam kelompok atau organisasi. Sehingga kita bisa mengetahui bagaimana individu atau organisasi tersebut saling berinteraksi.

Munculnya Social Network Analysis

Visualisasi dasar Social Network Analysis

Network terdiri dari titik atau dikenal dengan istilah Node/Vertex dan garis atau dikenal dengan istilah Edge

Mari mulai membuat Coding

Pertama-tama Anda harus mengaktifkan library(igraph)

library(igraph)
## Warning: package 'igraph' was built under R version 3.5.3
## 
## Attaching package: 'igraph'
## The following objects are masked from 'package:stats':
## 
##     decompose, spectrum
## The following object is masked from 'package:base':
## 
##     union
g<-graph(c(1,2))

Tampilkan Grafik

plot(g)

Nodes/Vertex diganti menjadi warna kuning

plot(g,vertex.color="yellow") 

Apabila ukuran Nodes/Vertex diperbesar gunakan fungsi vertex.size=40

plot(g,
     vertex.color="yellow",vertex.size=40)

Untuk mengganti warna Edges menjadi merah gunakan fungsi edge.color=‘red’

plot(g,
     vertex.color="yellow",
     vertex.size=40,edge.color='red')

Tampilkan Banyak Nodes

g<-graph(c(1,3,2,3,3,4,4,5,5,6,5,8,6,7))

g
## IGRAPH 74938ca D--- 8 7 -- 
## + edges from 74938ca:
## [1] 1->3 2->3 3->4 4->5 5->6 5->8 6->7

Menghitung jumlah Vertex/Node

V(g)
## + 8/8 vertices, from 74938ca:
## [1] 1 2 3 4 5 6 7 8

Menampilkan Edges

E(g)
## + 7/7 edges from 74938ca:
## [1] 1->3 2->3 3->4 4->5 5->6 5->8 6->7

Menampilkan Grafik

plot(g,vertex.color="yellow",vertex.size=20)

Gunakan fungsi directed=F untuk menghilangkan tanda panah pada garis

g<-graph(c(1,3,2,3,3,4,4,5,5,6,5,8,6,7),directed=F)

plot(g,vertex.color="pink",vertex.size=20)

Jumlah Nodes/vertex = 7

g<-graph(c(1,3,2,3,3,4,4,5,5,6,5,8,6,7),directed=F,n=7)
plot(g,vertex.color="grey",vertex.size=20)

Melihat matriks hubungan antar Nodes/vertex

g[] 
## 8 x 8 sparse Matrix of class "dgCMatrix"
##                     
## [1,] . . 1 . . . . .
## [2,] . . 1 . . . . .
## [3,] 1 1 . 1 . . . .
## [4,] . . 1 . 1 . . .
## [5,] . . . 1 . 1 . 1
## [6,] . . . . 1 . 1 .
## [7,] . . . . . 1 . .
## [8,] . . . . 1 . . .

Menampilkan grafik bershadow

plot(g,vertex.size=25,vertex.color="white",
     vertex.shape="sphere")

Menampilkan grafik tanpa pembobotan

plot(g,vertex.size=degree(g),
     vertex.color=closeness(g),vertex.shape="sphere")

Menampilkan grafik dengan pembobotan (degree * 10)

plot(g,vertex.size=degree(g)*15,
     vertex.color=closeness(g)*100,vertex.shape="sphere")