Note the warning because of a “non-standard” network attribute layout, which
is a function. Printing “network” objects does not handle non-standard
attributes very well. However, all the data and attributes are copied
correctly.

Handling attributes

Objects of class “igraph” and “network”, apart from storing actual network data
(vertexes and edges), allow for adding attributes of vertexes, edges, and
attributes of the network as a whole (called “network attributes” or “graph
attributes” in the nomenclatures of packages “network” and “igraph”
respectively).

Vertex and edge attributes are used by “igraph” and “network” in a largely
similar fashion. However, network-level attributes are used differently.
Objects of class “network” use network-level attributes to store various
metadata, e.g., network size, whether the network is directed, is bipartite, etc.
In “igraph” this information is stored separately.

The above difference affects the way the attributes are copied when we convert
“network” and “igraph” objects into one another.

Both functions asNetwork and asIgraph have an additional argument attrmap
that is used to specify how vertex, edge, and network attributes are copied.
The attrmap argument requires a data frame. Rows of that data frame specify
rules of copying/renaming different attributes. The data frame should have the
following columns (all of class “character”):

type: one of “network”, “vertex” or “edge”, whether the rule applies to
network, vertex or edge attribute.

For example, the last row specifies a rule that when an object of class
“igraph” is converted to class “network”, then a vertex attribute name in the
“igraph” object will be copied to a vertex attribute called vertex.names in
the resulting object of class “network.

If the column toattr contains an NA, that means that the corresponding
attribute is not copied. For example, the first row specifies a rule that when
an object of class "network” is converted to class “igraph”, then a network
attribute directed in the “network” object is not copied to the resulting
object of class “igraph”.

Users can customize the rules, or add new ones, by constructing similar
data frames and supplying them through argument attrmap to functions
asIgraph and asNetwork.

Network objects to/from data frames

Function asDF can be used to convert network object (of class “igraph” or “network”)
to a list of two data frames:

The resulting list has two components edges and vertexes. The edges component is essentially
an edge list containing ego and alter ids in the first two columns. The remaining columns store
edge attributes (if any). For our example data it is

The vertexes component contains data on vertexes with vertex id (the same
that is used in the first two column of edges) is stored in the first two
columns. The remaining columns store vertex attributes (if any). For our
example data it is:

Functions asNetwork and asIgraph can also be used to create network objects
from data frames such as those above. The first argument should be an edge list data frame.
Optional argument vertices expectes data frames with vertex data (just like l$vertexes).
Additionally we need to specify whether the edges should be interpreted as directed or not
through the argument directed.

For example, to create an object of class “network” from the dataframes created above from
object exIgraph we can: