2

I am trying to visualize a relational data structure of "joint venture" (i.e., firms collaborate with others in products). For example, firm i may be involved in joint venture A with firm j, yet firm i also participates in joint venture B with firm j and firm k, etc., so both firm i, j, k all share some sort of co-membership relations ({i, j}, {i, j, k}), but the strength of collaboration between firm {i, j} is stronger than that of firm {i, k} as firm i and j collaborate in more joint venture.

I would to visualize this in those iconic network graphs but emphasize the strength of relationship that varies between different dyads (firms). A relevant example that came to my mind is Mark Newman's co-authorship studies in PNAS (Newman 2004), in Fig. 6 each pair of nodes (i.e., authors) are connected by edges of different thickness, representing the strength of co-authorship intensity between each pair of authors (i.e., number of collaborative works between the two), like the picture shown below:

From Newman (2004) I have checked out a number of previous posts (such as this one) pertaining to R's igraph and bipartite packages, but do not think bipartite network and its application fit my purpose here.

I am wondering (1) if there are any existing R packages/applications out there that will help to visualize the strength of connectedness between each nodes in a network, and (2) how should the structure of this type of data look like? (using 'firm', 'project' as columns or rows?)

Thank you.

Chris T.
  • 1,699
  • 7
  • 23
  • 45

1 Answers1

2

As @R.B noted, you may use the visNetwork library. The code with invented data may look like this:

library(igraph)
library(visNetwork)

set.seed(98765)   # for reproducibility
### generate some data, 
### nodes are entitities: letters represent contributors
nodes <- data.frame(id = 1:11, 
                    label = LETTERS[1:11],  # name of node
                    title = LETTERS[1:11])  # optional tooltip
### edges represent relations 
edges <- data.frame(
  from = sample(1:11, 50, replace = TRUE),
  to =  sample(1:11, 50, replace = TRUE),
  arrows = "",
  width = c(rep(1, 20), rep(4, 20), rep(6,6), rep(10, 3), 15)  ## weights
)


visNetwork(nodes, edges, width = "100%") %>%
  visIgraphLayout(layout = "layout_in_circle") %>%
  visNodes(size = 25) %>%
  visOptions(highlightNearest = list(enabled = F, hover = T) )

This generates the following plot (interactive in html)

enter image description here

Please let me know whether this is what you want.

KoenV
  • 4,113
  • 2
  • 23
  • 38
  • Thanks so much for taking time illustrating this! I should be able to tweet the visNetwork code, adding some cosmetics (e.g., labeling the nodes with their node names), etc. However, the visIgraphLayout(layout = "layout_in_circle") %>% command line doesn't seem to work on my Rstudio, R returns an error message "Can't find 'layout_in_circle' function. Please verify it." I also tried using the default 'layout_nicely,' it still doesn't work. I am quite new to visNetwork, is that a programming error? – Chris T. Jul 03 '17 at 16:30
  • 1
    Try again after installing and loading the `igraph` package and please let me know whether it works then. – KoenV Jul 03 '17 at 16:33
  • Thanks again! I removed the older version and reinstalled igraph, now it works. Many thanks. – Chris T. Jul 03 '17 at 16:36
  • My pleasure! I will update the code with the loading of `igraph` – KoenV Jul 03 '17 at 16:37