graph_measures: Graph measurements

graph_measuresR Documentation

Graph measurements

Description

This set of functions provide wrappers to a number of ìgraphs 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")

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)

graph_modularity(group, weights = NULL)

Arguments

attr

The node attribute to measure on

in_attr

An alternative node attribute to use for incomming node. If NULL the attribute given by type will be used

directed

Should a directed graph be treated as directed

sh

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.

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 size argument). By default no cuts are made.

weights

Optional positive weight vector for calculating weighted distances. If the graph has a weight edge attribute, then this is used by default.

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 "out" only outbound edges are followed. If "in" only inbound are followed. If "all" all edges are followed. Ignored for undirected graphs.

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. 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::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

Examples

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

tidygraph documentation built on Feb. 16, 2023, 10:40 p.m.