| similarity | R Documentation |
Compares the edge set at every time bin with the edge set at every other,
giving the pairwise similarity matrix as a tidy frame. This answers how
much the network at one moment resembles the network at another, which no
single-bin measure reports and which the formation and dissolution
quantities in events() only address between neighbouring bins.
Coefficients are computed by cograph::layer_similarity().
similarity(
dn,
method = c("jaccard", "overlap", "hamming", "cosine", "pearson"),
sessions = c("bounded", "collapse", "separate"),
start = NULL,
end = NULL,
step = NULL,
window = NULL,
plot = FALSE
)
dn |
A temporal network from |
method |
One of |
sessions |
How to treat sessions when the layers are built:
|
start, end |
First and last time to measure. Default to the observed range. |
step |
How often to measure. Defaults to the interval the network was built with. |
window |
How much time each measurement covers. Defaults to |
plot |
Whether to draw the result as well as return it. Drawing is a
side effect in the manner of |
A dynet_similarity data frame with one row per ordered pair of
time bins and columns time, other, measure and value. The
diagonal is included and is one for every coefficient except
"hamming", where identical layers differ in nothing and score zero.
"pearson" reaches one only to floating-point accuracy, so compare it
with a tolerance rather than with ==. The frame is returned invisibly
when plot = TRUE has drawn the figure.
The coefficients come from cograph, which is a hard dependency of Dynet;
a namespace that cannot be loaded raises dynet_needs_cograph.
snapshots() for the networks being compared, events() for
formation and dissolution between neighbouring bins.
dn <- dynet(school_contacts)
similarity(dn)
similarity(dn, method = "cosine")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.