Description Usage Arguments Value See Also Examples
get_multipartite
builds a properly-structured multipartite graph
from a file or from a data.frame
containing raw data. This object can then
be used by the other functions of this package. The structure
of the input data and of the resulting structure is detailed below.
1 | get_multipartite(filename = NULL, data = NULL)
|
filename |
A character string giving the path to the file containing the raw data. The input file should contain at least four columns, separated by spaces. Each row gives a link between two nodes belonging to two different parts of the multipartite graph. The first column gives the label of the part of the first node and the second column gives the label of this node (any character string). Similarly, the third and fourth columns give the labels of the second part and of the second node. The file can eventually contain a fifth column giving the weights of the links (any positive integer or float value). |
data |
A This |
A properly-structured multipartite graph that can be used by the other functions
of the triversity
package.
The resulting object encodes the labels of the parts and of the nodes in the multipartite
graph, as well as the transition matrices of random walks following different paths
between parts (encoded as sparse matrices of floats in [0
,1
], with all
rows summing to 1
). These transition matrices
are then used by functions such as get_distribution_from_path
to
compute the probability distributions of such random walks, or such as
get_diversity_from_path
to compute the diversity of these distributions.
Assuming the object returned by get_multipartite
is stored in the
graph
variable, then:
graph$parts
is a vector of character strings giving the labels of the
different parts in the multipartite graph;
graph$nodes
is a list of vectors of character strings giving the labels
of the nodes constituting the different parts of the multipartite graph;
graph$edges
is a data.tree
whose nodes each contains the
transition matrix of the corresponding random walk.
Package slam
for the sparse encoding of transition matrices and
package data.tree
for the tree structure storing these matrices.
1 2 3 4 5 6 7 8 9 10 | data (tripartite_example)
graph <- get_multipartite (data=tripartite_example)
graph$parts
part1 <- graph$parts[1]
graph$nodes[[part1]]
part2 <- graph$parts[2]
as.matrix (graph$edges$Climb(part1,part2)$matrix)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.