File: difference.igraph.Rd

package info (click to toggle)
r-cran-igraph 2.1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 27,044 kB
  • sloc: ansic: 204,981; cpp: 21,711; fortran: 4,090; yacc: 1,229; lex: 519; sh: 52; makefile: 8
file content (92 lines) | stat: -rw-r--r-- 2,747 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/operators.R
\name{difference.igraph}
\alias{difference.igraph}
\alias{\%m\%}
\title{Difference of graphs}
\usage{
\method{difference}{igraph}(big, small, byname = "auto", ...)
}
\arguments{
\item{big}{The left hand side argument of the minus operator. A directed or
undirected graph.}

\item{small}{The right hand side argument of the minus operator. A directed
ot undirected graph.}

\item{byname}{A logical scalar, or the character scalar \code{auto}. Whether
to perform the operation based on symbolic vertex names. If it is
\code{auto}, that means \code{TRUE} if both graphs are named and
\code{FALSE} otherwise. A warning is generated if \code{auto} and one graph,
but not both graphs are named.}

\item{...}{Ignored, included for S3 compatibility.}
}
\value{
A new graph object.
}
\description{
The difference of two graphs are created.
}
\details{
\code{difference()} creates the difference of two graphs. Only edges
present in the first graph but not in the second will be be included in the
new graph. The corresponding operator is \verb{\%m\%}.

If the \code{byname} argument is \code{TRUE} (or \code{auto} and the graphs
are all named), then the operation is performed based on symbolic vertex
names. Otherwise numeric vertex ids are used.

\code{difference()} keeps all attributes (graph, vertex and edge) of the
first graph.

Note that \code{big} and \code{small} must both be directed or both be
undirected, otherwise an error message is given.
}
\examples{

## Create a wheel graph
wheel <- union(
  make_ring(10),
  make_star(11, center = 11, mode = "undirected")
)
V(wheel)$name <- letters[seq_len(vcount(wheel))]

## Subtract a star graph from it
sstar <- make_star(6, center = 6, mode = "undirected")
V(sstar)$name <- letters[c(1, 3, 5, 7, 9, 11)]
G <- wheel \%m\% sstar
print_all(G)
plot(G, layout = layout_nicely(wheel))
}
\seealso{
Other functions for manipulating graph structure: 
\code{\link{+.igraph}()},
\code{\link{add_edges}()},
\code{\link{add_vertices}()},
\code{\link{complementer}()},
\code{\link{compose}()},
\code{\link{connect}()},
\code{\link{contract}()},
\code{\link{delete_edges}()},
\code{\link{delete_vertices}()},
\code{\link{difference}()},
\code{\link{disjoint_union}()},
\code{\link{edge}()},
\code{\link{igraph-minus}},
\code{\link{intersection}()},
\code{\link{intersection.igraph}()},
\code{\link{path}()},
\code{\link{permute}()},
\code{\link{rep.igraph}()},
\code{\link{reverse_edges}()},
\code{\link{simplify}()},
\code{\link{union}()},
\code{\link{union.igraph}()},
\code{\link{vertex}()}
}
\author{
Gabor Csardi \email{csardi.gabor@gmail.com}
}
\concept{functions for manipulating graph structure}
\keyword{graphs}