Learn R Programming

PottsUtils (version 0.3-3)

getConfs: Generate Configurations of a Graph

Description

Using recursive method to generate all possible configurations of a graph.

Usage

getConfs(nvertex, ncolor)

Arguments

nvertex

number of vertices in a graph.

ncolor

number of colors each vertex can take.

Value

A matrix of all possible configurations. Each column corresponds to one configuration.

Details

Suppose there are n vertices and each can take values from \(1,2, \ldots, ncolor\). This function generates all possible configurations. For example, if there are two vertices and each can be either 1 or 2, then the possible configurations are (1,1), (1,2), (2,1) and (2,2).

Examples

Run this code
# NOT RUN {
  #Example 1: There are two vertices and each is either of
  #           color 1 or 2.
  getConfs(2,2)
# }

Run the code above in your browser using DataLab