PottsUtils (version 0.3-3)

getPatches: Get Patches of a Graph

Description

Obtain patches of a graph by Rem's algorithm.

Usage

getPatches(bonds, nvertex)

Arguments

bonds

a matrix of bonds in a graph, with one bond per row.

nvertex

number of vertices in a graph.

Value

A list comprises all patches in a graph. Each component of the list consists of vertices within one patch.

Details

Given all bonds and the number of vertices in a graph, this function provides all patches.

References

Edsger W. Dijkstra (1976) A Discipline of Programming Englewood Cliffs, New Jersey : Prentice-Hall, Inc

Examples

Run this code
# NOT RUN {
  #Example 1: Find patches of a 3*3 2D graph with 6 bonds.

  bonds <- matrix(c(1,2,2,5,5,6,3,6,5,8,7,8), ncol=2, byrow=TRUE)
  getPatches(bonds, 9)
# }

Run the code above in your browser using DataCamp Workspace