graph_measures {tidygraph} | R Documentation |
Graph measurements
Description
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.
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
attr |
The node attribute to measure on |
in_attr |
An alternative node attribute to use for incomming node. If |
directed |
Should a directed graph be treated as directed |
sh |
The splitting heuristics for the BLISS algorithm. Possible values
are: ‘ |
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 |
min , max |
The upper and lower bounds of the cliques to be considered. |
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. |
type |
The type of component to count, either 'weak' or 'strong'. Ignored for undirected graphs. |
size |
The size of the motif. |
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 |
weights |
Optional positive weight vector for calculating weighted
distances. If the graph has a |
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. |
mode |
How should eccentricity be calculated. If |
ignore_loops |
Logical. Should loops be ignored while calculating the reciprocity |
ratio |
Should the old "ratio" approach from igraph < v0.6 be used |
capacity |
The capacity of the edges |
group |
The node grouping to calculate the modularity on |
Value
A scalar, the type depending on the function
Functions
-
graph_adhesion()
: Gives the minimum edge connectivity. Wrapsigraph::edge_connectivity()
-
graph_assortativity()
: Measures the propensity of similar nodes to be connected. Wrapsigraph::assortativity()
-
graph_automorphisms()
: Calculate the number of automorphisms of the graph. Wrapsigraph::count_automorphisms()
-
graph_clique_num()
: Get the size of the largest clique. Wrapsigraph::clique_num()
-
graph_clique_count()
: Get the number of maximal cliques in the graph. Wrapsigraph::count_max_cliques()
-
graph_component_count()
: Count the number of unconnected componenets in the graph. Wrapsigraph::count_components()
-
graph_motif_count()
: Count the number of motifs in a graph. Wrapsigraph::count_motifs()
-
graph_diameter()
: Measures the length of the longest geodesic. Wrapsigraph::diameter()
-
graph_girth()
: Measrues the length of the shortest circle in the graph. Wrapsigraph::girth()
-
graph_radius()
: Measures the smallest eccentricity in the graph. Wrapsigraph::radius()
-
graph_mutual_count()
: Counts the number of mutually connected nodes. Wrapsigraph::dyad_census()
-
graph_asym_count()
: Counts the number of asymmetrically connected nodes. Wrapsigraph::dyad_census()
-
graph_unconn_count()
: Counts the number of unconnected node pairs. Wrapsigraph::dyad_census()
-
graph_size()
: Counts the number of edges in the graph. Wrapsigraph::gsize()
-
graph_order()
: Counts the number of nodes in the graph. Wrapsigraph::gorder()
-
graph_reciprocity()
: Measures the proportion of mutual connections in the graph. Wrapsigraph::reciprocity()
-
graph_min_cut()
: Calculates the minimum number of edges to remove in order to split the graph into two clusters. Wrapsigraph::min_cut()
-
graph_mean_dist()
: Calculates the mean distance between all node pairs in the graph. Wrapsigraph::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
Examples
# Use e.g. to modify computations on nodes and edges
create_notable('meredith') %>%
activate(nodes) %>%
mutate(rel_neighbors = centrality_degree()/graph_order())