File: graph_from_graphnel.Rd

package info (click to toggle)
r-cran-igraph 1.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 14,984 kB
  • sloc: ansic: 117,319; cpp: 22,287; fortran: 4,551; yacc: 1,150; tcl: 931; lex: 478; makefile: 149; sh: 9
file content (65 lines) | stat: -rw-r--r-- 2,133 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/conversion.R
\name{graph_from_graphnel}
\alias{graph_from_graphnel}
\alias{igraph.from.graphNEL}
\title{Convert graphNEL objects from the graph package to igraph}
\usage{
graph_from_graphnel(graphNEL, name = TRUE, weight = TRUE,
  unlist.attrs = TRUE)
}
\arguments{
\item{graphNEL}{The graphNEL graph.}

\item{name}{Logical scalar, whether to add graphNEL vertex names as an
igraph vertex attribute called \sQuote{\code{name}}.}

\item{weight}{Logical scalar, whether to add graphNEL edge weights as an
igraph edge attribute called \sQuote{\code{weight}}. (graphNEL graphs are
always weighted.)}

\item{unlist.attrs}{Logical scalar. graphNEL attribute query functions
return the values of the attributes in R lists, if this argument is
\code{TRUE} (the default) these will be converted to atomic vectors,
whenever possible, before adding them to the igraph graph.}
}
\value{
\code{graph_from_graphnel} returns an igraph graph object.
}
\description{
The graphNEL class is defined in the \code{graph} package, it is another
way to represent graphs. \code{graph_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 \sQuote{\code{name}} it will be used as igraph vertex
attribute \sQuote{\code{name}} and the graphNEL vertex names will be
ignored.
}
\details{
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.
}
\examples{
\dontrun{
## Undirected
g <- make_ring(10)
V(g)$name <- letters[1:10]
GNEL <- as_graphnel(g)
g2 <- graph_from_graphnel(GNEL)
g2

## Directed
g3 <- make_star(10, mode="in")
V(g3)$name <- letters[1:10]
GNEL2 <- as_graphnel(g3)
g4 <- graph_from_graphnel(GNEL2)
g4
}
}
\seealso{
\code{\link{as_graphnel}} for the other direction,
\code{\link{as_adj}}, \code{\link{graph_from_adjacency_matrix}},
\code{\link{as_adj_list}} and \code{\link{graph.adjlist}} for other
graph representations.
}