File: simplify.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 (107 lines) | stat: -rw-r--r-- 3,731 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/simple.R
\name{simplify}
\alias{simplify}
\alias{is_simple}
\alias{simplify_and_colorize}
\title{Simple graphs}
\usage{
simplify(
  graph,
  remove.multiple = TRUE,
  remove.loops = TRUE,
  edge.attr.comb = igraph_opt("edge.attr.comb")
)

is_simple(graph)

simplify_and_colorize(graph)
}
\arguments{
\item{graph}{The graph to work on.}

\item{remove.multiple}{Logical, whether the multiple edges are to be
removed.}

\item{remove.loops}{Logical, whether the loop edges are to be removed.}

\item{edge.attr.comb}{Specifies what to do with edge attributes, if
\code{remove.multiple=TRUE}. In this case many edges might be mapped to a
single one in the new graph, and their attributes are combined. Please see
\code{\link[=attribute.combination]{attribute.combination()}} for details on this.}
}
\value{
a new graph object with the edges deleted.
}
\description{
Simple graphs are graphs which do not contain loop and multiple edges.
}
\details{
A loop edge is an edge for which the two endpoints are the same
vertex. Two edges are multiple edges if they have exactly the same two
endpoints (for directed graphs order does matter). A graph is simple is
it does not contain loop edges and multiple edges.

\code{is_simple()} checks whether a graph is simple.

\code{simplify()} removes the loop and/or multiple edges from a graph.  If
both \code{remove.loops} and \code{remove.multiple} are \code{TRUE} the
function returns a simple graph.

\code{simplify_and_colorize()} constructs a new, simple graph from a graph and
also sets a \code{color} attribute on both the vertices and the edges.
The colors of the vertices represent the number of self-loops that were
originally incident on them, while the colors of the edges represent the
multiplicities of the same edges in the original graph. This allows one to
take into account the edge multiplicities and the number of loop edges in
the VF2 isomorphism algorithm. Other graph, vertex and edge attributes from
the original graph are discarded as the primary purpose of this function is
to facilitate the usage of multigraphs with the VF2 algorithm.
}
\examples{

g <- make_graph(c(1, 2, 1, 2, 3, 3))
is_simple(g)
is_simple(simplify(g, remove.loops = FALSE))
is_simple(simplify(g, remove.multiple = FALSE))
is_simple(simplify(g))
}
\seealso{
\code{\link[=which_loop]{which_loop()}}, \code{\link[=which_multiple]{which_multiple()}} and
\code{\link[=count_multiple]{count_multiple()}}, \code{\link[=delete_edges]{delete_edges()}},
\code{\link[=delete_vertices]{delete_vertices()}}

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{difference.igraph}()},
\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{union}()},
\code{\link{union.igraph}()},
\code{\link{vertex}()}
}
\author{
Gabor Csardi \email{csardi.gabor@gmail.com}
}
\concept{functions for manipulating graph structure}
\concept{isomorphism}
\concept{simple}
\keyword{graphs}
\section{Related documentation in the C library}{\href{https://igraph.org/c/html/latest/igraph-Operators.html#igraph_simplify}{\code{igraph_simplify()}}, \href{https://igraph.org/c/html/latest/igraph-Structural.html#igraph_is_simple}{\code{igraph_is_simple()}}.}