view defical-sharp/libbacktrack/backtrack.cs @ 0:ebed2bd0d300

Initial import from svn. History be damned.
author Edho P. Arief <me@myconan.net>
date Fri, 02 Apr 2010 23:11:57 +0700
parents
children
line wrap: on
line source

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using libsemtd;

namespace libbacktrack
{
    public partial class Backtrack
    {
        public Backtrack() { throw new NotImplementedException(); }
        public Backtrack(string graphType, int numVerMain, int numVerDef, int firstLabel, bool isRecurseAll)
        {
            this.result = "";
            this.myGraph = new Semtd(graphType, numVerMain, numVerDef);
            this.labelVerUsed = new bool[this.myGraph.NumVerTotal + 1];
            this.isRecurseAll = isRecurseAll;
            setLabel(0, firstLabel);
            this.firstLabel = firstLabel;
            this.pathLabel = this.pathStart = this.pathEnd = 0;
            switch (graphType)
            {
                case "fan":
                    {
                        this.pathStart = 1;
                        this.pathEnd = this.myGraph.NumVerMain - 1;
                        break;
                    }
                case "wheel":
                case "doubefan":
                    {
                        this.pathStart = 2;
                        this.pathEnd = this.myGraph.NumVerMain - 1;
                        break;
                    }
            }
        }
    }
}