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
4
votes
1 answer
Assigning random edge weights to graph
I want to create a random weighted and directed graph in R. I use the erdos.renyi.game to create a random directed graph, but I am unsure of how to create weights to the established connections:
library(igraph)
g01 <- erdos.renyi.game(25, 1/10,…

user3731465
- 93
- 1
- 7
4
votes
1 answer
Calculate degree, closeness and betweenness in R
I have a data table which consists of names of users who post in the same thread in a forum, it looks like that:
X1 X2
1. g79 kian
2. g79 greyracer
3. g79 oldskoo1 ...
I need to calculate degree, closeness and betweenness. I'm using the…

Tash
- 53
- 1
- 7
4
votes
2 answers
How do I convert an R "network" object to an "igraph" object?
How do I convert an R "network" object to an "igraph" object?
Many formats are discussed in the tutorial and package documentation, but I couldn't find how to import a "network" object.

Michael Bishop
- 1,875
- 4
- 17
- 23
4
votes
1 answer
How to extract certain path types in igraph?
TLDR: I'd like to extract the edge types of every path between two vertices in igraph. Is there a relatively sane way to do this?
The clinic I work for recently undertook a rather large (1400-person) tuberculosis contact investigation in a high…

Matt Parker
- 26,709
- 7
- 54
- 72
3
votes
1 answer
Creating two-mode network from binary and character variables in data frame
SNA folks: I am trying to create a two-mode network from a data frame in R. I have a list of organizations which are connected via common membership in a parent organization. I have membership in that organization coded in a binary variable. I have…

Abe
- 393
- 2
- 13
3
votes
1 answer
"sna" or "igraph" : Why do I get different degree values for undirected graph?
I am doing some basic network analysis using networks from the R package "networkdata". To this end, I use the package "igraph" as well as "sna". However, I realised that the results of descriptive network statistics vary depending on the package I…

Edda
- 33
- 2
3
votes
1 answer
add edge attribute based on another network
I have two networks of same vertex based on different criteria. I want to add edge attributes of one of the network based on the connection of the other network. That is, if node A and B are connected in network 2, I want to note down "1" as the…

Jingy Niu
- 31
- 4
3
votes
1 answer
R masking conflict: packages bnlearn and sna
I have problems to parallely use R packages bnlearn and sna. The following example is straightforward:
library(bnlearn)
data("asia")
# build network
a <- hc(asia)
# output
a
The output is as expected:
Bayesian network learned via Score-based…

locom
- 115
- 9
3
votes
1 answer
Gephi preview export pdf cuts off label at left and right margin
I would like to export a SVG/PDF/PNG from the preview tab in Gephi. The exported network includes all the nodes, but cuts off the node labels on the left and right sides. How can I get an exported pdf which does not cut off the labels?

adm
- 354
- 5
- 17
3
votes
1 answer
Scipy sparse matrix from edge list
How to convert an edge list (data) to a python scipy sparse matrix to get this result:
Dataset (where 'agn' is node category one and 'fct' is node category two):
data['agn'].tolist()
['p1', 'p1', 'p1', 'p1', 'p1', 'p2', 'p2', 'p2', 'p2', 'p3',…

gaussit
- 85
- 1
- 9
3
votes
2 answers
How to avoid graph union name clash in igraph?
I am trying to merge six graphs into a single graph, using the graph.union function in igraph.
Each graph is directed, named, and bipartite. Each graph has the following vertex and edge attributes:
name (v/c), type (v/c), label (v/c), id (v/c),…

timothyjgraham
- 1,142
- 1
- 15
- 28
3
votes
1 answer
Creating an edge list from co-authorship data
I have read in a csv file in R with co-authorship data amongst other information. The Authors column of the file contains co-authorship information as follows:
Miyazaki T., Akisawa A., Saha B.B., El-Sharkawy I.I., Chakraborty A.
Saha B.B.,…

anandg112
- 462
- 2
- 6
- 14
3
votes
1 answer
How to visualize the graph using d3Network in R
I'm trying to use a package called d3Network in R to visualize some network and I used the example in R :
# Load data
data(MisLinks)
data(MisNodes)
# Create graph
d3ForceNetwork(Links = MisLinks, Nodes = MisNodes, Source = "source",
…

Lambo
- 857
- 3
- 14
- 39
3
votes
1 answer
Weighted Bimodal Bipartite Graph Projection conserving original weights
I have a large ( 36k vertices, 50k edges ) weighted bimodal bipartite graph and I would like to generate a projection that not only count the neighbors like the default weighted implementation but also sum the weights on the edges. You can think of…

Oeufcoque Penteano
- 593
- 5
- 25
3
votes
2 answers
converting data frame into affiliation network in R
I have a data frame with the following format:
name workplace
a A
b B
c A
d C
e D
....
I would like to convert this data frame into an affiliation network in R with the format
A B C D ...
a 1 0 0 0
b 0 1 0 0
c 1 0 0…

user2521514
- 87
- 5