clustcoef {wdnet}R Documentation

Directed clustering coefficient

Description

Compute the clustering coefficient of a weighted and directed network.

Usage

clustcoef(
  netwk,
  edgelist,
  edgeweight,
  adj,
  directed = TRUE,
  method = c("Clemente", "Fagiolo"),
  isolates = 0
)

Arguments

netwk

A wdnet object that represents the network. If NULL, the function will compute the coefficient using either edgelist, edgeweight, or adj.

edgelist

A two-column matrix, each row represents a directed edge of the network.

edgeweight

A vector representing the weight of edges.

adj

An adjacency matrix of a weighted and directed network.

directed

Logical. Indicates whether the edges in edgelist or adj are directed.

method

Which method used to compute clustering coefficients: Clemente and Grassi (2018) or Fagiolo (2007).

isolates

Binary, defines how to treat vertices with degree zero and one. If 0, then their clustering coefficient is returned as 0 and are included in the averaging. Otherwise, their clustering coefficient is NaN and are excluded in the averaging. Default value is 0.

Value

Lists of local clustering coefficients (in terms of a vector), global clustering coefficient (in terms of a scalar) and number of weighted directed triangles (in terms of a vector) based on total, in, out, middleman (middle), or cycle triplets.

Note

Self-loops (if exist) are removed prior to the computation of clustering coefficient. When the adjacency matrix is symmetric (i.e., undirected but possibly unweighted networks), clustcoef returns local and global clustering coefficients proposed by Barrat et al. (2010).

References

Examples

## Generate a network according to the Erd\"{o}s-Renyi model of order 20
## and parameter p = 0.3
edge_ER <- rbinom(400, 1, 0.3)
weight_ER <- sapply(edge_ER, function(x) x * sample(3, 1))
adj_ER <- matrix(weight_ER, 20, 20)
mycc <- clustcoef(adj = adj_ER, method = "Clemente")
system.time(mycc)


[Package wdnet version 1.2.3 Index]