Description Details Author(s) See Also Examples
Provides several distance metrics that operate on small, directed, labelled networks.
The DESCRIPTION file:
This package was not yet installed at build time.
Index: This package was not yet installed at build time.
Calculate distances with hamming_dist, subgraph_dist or trans_dist to calculate distances between graphs (supplied as adjacency matricies). Hamming_dist will calculate the number of differences in direct edges between graphs. Subgraph_dist will calculate the number of subgraphs that differ. Trans_dist will calculate the number of paths that differ between the two graphs, such that the transitive closure of a graph is identical to the graph. Plots can be generated directly with plot_dist.
Helen Cook <helen.cook@cruk.cam.ac.uk>
Maintainer: Helen Cook <helen.cook@cruk.cam.ac.uk>
igraph
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | a1 <- matrix( c(0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), nrow=4, ncol=4, byrow=TRUE)
dimnames(a1) <- list(c("A", "B", "C", "D"), c("A", "B", "C", "D"))
a2 <- matrix( c(0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0), nrow=4, ncol=4, byrow=TRUE)
dimnames(a2) <- list(c("A", "B", "C", "D"), c("A", "B", "C", "D"))
labnetmet::hamming_dist(a1, a2)
labnetmet::subgraph_dist(a1, a2)
labnetmet::trans_dist(a1, a2)
a3 <- matrix( c(0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0), nrow=4, ncol=4, byrow=TRUE)
dimnames(a3) <- list(c("A", "B", "C", "D"), c("A", "B", "C", "D"))
a4 <- matrix( c(0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1), nrow=4, ncol=4, byrow=TRUE)
dimnames(a4) <- list(c("A", "B", "C", "D"), c("A", "B", "C", "D"))
l <- list(a1, a2, a3, a4)
generate_distances(l, trans_dist)
#labnetmet::plot_dist(l, trans_dist, "~/filename.pdf")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.