tidygraph (version 1.2.0)

graph_measures: Graph measurements

Description

This set of functions provide wrappers to a number of <U+00EC>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, currently 3 and 4 are supported only.

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

Examples

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

Run the code above in your browser using DataLab