File: max_cardinality.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 (70 lines) | stat: -rw-r--r-- 2,275 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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/paths.R
\name{max_cardinality}
\alias{max_cardinality}
\title{Maximum cardinality search}
\usage{
max_cardinality(graph)
}
\arguments{
\item{graph}{The input graph. It may be directed, but edge directions are
ignored, as the algorithm is defined for undirected graphs.}
}
\value{
A list with two components: \item{alpha}{Numeric vector. The
1-based rank of each vertex in the graph such that the vertex with rank 1
is visited first, the vertex with rank 2 is visited second and so on.}
\item{alpham1}{Numeric vector. The inverse of \code{alpha}. In other words,
the elements of this vector are the vertices in reverse maximum cardinality
search order.}
}
\description{
Maximum cardinality search is a simple ordering a vertices that is useful in
determining the chordality of a graph.
}
\details{
Maximum cardinality search visits the vertices in such an order that every
time the vertex with the most already visited neighbors is visited. Ties are
broken randomly.

The algorithm provides a simple basis for deciding whether a graph is
chordal, see References below, and also \code{\link[=is_chordal]{is_chordal()}}.
}
\examples{

## The examples from the Tarjan-Yannakakis paper
g1 <- graph_from_literal(
  A - B:C:I, B - A:C:D, C - A:B:E:H, D - B:E:F,
  E - C:D:F:H, F - D:E:G, G - F:H, H - C:E:G:I,
  I - A:H
)
max_cardinality(g1)
is_chordal(g1, fillin = TRUE)

g2 <- graph_from_literal(
  A - B:E, B - A:E:F:D, C - E:D:G, D - B:F:E:C:G,
  E - A:B:C:D:F, F - B:D:E, G - C:D:H:I, H - G:I:J,
  I - G:H:J, J - H:I
)
max_cardinality(g2)
is_chordal(g2, fillin = TRUE)
}
\references{
Robert E Tarjan and Mihalis Yannakakis. (1984). Simple
linear-time algorithms to test chordality of graphs, test acyclicity of
hypergraphs, and selectively reduce acyclic hypergraphs.  \emph{SIAM Journal
of Computation} 13, 566--579.
}
\seealso{
\code{\link[=is_chordal]{is_chordal()}}

Other chordal: 
\code{\link{is_chordal}()}
}
\author{
Gabor Csardi \email{csardi.gabor@gmail.com}
}
\concept{chordal}
\keyword{graphs}
\section{Related documentation in the C library}{\href{https://igraph.org/c/html/latest/igraph-Structural.html#igraph_maximum_cardinality_search}{\code{igraph_maximum_cardinality_search()}}.}