0

I am attempting to create a one-mode network of co-workers based on a bi-partite graph. I have a dataset consisting of people and the companies they worked at, plus the year they started and ended their time at any given company.

I want to project this undirected bipartite network, but only keep the edges that overlap in time, so that only those who worked at a company at the same time gets connected.

So in the example below I would like person3 not to be connected to person1 after projection, since person1 stopped working at company2 in 2008 before person3 started in 2009.

I also need the projected edges to have a weight attribute that increases whenever to nodes have worked together. For example the projected edge between person1 and person2 should be 2, since they worked together at company1 in 2009 and company 2 in 2007.

The real network has thousands of nodes, so the solution can't involve manually editing individual edges. I am working with igraph and tidygraph, but a solution from any other package is ok. Any solution that creates the desired one-mode network from the node- and edgelist without projecting from a bipartite/two-mode graph is also fine.

Reproducible example:

library(tidyverse)
library(igraph)

nodes_people <- data.frame(id=c("person1","person2","person3"), type="TRUE")
nodes_inst <- data.frame(id=c("company1","company2","company3"), type="FALSE")
nodes<-bind_rows(nodes_people, nodes_inst)

edges <- data.frame(from=c("person1","person1","person2","person3","person2","person3"),
                      to=c("company1","company2","company2","company3","company1","company2"),
              start_date=c(2008,2007,2007,2003,2002,2009), 
                end_date=c(2010,2008,2012,2006,2009,2010))

g <- graph_from_data_frame(d=edges, vertices=nodes, directed=F) 

is.bipartite(g)

g_one_mode<-bipartite_projection(g)$proj2

plot(g_one_mode)

Bipartite graph: bipartite network

One-mode network: one-mode

  • You could change your bipartite graph so that people nodes are connected to company_year nodes. Do the projection and simplify the projected graph to remove duplicate links. – G5W Nov 01 '20 at 20:31
  • Thank you for your answer! That is a good idea. However, they have been at the companies for varying lengths of time, not just one year. I'd like them connected if they have been at the same company at any time _during their respective timespans_ – samitakamaki Nov 01 '20 at 20:34
  • Yes, I meant that each employee would be connected to _multiple_ company_year_ pairs – G5W Nov 01 '20 at 21:22

0 Answers0