igraph from/to graphNEL conversion {igraph} | R Documentation |
The graphNEL class is defined in the graph
package,
it is another way to represent graphs. These functions are provided to
convert between the igraph and the graphNEL objects.
igraph.from.graphNEL(graphNEL, name = TRUE, weight = TRUE, unlist.attrs = TRUE) igraph.to.graphNEL(graph)
graphNEL |
The graphNEL graph. |
name |
Logical scalar, whether to add graphNEL vertex names as an
igraph vertex attribute called ‘name ’. |
weight |
Logical scalar, whether to add graphNEL edge weights as
an igraph edge attribute called ‘weight ’. (graphNEL
graphs are always weighted.) |
unlist.attrs |
Logical scalar. graphNEL attribute query functions
return the values of the attributes in R lists, if this argument is
TRUE (the default) these will be converted to atomic vectors,
whenever possible, before adding them to the igraph graph. |
graph |
An igraph graph object. |
igraph.from.graphNEL
takes a graphNEL graph and converts it to
an igraph graph. It handles all graph/vertex/edge attributes. If the
graphNEL graph has a vertex attribute called ‘name
’ it
will be used as igraph vertex attribute ‘name
’ and the
graphNEL vertex names will be ignored.
igraph.to.graphNEL
converts and igraph graph to a graphNEL
graph. It converts all graph/vertex/edge attributes. If the igraph
graph has a vertex attribute ‘name
’, then it will be
used to assign vertex names in the graphNEL graph. Otherwise igraph
vertex ids will be used for this purpose.
igraph.from.graphNEL
returns an igraph graph object.
igraph.to.graphNEL
returns a graphNEL graph object.
Gabor Csardi csardi@rmki.kfki.hu
get.adjacency
, graph.adjacency
,
get.adjlist
and graph.adjlist
.
g <- graph.ring(10) V(g)$name <- letters[1:10] GNEL <- igraph.to.graphNEL(g) g2 <- igraph.from.graphNEL(GNEL) g2