A.mult {streamDAG}R Documentation

Raise an adjacency matrix to some power

Description

When applying the definition of matrix multiplication to an adjacency matrix \mathbf{A}, the i,j entry in \mathbf{A}^k will give the number of paths in the graph from node i to node j of length k.

Usage

A.mult(G, power, text.summary = TRUE)

Arguments

G

Graph object of class igraph. See graph_from_literal.

power

The power to rise the adjacency matrix to.

text.summary

Logical. If TRUE the function returns a summary of the paths of length power. If FALSE. The adjacency matrix raised to power is returned.

Value

Returns either a character vector of paths of a specified length or, if text.summary = TRUE, the adjacency matrix raised to a specified power.

Author(s)

Ken Aho

Examples

kon_full <- streamDAGs("konza_full")
A.mult(kon_full, power = 6)

[Package streamDAG version 1.5 Index]