This method take an adjacency matrix (dense or sparse), and returns the corresponding transition matrix in the same format. If the optional argument `directed` is specified to be FALSE, then before computing the transition matrix the adjacency matrix is forced be symmetric.

get_transition(adj, directed = NULL, ...)

# S3 method for matrix
get_transition(adj, directed = NULL, ...)

# S3 method for dgTMatrix
get_transition(adj, directed = NULL, ...)

# S3 method for dgCMatrix
get_transition(adj, directed = NULL, ...)

# S3 method for sparseMatrix
get_transition(adj, directed = NULL, ...)

# S3 method for default
get_transition(adj, directed = NULL, ...)

Arguments

adj

adjacency matrix, either dense or sparse

directed

boolean, optional argument specifying if the matrix refers to a directed graph.

...

additional parameters to and from the main method. Currently not used.

Value

A transition matrix in the same format of `adj`.

Examples

el <- data.frame(from= c('a','b','b','c','d','d'), to = c('b','c','d','a','b','a'), attr= c( 12, 6, 12 , 6 , 6 , 6 )) adj <- el2adj(el) t_mat <- get_transition(adj)