This set of functions provide wrappers to a number of ìgraph
s graph
statistic algorithms. As for the other wrappers provided, they are intended
for use inside the 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.
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)
The node attribute to measure on
An alternative node attribute to use for incomming node. If NULL
the attribute given by type
will be used
Should a directed graph be treated as directed
The splitting heuristics for the BLISS algorithm. Possible values
are: ‘f
’: first non-singleton cell, ‘fl
’: first
largest non-singleton cell, ‘fs
’: first smallest non-singleton
cell, ‘fm
’: first maximally non-trivially connected
non-singleton cell, ‘flm
’: first largest maximally
non-trivially connected non-singleton cell, ‘fsm
’: first
smallest maximally non-trivially connected non-singleton cell.
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 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
color
vertex attribute but you do not want to use it.
The upper and lower bounds of the cliques to be considered.
The indexes of the nodes to start the search from (logical or integer). If provided only the cliques containing these nodes will be counted.
The type of component to count, either 'weak' or 'strong'. Ignored for undirected graphs.
The size of the motif.
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 size
argument). By default no cuts are made.
Optional positive weight vector for calculating weighted
distances. If the graph has a weight
edge attribute, then this is
used by default.
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.
How should eccentricity be calculated. If "out"
only outbound edges are followed. If "in"
only inbound are followed. If "all"
all edges are followed. Ignored for undirected graphs.
Logical. Should loops be ignored while calculating the reciprocity
Should the old "ratio" approach from igraph < v0.6 be used
The capacity of the edges
The node grouping to calculate the modularity on
A scalar, the type depending on the function
graph_adhesion()
: Gives the minimum edge connectivity. Wraps igraph::edge_connectivity()
graph_assortativity()
: Measures the propensity of similar nodes to be connected. Wraps igraph::assortativity()
graph_automorphisms()
: Calculate the number of automorphisms of the graph. Wraps igraph::count_automorphisms()
graph_clique_num()
: Get the size of the largest clique. Wraps igraph::clique_num()
graph_clique_count()
: Get the number of maximal cliques in the graph. Wraps igraph::count_max_cliques()
graph_component_count()
: Count the number of unconnected componenets in the graph. Wraps igraph::count_components()
graph_motif_count()
: Count the number of motifs in a graph. Wraps igraph::count_motifs()
graph_diameter()
: Measures the length of the longest geodesic. Wraps igraph::diameter()
graph_girth()
: Measrues the length of the shortest circle in the graph. Wraps igraph::girth()
graph_radius()
: Measures the smallest eccentricity in the graph. Wraps igraph::radius()
graph_mutual_count()
: Counts the number of mutually connected nodes. Wraps igraph::dyad_census()
graph_asym_count()
: Counts the number of asymmetrically connected nodes. Wraps igraph::dyad_census()
graph_unconn_count()
: Counts the number of unconnected node pairs. Wraps igraph::dyad_census()
graph_size()
: Counts the number of edges in the graph. Wraps igraph::gsize()
graph_order()
: Counts the number of nodes in the graph. Wraps igraph::gorder()
graph_reciprocity()
: Measures the proportion of mutual connections in the graph. Wraps igraph::reciprocity()
graph_min_cut()
: Calculates the minimum number of edges to remove in order to split the graph into two clusters. Wraps igraph::min_cut()
graph_mean_dist()
: Calculates the mean distance between all node pairs in the graph. Wraps igraph::mean_distance()
graph_modularity()
: Calculates the modularity of the graph contingent on a provided node grouping
graph_efficiency()
: Calculate the global efficiency of the graph
# Use e.g. to modify computations on nodes and edges
create_notable('meredith') %>%
activate(nodes) %>%
mutate(rel_neighbors = centrality_degree()/graph_order())
#> # A tbl_graph: 70 nodes and 140 edges
#> #
#> # An undirected simple graph with 1 component
#> #
#> # Node Data: 70 × 1 (active)
#> rel_neighbors
#> <dbl>
#> 1 0.0571
#> 2 0.0571
#> 3 0.0571
#> 4 0.0571
#> 5 0.0571
#> 6 0.0571
#> 7 0.0571
#> 8 0.0571
#> 9 0.0571
#> 10 0.0571
#> # ℹ 60 more rows
#> #
#> # Edge Data: 140 × 2
#> from to
#> <int> <int>
#> 1 1 5
#> 2 1 6
#> 3 1 7
#> # ℹ 137 more rows