11-coerce: Convert igraph object to Ragraph

as.graphNELR Documentation

Convert igraph object to Ragraph

Description

Converts an igraph object into an Ragraph object, preserving as many attributes of nodes and edges as possible.

Usage

as.graphNEL(G)

Arguments

G

An igraph representation of a graph.

Details

The only tricky part of the implementation is to transfer as many of the properties of nodes and edges from one representation to another, since the igraph package already has a conversion function called as_graphnel. That version keeps tge ege list and node list, but not the attributes. Our implementation uses the vertex_attr and edge_attr functions from igraph to extract the properties and then passes them to the agopen function in Rgraphviz to map them to the slightly different naes use din te output.

The function should probably be named as.Ragraph, but we didn't understand enough about Rgraphviz when we started.

Also, the converson will fail if the igrph input has any multiple edges, which are not supported in graphNEL objects.

Value

An Ragraph representation of the same graph.

Author(s)

Kevin R. Coombes krc@silicovore.com, Polina Bombina pbombina@augusta.edu

Examples

xmlfile <- system.file("pathways/WP3850.gpml", package = "WayFindR")
G <- GPMLtoIgraph(xmlfile)
GN <- as.graphNEL(G)

WayFindR documentation built on May 21, 2025, 3 p.m.