# conversion between igraph and graphNEL graphs

##### Convert igraph graphs to graphNEL objects or back

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.

- Keywords
- graphs

##### Usage

```
igraph.from.graphNEL(graphNEL, name = TRUE, weight = TRUE,
unlist.attrs = TRUE)
igraph.to.graphNEL(graph)
```

##### Arguments

- 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
. (graphNEL graphs are always weighted.)`weight`

- 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 igra - graph
- An igraph graph object.

##### Details

`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`

`name`

Because graphNEL graphs poorly support multiple edges, the edge
attributes of the multiple edges are lost: they are all replaced by
the attributes of the first of the multiple edges.
`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`

##### Value

`igraph.from.graphNEL`

returns an igraph graph object.`igraph.to.graphNEL`

returns a graphNEL graph object.

##### concept

- Conversion
- graph package
- graphNEL object

##### See Also

`get.adjacency`

, `graph.adjacency`

,
`get.adjlist`

and `graph.adjlist`

.

##### Examples

```
## Undirected
g <- graph.ring(10)
V(g)$name <- letters[1:10]
GNEL <- igraph.to.graphNEL(g)
g2 <- igraph.from.graphNEL(GNEL)
g2
## Directed
g3 <- graph.star(10, mode="in")
V(g3)$name <- letters[1:10]
GNEL2 <- igraph.to.graphNEL(g3)
g4 <- igraph.from.graphNEL(GNEL2)
g4
```

*Documentation reproduced from package igraph, version 0.6.5-2, License: GPL (>= 2)*