File: graph_measures.Rd

package info (click to toggle)
r-cran-tidygraph 1.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 880 kB
  • sloc: cpp: 41; sh: 13; makefile: 2
file content (180 lines) | stat: -rw-r--r-- 7,645 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/graph_measures.R
\name{graph_measures}
\alias{graph_measures}
\alias{graph_adhesion}
\alias{graph_assortativity}
\alias{graph_automorphisms}
\alias{graph_clique_num}
\alias{graph_clique_count}
\alias{graph_component_count}
\alias{graph_motif_count}
\alias{graph_diameter}
\alias{graph_girth}
\alias{graph_radius}
\alias{graph_mutual_count}
\alias{graph_asym_count}
\alias{graph_unconn_count}
\alias{graph_size}
\alias{graph_order}
\alias{graph_reciprocity}
\alias{graph_min_cut}
\alias{graph_mean_dist}
\alias{graph_modularity}
\alias{graph_efficiency}
\title{Graph measurements}
\usage{
graph_adhesion()

graph_assortativity(attr, in_attr = NULL, directed = TRUE)

graph_automorphisms(sh = "fm", colors = NULL)

graph_clique_num()

graph_clique_count(min = NULL, max = NULL, subset = NULL)

graph_component_count(type = "weak")

graph_motif_count(size = 3, cut.prob = rep(0, size))

graph_diameter(weights = NULL, directed = TRUE, unconnected = TRUE)

graph_girth()

graph_radius(mode = "out")

graph_mutual_count()

graph_asym_count()

graph_unconn_count()

graph_size()

graph_order()

graph_reciprocity(ignore_loops = TRUE, ratio = FALSE)

graph_min_cut(capacity = NULL)

graph_mean_dist(directed = TRUE, unconnected = TRUE, weights = NULL)

graph_modularity(group, weights = NULL)

graph_efficiency(weights = NULL, directed = TRUE)
}
\arguments{
\item{attr}{The node attribute to measure on}

\item{in_attr}{An alternative node attribute to use for incomming node. If \code{NULL} the attribute given by \code{type} will be used}

\item{directed}{Should a directed graph be treated as directed}

\item{sh}{The splitting heuristics for the BLISS algorithm. Possible values
are: \sQuote{\code{f}}: first non-singleton cell, \sQuote{\code{fl}}: first
largest non-singleton cell, \sQuote{\code{fs}}: first smallest non-singleton
cell, \sQuote{\code{fm}}: first maximally non-trivially connected
non-singleton cell, \sQuote{\code{flm}}: first largest maximally
non-trivially connected non-singleton cell, \sQuote{\code{fsm}}: first
smallest maximally non-trivially connected non-singleton cell.}

\item{colors}{The colors of the individual vertices of the graph; only
vertices having the same color are allowed to match each other in an
automorphism. When omitted, igraph uses the \code{color} attribute of the
vertices, or, if there is no such vertex attribute, it simply assumes that
all vertices have the same color. Pass NULL explicitly if the graph has a
\code{color} vertex attribute but you do not want to use it.}

\item{min, max}{The upper and lower bounds of the cliques to be considered.}

\item{subset}{The indexes of the nodes to start the search from (logical or integer). If provided only the cliques containing these nodes will be counted.}

\item{type}{The type of component to count, either 'weak' or 'strong'. Ignored for undirected graphs.}

\item{size}{The size of the motif.}

\item{cut.prob}{Numeric vector giving the probabilities that the search
graph is cut at a certain level. Its length should be the same as the size
of the motif (the \code{size} argument). By default no cuts are made.}

\item{weights}{Optional positive weight vector for calculating weighted
distances. If the graph has a \code{weight} edge attribute, then this is
used by default.}

\item{unconnected}{Logical, what to do if the graph is unconnected. If
FALSE, the function will return a number that is one larger the largest
possible diameter, which is always the number of vertices. If TRUE, the
diameters of the connected components will be calculated and the largest one
will be returned.}

\item{mode}{How should eccentricity be calculated. If \code{"out"} only outbound edges are followed. If \code{"in"} only inbound are followed. If \code{"all"} all edges are followed. Ignored for undirected graphs.}

\item{ignore_loops}{Logical. Should loops be ignored while calculating the reciprocity}

\item{ratio}{Should the old "ratio" approach from igraph < v0.6 be used}

\item{capacity}{The capacity of the edges}

\item{group}{The node grouping to calculate the modularity on}
}
\value{
A scalar, the type depending on the function
}
\description{
This set of functions provide wrappers to a number of \code{ìgraph}s graph
statistic algorithms. As for the other wrappers provided, they are intended
for use inside the \code{tidygraph} framework and it is thus not necessary to
supply the graph being computed on as the context is known. All of these
functions are guarantied to return scalars making it easy to compute with
them.
}
\section{Functions}{
\itemize{
\item \code{graph_adhesion()}: Gives the minimum edge connectivity. Wraps \code{\link[igraph:edge_connectivity]{igraph::edge_connectivity()}}

\item \code{graph_assortativity()}: Measures the propensity of similar nodes to be connected. Wraps \code{\link[igraph:assortativity]{igraph::assortativity()}}

\item \code{graph_automorphisms()}: Calculate the number of automorphisms of the graph. Wraps \code{\link[igraph:count_automorphisms]{igraph::count_automorphisms()}}

\item \code{graph_clique_num()}: Get the size of the largest clique. Wraps \code{\link[igraph:cliques]{igraph::clique_num()}}

\item \code{graph_clique_count()}: Get the number of maximal cliques in the graph. Wraps \code{\link[igraph:cliques]{igraph::count_max_cliques()}}

\item \code{graph_component_count()}: Count the number of unconnected componenets in the graph. Wraps \code{\link[igraph:components]{igraph::count_components()}}

\item \code{graph_motif_count()}: Count the number of motifs in a graph. Wraps \code{\link[igraph:count_motifs]{igraph::count_motifs()}}

\item \code{graph_diameter()}: Measures the length of the longest geodesic. Wraps \code{\link[igraph:diameter]{igraph::diameter()}}

\item \code{graph_girth()}: Measrues the length of the shortest circle in the graph. Wraps \code{\link[igraph:girth]{igraph::girth()}}

\item \code{graph_radius()}: Measures the smallest eccentricity in the graph. Wraps \code{\link[igraph:radius]{igraph::radius()}}

\item \code{graph_mutual_count()}: Counts the number of mutually connected nodes. Wraps \code{\link[igraph:dyad_census]{igraph::dyad_census()}}

\item \code{graph_asym_count()}: Counts the number of asymmetrically connected nodes. Wraps \code{\link[igraph:dyad_census]{igraph::dyad_census()}}

\item \code{graph_unconn_count()}: Counts the number of unconnected node pairs. Wraps \code{\link[igraph:dyad_census]{igraph::dyad_census()}}

\item \code{graph_size()}: Counts the number of edges in the graph. Wraps \code{\link[igraph:gsize]{igraph::gsize()}}

\item \code{graph_order()}: Counts the number of nodes in the graph. Wraps \code{\link[igraph:gorder]{igraph::gorder()}}

\item \code{graph_reciprocity()}: Measures the proportion of mutual connections in the graph. Wraps \code{\link[igraph:reciprocity]{igraph::reciprocity()}}

\item \code{graph_min_cut()}: Calculates the minimum number of edges to remove in order to split the graph into two clusters. Wraps \code{\link[igraph:min_cut]{igraph::min_cut()}}

\item \code{graph_mean_dist()}: Calculates the mean distance between all node pairs in the graph. Wraps \code{\link[igraph:distances]{igraph::mean_distance()}}

\item \code{graph_modularity()}: Calculates the modularity of the graph contingent on a provided node grouping

\item \code{graph_efficiency()}: Calculate the global efficiency of the graph

}}
\examples{
# Use e.g. to modify computations on nodes and edges
create_notable('meredith') \%>\%
  activate(nodes) \%>\%
  mutate(rel_neighbors = centrality_degree()/graph_order())
}