Social network analysis (SNA) is the methodical analysis of social networks. Social network analysis views social relationships in terms of network theory, consisting of nodes (representing individual actors within the network) and ties (which represent relationships between the individuals, such as friendship, kinship, organizational position, sexual relationships, etc.)
Questions tagged [sna]
296 questions
81
votes
6 answers
Subscript out of bounds - general definition and solution?
When working with R I frequently get the error message "subscript out of bounds". For example:
# Load necessary libraries and data
library(igraph)
library(NetData)
data(kracknets, package = "NetData")
# Reduce dataset to nonzero…

histelheim
- 4,938
- 6
- 33
- 63
14
votes
4 answers
How to create weighted adjacency list/matrix from edge list?
My problem is very simple: I need to create an adjacency list/matrix from a list of edges.
I have an edge list stored in a csv document with column1 = node1 and column2 = node2 and I would like to convert this to a weighted adjacency list or a…

Milo
- 185
- 1
- 1
- 9
9
votes
1 answer
Show edge attributes as label with igraph
I am using igraph in R for network analysis. I want to display an edge attribute on each line in the plot. An example is below
df <- data.frame(a = c(0,1,2,3,4),b = c(3,4,5,6,7))
nod <- data.frame(node = c(0:7),wt = c(1:8))
pg <-…

user2997345
- 121
- 1
- 2
9
votes
2 answers
Community detection with InfoMap algorithm producing one massive module
I am using the InfoMap algorithm in the igraph package to perform community detection on a directed and non-weighted graph (34943 vertices, 206366 edges). In the graph, vertices represent websites and edges represent the existence of a hyperlink…

timothyjgraham
- 1,142
- 1
- 15
- 28
9
votes
1 answer
How to create a bipartite network in R with igraph or tnet
I have an edgelist for a two mode network, similar to this:
person Event
Amy football_game
Sam picnic
Bob art_show
I want to perform an analysis on this in R, but seemingly everything I try fails. Converting it to a one mode network…

Olga Mu
- 908
- 2
- 12
- 23
8
votes
1 answer
igraph vs sna: can one do something well the other can't or does poorly?
When it comes to network analysis in R, I am a relatively familiar with igraph but not at all with sna.
My question are:
Are these two libraries compatible? i.e. Can I apply an operation from sna to a graph created in igraph and vice versa?
Are…

rafa.pereira
- 13,251
- 6
- 71
- 109
7
votes
2 answers
Python 2.7 NetworkX (Make it interactive)
I am new to NetworkX. Right now, I manage to connect all the nodes to this particular node. What I want to do next it to make it interactive e.g. able to make each of the node move by dragging using cursor. I know I have to make use of matplotlib,…

Zul Hazmi
- 329
- 2
- 5
- 13
7
votes
1 answer
Conditional removing of vertices based on attributes in r
I am working with a graph that has 121 vertices and 209 edges and I am trying to remove from this graph vertices that satisfy two conditions:
degree(my.graph)==0
the name of the vertex begins with a specified character.
Here is an example showing…

Justyna
- 737
- 2
- 10
- 25
6
votes
1 answer
How to set the resolution parameter for Louvain modularity in igraph?
is there a way to set the resolution parameter when using the function cluster_louvain to detect communities in igraph for R? It makes a lot of difference for the result, as this parameter is related to the hierarchical dissimilarity between nodes.…

Marco
- 347
- 3
- 18
5
votes
3 answers
FAST way to sum up neighbors' attributes in a large graph in R
I have a large igraph object with almost a 1M nodes and 1.5M edges. After researching a while I could not find a procedure to sum a node's neighbors attributes, in this case, it's a binary one. At the moment, the best solution I found way the…

Cristobal
- 309
- 1
- 6
5
votes
3 answers
Generating an edge list from ID and grouping vectors
I have a data frame of 205,000+ rows formatted as follows:
df <- data.frame(project.id = c('SP001', 'SP001', 'SP001', 'SP017', 'SP018', 'SP017'),
supplier.id = c('1224', '5542', '7741', '1224', '2020', '9122'))
In the actual data…

user3179350
- 75
- 5
5
votes
1 answer
FAST way to iterate over vertices and compute new attributes based on that of neighbors
I'm doing a simple task: to iterate over all vertices and compute new attribute based on that of their neighbors. I search the SO and so far I know there are at least three way to do it:
Use ad_adj_list to create a adj list and then iterate over…

R. Zhu
- 415
- 4
- 16
5
votes
1 answer
R - Vertex attributes - 'Inappropriate value given in set.vertex.attribute.'
I have a data.frame containing values I want to use as attributes in a network file.
When I try to assign the values as attributes manually half of them work but the other half show this error. I have looked closely at the data and I cannot see…

Tom Davidson
- 737
- 1
- 8
- 16
4
votes
4 answers
Time varying network in r
I have data on every interaction that could and did happen at a university club weekly social hour
A sample of my data is as follows
structure(list(from = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L,
2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L), .Label…

CJ12
- 487
- 2
- 10
- 28
4
votes
1 answer
Finding the size of biconnected components in R
I am analyzing an undirected graph in R. I'm trying to (eventually) write a function to get the ratio of the size (number of vertices) of the largest connected component to the size of the largest biconnected component - of any random graph. I was…

Audrey
- 99
- 7