Learn R Programming

popgraph (version 1.4)

to_matrix: Matrix conversion for Population Graph

Description

This function translates a Population to a matrix representing either the adjacency structure, the shortest path, or edge weights.

Usage

to_matrix(x, mode = c("adjacency", "shortest path", "edge weight")[1], ...)

Arguments

x
An object of type popgraph
mode
The kind of matrix to make. At present, the following types are available:
  • adjacencyA binary matrix representing the pairs of connected nodes (default)
  • shortest pathThe shortest path between all nodes.
  • edge weightSimilar to the adjacency matrix but using edge weights instead of binary values
...
Optional arguemnts passed on to the distance functions.

Value

A matrix (KxK) in size (where K is the number of nodes)