I am looking to add a 'description' variable to the vertices data frame which describes the cluster in which a node is found. My network is family relationships so clusters could be a family of two adults and two children, single parent with three children, couple etc.
My data looks like
Vertices data frame
ID Date.Of.B Nationality
X1 02/05/1995 Ugandan
X2 10/10/2010 Ugandan
X3 15/12/1975 Irish
: : :
Edgelist
ID1 ID2
X1 X2
X1 X3
X2 X3
X3 X1
: :
I plan to create factor levels to describe clusters i.e
2 adults = 2A
2 adults 2 children = 2A2C
5 adults 0 children = 5A
After creating the graph using graph_from_data_frame() I can extract the components using componets() with components$membership giving each cluster a membership number with the IDs an attribute of components$membership. I can apply a label to each vertex to determine their status as an adult or child.
Basically I am looking to add another variable which classes each ID given the cluster it is in:
New vertices data frame
ID Date.Of.B Nationality Class
X1 02/05/1995 Ugandan 2A1C
X2 10/10/2010 Ugandan 2A1C
X3 15/12/1975 Irish 2A1C
: : :
I am thinking I am going to have to use some sort of loop to go through each cluster and apply a level to each vertex by component$membership
This is one option I thought of and am currently working on.
Please let me know if you have any other ideas or better ways to do it.
Thanks