getBlocks {bayesImageS} R Documentation

## Get Blocks of a Graph

### Description

Obtain blocks of vertices of a 1D, 2D, or 3D graph, in order to use the conditional independence to speed up the simulation (chequerboard idea).

### Usage

```getBlocks(mask, nblock)
```

### Arguments

 `mask` a vector, matrix, or 3D array specifying vertices of a graph. Vertices of value 1 are within the graph and 0 are not. `nblock` a scalar specifying the number of blocks. For a 2D graph `nblock` could be either 2 or 4, and for a 3D graph `nblock` could be either 2 or 8.

### Details

The vertices within each block are mutually independent given the vertices in other blocks. Some blocks could be empty.

### Value

A list with the number of components equal to `nblock`. Each component consists of vertices within the same block.

### References

Wilkinson, D. J. (2005) "Parallel Bayesian Computation" Handbook of Parallel Computing and Statistics, pp. 481-512 Marcel Dekker/CRC Press

### Examples

```  #Example 1: split a line into 2 blocks

#Example 2: split a 4*4 2D graph into 4 blocks in order
#           to use the chequerboard idea for a neighbourhood structure
#           corresponding to the second-order Markov random field.