chordDiagrams
Class UnframedDiagramGenerator

java.lang.Object
  extended by chordDiagrams.ConfigutaionHolder
      extended by chordDiagrams.UnframedDiagramGenerator
Direct Known Subclasses:
FrameGen2

public class UnframedDiagramGenerator
extends ConfigutaionHolder

Generates all distinct chord diagrams for unframed singular knots. Automatically saves the results to file, and loads the file instead of recomputing (if the file is found).


Field Summary
(package private)  int[] conf
          Array to store current configuration 0 -> not occupied >0 -> skip number -1 -> occupied
(package private)  int count
          Stores configuration count;
(package private)  int k
          Number of links
(package private)  int n
          Number of chords
 
Fields inherited from class chordDiagrams.ConfigutaionHolder
configs
 
Constructor Summary
UnframedDiagramGenerator(int n, int k)
          Creates an instance of the class that generates all diagrams with n chords and k links for the unframed case
 
Method Summary
 void backtrack(int[] arr, int p, int[] links, int[] linkcolors)
          Goes through all skip confugrations to create the list of all diagrams
 java.util.HashMap<java.lang.String,diagram> GenerateDiagrams()
          Generates all the diagrams with n chords and k links the diagrams have no kinks entries containing (xx in coloring format, 1-1 in skip format) If the diagram list has already been generated (i.e., if the file with the list exists), the data from the list will be used instead.
 java.lang.String getFileName()
          Filename that the diagrams will be stored to/loaded from : "unframed_n-k.zdata"
 void init()
          Initializes fields
 boolean isConnected(diagram d)
          This is the diagram connectivity test used in generating the list of diagrams.
 boolean isLegitSkip_v2(int cur, int skip, int[] links, int[] linkcolors)
          Criteria used to enumerate connectors between 2 (or more?) circles
 boolean isLegitSkip(int cur, int skip, int[] links, int[] linkcolors)
          Tells whether a certain skip is allowed.
 int linkSize(int[] links, int t)
          returns the size of a link
 void OutDiag(int[] a)
          Outputs diagram configuration (used to print diagrams in skip format) (prints every entry in the array that's great than -1)
 void ProduceLinkConfigs(int[] links, int n, int t)
          Generates all diagrams by generating all link configs for n chords, and then generating all colorings by calling the corresponding function.
 
Methods inherited from class chordDiagrams.ConfigutaionHolder
isNew, loadConfigs, loadObject, saveConfigs, saveObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

n

int n
Number of chords


k

int k
Number of links


conf

int[] conf
Array to store current configuration 0 -> not occupied >0 -> skip number -1 -> occupied


count

int count
Stores configuration count;

Constructor Detail

UnframedDiagramGenerator

public UnframedDiagramGenerator(int n,
                                int k)
Creates an instance of the class that generates all diagrams with n chords and k links for the unframed case

Method Detail

OutDiag

public void OutDiag(int[] a)
Outputs diagram configuration (used to print diagrams in skip format) (prints every entry in the array that's great than -1)

Parameters:
a - the diagram in skip format

linkSize

public int linkSize(int[] links,
                    int t)
returns the size of a link

Parameters:
links - link configuration
t - link number
Returns:

isLegitSkip

public boolean isLegitSkip(int cur,
                           int skip,
                           int[] links,
                           int[] linkcolors)
Tells whether a certain skip is allowed. Goal: get rid of kinks.

Parameters:
cur - starting poisition
skip - skip number
links - link config in regular format
linkcolors - link config in coloring format
Returns:

isLegitSkip_v2

public boolean isLegitSkip_v2(int cur,
                              int skip,
                              int[] links,
                              int[] linkcolors)
Criteria used to enumerate connectors between 2 (or more?) circles

Parameters:
cur - starting poisition
skip - skip number
links - link config in regular format
linkcolors - link config in coloring format
Returns:

backtrack

public void backtrack(int[] arr,
                      int p,
                      int[] links,
                      int[] linkcolors)
Goes through all skip confugrations to create the list of all diagrams

Parameters:
arr - array to store the configuration
p - candidate position
links - stores the link structure by storing ring delimiter indices
linkcolors - same as links, but stores link colors in an array

isConnected

public boolean isConnected(diagram d)
This is the diagram connectivity test used in generating the list of diagrams. Can be overriden in descendants to allow for disconnected diagrams. Returns d.isConnected

Parameters:
d - diagram whose connectivity is to be checked
Returns:
true if d is connected

ProduceLinkConfigs

public void ProduceLinkConfigs(int[] links,
                               int n,
                               int t)
Generates all diagrams by generating all link configs for n chords, and then generating all colorings by calling the corresponding function. The method thus fills the configs ArrayList.

Parameters:
links - the array to store the config
n - number of chords
t - current link

GenerateDiagrams

public java.util.HashMap<java.lang.String,diagram> GenerateDiagrams()
Generates all the diagrams with n chords and k links the diagrams have no kinks entries containing (xx in coloring format, 1-1 in skip format) If the diagram list has already been generated (i.e., if the file with the list exists), the data from the list will be used instead.

Returns:
the list that contains all the generated diagrams

init

public void init()
Initializes fields


getFileName

public java.lang.String getFileName()
Filename that the diagrams will be stored to/loaded from : "unframed_n-k.zdata"

Specified by:
getFileName in class ConfigutaionHolder
Returns:
digram list filename