triadCensus
returns a list of all triads.
triadCensus(graph)
isTriad(x, y, z, elz, ely)
reduce2Degreek(graph, k)
enumPairs(iVec)graph class. zyenumPairs takes a vector as input and returns a list of length
choose(length(iVec),2)/2 containing all unordered pairs of
elements. isTriad takes three nodes as arguments. It is already known
that x has edges to both y and z and we want to
determine whether these are reciprocated. This is determined by
examining elz for both x and y and then examining
ely for both x and z.
reduce2Degreek is a function that takes an undirected graph as
input and removes all nodes of degree less than k. This process
is iterated until there are no nodes left (an error is thrown) or all
nodes remaining have degree at least k. The resultant subgraph
is returned. It is used here because to be in a triad all nodes must
have degree 2 or more.
triadCensus makes use of the helper functions described above
and finds all triads in the graph.
##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
Run the code above in your browser using DataLab