dyad_census_attr: dyad census with node attributes

View source: R/dyad_census_attr.R

dyad_census_attrR Documentation

dyad census with node attributes

Description

dyad census with node attributes

Usage

dyad_census_attr(g, vattr)

Arguments

g

igraph object. should be a directed graph.

vattr

name of vertex attribute to be used.

Details

The node attribute should be integers from 1 to max(attr). Multiple edges and loops are ignored.

Value

dyad census as a data.frame with one row per unordered pair of attribute values from_attr <= to_attr and columns

asym_ab

asymmetric dyads with the edge pointing from from_attr to to_attr. For within-group rows (from_attr == to_attr) this is the total number of asymmetric dyads.

asym_ba

asymmetric dyads with the edge pointing from to_attr to from_attr. NA for within-group rows, where the direction is not defined.

sym

mutual dyads

null

empty dyads

Author(s)

David Schoch

Examples

library(igraph)
g <- sample_gnp(10, 0.4, directed = TRUE)
V(g)$attr <- c(rep(1, 5), rep(2, 5))
dyad_census_attr(g, "attr")

netUtils documentation built on Sept. 30, 2026, 5:10 p.m.