File: simple.R

package info (click to toggle)
r-cran-igraph 1.0.1-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 18,232 kB
  • sloc: ansic: 173,538; cpp: 19,365; fortran: 4,550; yacc: 1,164; tcl: 931; lex: 484; makefile: 149; sh: 9
file content (70 lines) | stat: -rw-r--r-- 2,779 bytes parent folder | download | duplicates (4)
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

## -----------------------------------------------------------------------
##
##   IGraph R package
##   Copyright (C) 2015  Gabor Csardi <csardi.gabor@gmail.com>
##   334 Harvard street, Cambridge, MA 02139 USA
##   
##   This program is free software; you can redistribute it and/or modify
##   it under the terms of the GNU General Public License as published by
##   the Free Software Foundation; either version 2 of the License, or
##   (at your option) any later version.
##
##   This program is distributed in the hope that it will be useful,
##   but WITHOUT ANY WARRANTY; without even the implied warranty of
##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##   GNU General Public License for more details.
##   
##   You should have received a copy of the GNU General Public License
##   along with this program; if not, write to the Free Software
##   Foundation, Inc.,  51 Franklin Street, Fifth Floor, Boston, MA
##   02110-1301 USA
##
## -----------------------------------------------------------------------

#' Simple graphs
#' 
#' Simple graphs are graphs which do not contain loop and multiple edges.
#' 
#' 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.
#' 
#' @aliases simplify is.simple is_simple
#' @param graph The graph to work on.
#' @param remove.loops Logical, whether the loop edges are to be removed.
#' @param remove.multiple Logical, whether the multiple edges are to be
#' removed.
#' @param 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}} for details on this.
#' @return A new graph object with the edges deleted.
#' @author Gabor Csardi \email{csardi.gabor@@gmail.com}
#' @seealso \code{\link{which_loop}}, \code{\link{which_multiple}} and
#' \code{\link{count_multiple}}, \code{\link{delete_edges}},
#' \code{\link{delete_vertices}}
#' @keywords graphs
#' @examples
#' 
#' g <- 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))
#' @export
#' @include auto.R

simplify <- simplify

#' @export
#' @rdname simplify

is_simple <- is_simple