Created
June 24, 2021 09:04
-
-
Save jinhangjiang/8e198d7d7b58182441afc945c9874b41 to your computer and use it in GitHub Desktop.
igraph label vertices
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Adjacency list | |
adjlist <- get.adjlist(g) | |
adjlist[1] | |
# $Adam | |
# + 3/8 vertices, named, from 50df64b: | |
# [1] Judy Bobby Sam | |
## Edge list | |
as.data.frame(get.edgelist(g)) | |
# V1 V2 | |
# 1 Adam Judy | |
# 2 Adam Bobby | |
# ... ... | |
# 13 Jay Tom | |
# 14 Jay Jerry | |
## Adjacency matrix | |
# alternatively "as_adjacency_matrix(g)" | |
get.adjacency(g) | |
# 8 x 8 sparse Matrix of class "dgCMatrix" | |
# Adam Judy Bobby Sam Frank Jay Tom Jerry | |
# Adam . 1 1 1 . . . . | |
# Judy 1 . 1 . 1 . . . | |
# Bobby 1 1 . . 1 1 . . | |
# Sam 1 . . . 1 . 1 1 | |
# Frank . 1 1 1 . 1 1 . | |
# Jay . . 1 . 1 . 1 1 | |
# Tom . . . 1 1 1 . . | |
# Jerry . . . 1 . 1 . . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment