I am a new R and igraph user and I am wondering whether you could give me some hints to do the following:
I have an edgelist (undirected). I would
like to compute the following four things:
- for a subset of vertices, the number of
edges (without counting twice a same vertex linked with two different vertices
of the subset)
- for a subset of vertices, if at least one
of the vertices from this subset is linked with a particular vertex (from the
whole set)
- for a subset of vertices, the minimal degree
of separation required to reach a particular vertex (from the whole set)
- for all the vertices (in the whole set),
if they are linked with at least one vertex from the subset
For example:
1-2
1-3
2-3
2-5
3-4
3-5
4-5
and consider the subset of vertices being 1
and 2 and the particular vertex being 4
Answer to the first question: 3 (edges 1-3
and 2-3 are count only for one)
Answer to the second question: 0 (neither
1, neither 2 is directly linked to 4)
Answer to the third question: 2 (edge 1-3
and then edge 3-4 or edge 2-3 and then edge 3-4)
Answer to the fourth question: [1] - [2] -
[3] 1 [4] 0 [5] 1
Many thanks for your help!