Skip to content
Back to skills

R Network Analysis

ASecurity

R network analysis with igraph, sna. Use for centrality, community detection, and network metrics.

  • 5 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 4, 2026
datanode

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned June 4, 2026

npx -y skills add LeoLin990405/r-analytics-skill --skill r-network-analysis --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of R Network Analysis?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for R Network Analysis
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leolin990405-r-network-analysis/badge)](https://www.skillsdirectory.com/skills/leolin990405-r-network-analysis)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: r-network-analysis
description: R network analysis with igraph, sna. Use for centrality, community detection, and network metrics.
---

# R Network Analysis

Graph analysis and metrics.

## igraph

```r
library(igraph)

# Create graph
g <- graph_from_data_frame(edges, directed = TRUE, vertices = nodes)
g <- graph_from_adjacency_matrix(adj_matrix)
g <- make_ring(10)

# Basic info
vcount(g); ecount(g)
V(g); E(g)
is_directed(g)

# Centrality
degree(g)
betweenness(g)
closeness(g)
eigen_centrality(g)$vector
page_rank(g)$vector

# Community detection
cluster_louvain(g)
cluster_walktrap(g)
cluster_edge_betweenness(g)
membership(communities)
modularity(communities)

# Paths
shortest_paths(g, from = 1, to = 10)
distances(g)
diameter(g)

# Network metrics
transitivity(g)  # Clustering coefficient
graph.density(g)
assortativity_degree(g)
```

## sna

```r
library(sna)

# Centrality
degree(net, cmode = "indegree")
betweenness(net)
closeness(net)

# Structural equivalence
equiv.clust(net)

# QAP correlation
qaptest(list(net1, net2), gcor, g1 = 1, g2 = 2)
```

## Network Statistics

```r
# Degree distribution
degree_distribution(g)
fit_power_law(degree(g))

# Clustering
transitivity(g, type = "local")
transitivity(g, type = "global")

# Components
components(g)
largest_component <- decompose(g)[[1]]

# Motifs
motifs(g, size = 3)
count_motifs(g, size = 3)
```

Files in this skill

  • SKILL.md1.3 KB
  • igraph/SKILL.md3.3 KB
  • network/SKILL.md3.2 KB
  • sna/SKILL.md1.4 KB
  • statnet/SKILL.md3.5 KB
  • tidygraph/SKILL.md1.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.