0
$\begingroup$

Here is a DF which I take as a representation of my future vertices:

Id   Name
01   Alpha
02   Beta
03   Delta
04   Epsilon

I want to get an igraph representation of a full graph with these nodes in R. As far as I know igraph's graph.full function cannot take DF as input and I cannot really want to create an intermediary DF with all possible conection combination. Any clever idea?

$\endgroup$

1 Answer 1

1
$\begingroup$

All full graphs of the same order and direction are the same, so just make a full graph of the right size and then put your vertex data on the vertices:

> d = data.frame(Id=c("01","02","03","04"),Name=c("Alpha","Beta","Delta","Epsilon"),stringsAsFactors=FALSE)
> d
  Id    Name
1 01   Alpha
2 02    Beta
3 03   Delta
4 04 Epsilon
> g = graph.full(nrow(d))
> V(g)$Name = d$Name
> V(g)$Id = d$Id
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.