I am not sure of how to phrase this question, which is making it very hard to find a solution.
I have a graph of people and their relationships in igraph. I also have the location of this people in a dataframe.
> # graph.id is their id in the graph
> people
user.name graph.id location.cell
1 perez 654 54
2 garcia 123 54
3 fernandez 771 32
4 rodriguez 11 81
My graph connects users by their graph.id:
user 654 <-> user 11
user 123 <-> user 11
And I want a new graph with their regions, with a
cell 54 <- weight 2-> cell 81
(there are two connections between cells 54 and 81,
one between users 11 and 654,
and another between users 11 and 123,
so weight=2)
How can I do this in R (I'm using igraph)? I've tried a couple of times, iterating over the edges in the graph, but I ended up with too much code that wasn't going to be acceptably fast or mantainable, and it doesn't look like a problem that should be hard (I think I wouldn't have any problem to do this kind of thing in a language I was more comfortable with).
Thanks a lot.