Learn R Programming

BANFF (version 1.1)

Grid.Adjmatrix.Transfer: Connector for Transferring Grid Coordinates into Adjacency Matrix

Description

This function is a supplementary function for transferring grid coordinates into adjacency matrix. The criteria for defining connected and disconnected: for any two vectors, if euclidean distance is less then a certain value, we consider these two vectors as connected, otherwise, disconnected. The purpose of this function is to quickly transform image data, such as brain image data, into adjacency matrix.

Usage

Grid.Adjmatrix.Transfer(grid, euclidean.dist=1)

Arguments

grid
a x by y matrix or data.frame, representing y vectors with dimension of x row binded (rbind) together.
euclidean.dist
a number representing the maximum euclidean distance to be considered as connected. The default setting is 1.

Value

a y by y binary (0/1) adjacency matrix, where y is the row of the argument grid.

Examples

Run this code
###10 3-D coordinates
x <- matrix(rnorm(3*10), nrow = 10)
###a 10x10 adjacency matrix returned for 'net'
###Distrance larger than 1 is considerded as connected
net<-Grid.Adjmatrix.Transfer(grid=x, euclidean.dist=1)


Run the code above in your browser using DataLab