Is there a way how to convert igraph-class object to graph-class object in R (I need it on igraph-graphs loaded from Pajek .net files for computation k-cliques with kClique() procedure in RBGL which uses, as input, the object of graph class) ?
Asked
Active
Viewed 110 times
0
-
Please hover over the R tag - it asks for a reproducible example. [Here's a guide](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example#answer-5963610); also check the help (e.g. `?ba.game`, _examples_ section). A good one usually provides minimal input data, the desired output data, code tries incl required packages - all copy-paste-run'able in a new/clean R session. *Why?* It makes it easier for all to follow and participate without guesswork. And it prevents your from mistakes like `kClique`, which does not exist. – lukeA Jan 12 '17 at 09:25
1 Answers
0
Consider for example:
library(igraph)
library(RBGL)
g <- ba.game(3)
g2 <- igraph.to.graphNEL(as.undirected(g))
kCliques(g2)
# $`1-cliques`
# $`1-cliques`[[1]]
# [1] "1" "2"
#
# $`1-cliques`[[2]]
# [1] "1" "3"
#
#
# $`2-cliques`
# $`2-cliques`[[1]]
# [1] "1" "2" "3"

lukeA
- 53,097
- 5
- 97
- 100