2

The relationship is expressed as a matrix x like this:

      John Jack Mary Wendy
John     0    2    1     1
Jack     2    0    1     0
Mary     1    1    0     1
Wendy    1    0    1     0

The entries refer to the number of connections they have. Could anyone show me how to plot it as a network in R? Thanks!

Gavin Simpson
  • 170,508
  • 25
  • 396
  • 453
Sarah1022
  • 21
  • 1
  • 2

1 Answers1

7

This is known as an adjacency matrix.

There is some information in the R FAQ on plotting social networks expressed as matrices:

Plotting social network data can be easily done with the igraph package in R. [...] In order for the igraph package to recognize this table as a network, we can first convert it to a matrix. Then, if we wish to calculate graph-related statistics on it (betweenness, closeness, degree), we can use the matrix to create a graph object.

The FAQ gives some examples, resulting in sociogram diagrams, for example:

enter image description here

The igraph library itself is documented here - it can produce much more complex examples - see the screenshots page and the example below:

enter image description here

DNA
  • 42,007
  • 12
  • 107
  • 146