knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(dimensional) library(tidygraph) library(tidyverse)
Dimensional takes data in a table graph format. This can be added a number of ways, for details see https://www.data-imaginist.com/2017/introducing-tidygraph/. For an example, we will here use an edgelist and a nodelist to create an undirected table graph.
data("nodes_decor", "edges_decor") decor.graph <- tbl_graph(nodes = nodes_decor, edges = edges_decor, directed = FALSE) decor.graph
In this example data, the different dimensions of the graph are stored as edge attributes under the name
variable. You should make sure that your data also stores the dimensions this way, and be certain to call this variable "name".
flatten()
This function flattens a multilayer graph into a simple graph. This function is useful for comparing multilayer with simple network measures.
flatten()
simply collapses all edges between a pair of actors across all layers into a single edge. If there is a weight column, the weights of all collapsed edges will be summed. If weight = NULL, no weights are retained.
simple.flat <- flatten(decor.graph, weighted = FALSE) simple.flat weighted.flat <- flatten(decor.graph, weighted = TRUE) weighted.flat
multidesc()
:This function will give a particular set of measures for a basic description of a multilayer network, both layer by layer and for the flattened network. The measures are: number of nodes, density, clustering coefficient, degree centralization, average path length, diameter.
# multidesc(decor.graph)
centrality_neighborhood()
This augments the centrality_
classes in tidygraph with neighborhood centrality as defined by Berlingerio et al. (2011). centrality_neighborhood()
can take a specified actor, or a vector of actors, as well as a specified layer of vector of layers. If these are left unspecified, it defaults to the entire graph. The function appends a neighborhood centrality measure as a node attribute named "neighbours"
a <- c("5", "6") #specify actors by id l <- c("folded_strip_roulette") centrality_neighborhood(decor.graph)
Calculates the connective redundancy of a set of actors over a set of layers as defined by Dickison et al. (2016). Can take a specified actor, or a vector of actors, as well as a specified layer of vector of layers. If these are left unspecified, it defaults to the entire graph. Returns a tibble with actor name, degree, neighbors, and redundancy.
conred <- connective_redundancy(decor.graph) head(conred)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.