view defical-c/src/graphmagic.h @ 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

#include "includes.h"
using namespace std;

class semtd;

class semtd
{
private:
	//graphType: 0=path, 1=cycle, 2=completebipartite, 3=wheel, 4=fan, 5=doublefan
	//vector< vector<bool> > theGraph;
	bool theGraph[1000][1000];
	bool isQuickMode;
	bool isSureFail;
	vector< vector<uint32_t> > edgeLabels;
	vector<uint32_t> edgeLabelsUsed;
	uint32_t edgeLabelAbsoluteMax,edgeLabelMin,edgeLabelMax;
	double scoreCache;
	inline uint32_t edgeLabelRange();
	void setEdgeLabels(uint32_t verPos);
	void removeEdgeLabels(uint32_t verPos);
	void refreshEdgeLabelsMinMax();
	void resetLabels(uint32_t mode);
	void draw(uint32_t drawType,uint32_t start,uint32_t end);
	void draw(uint32_t drawType,uint32_t start,uint32_t end,uint32_t extra);
	inline void connectVertices(uint32_t a,uint32_t b);
	bool isValidRange(uint32_t min,uint32_t max);
public:
	uint32_t numDef,numEdges,graphType;
	semtd();
	semtd(uint32_t graphType, uint32_t numVer, uint32_t numDef);
	uint32_t NumVer,TotalVer;
	vector<uint32_t> VerLabels;
	string Print(uint32_t withDual);
	void FixLabel();
	void SwapLabel();
	bool IsSemt();
	double SemtScore();
	void SetVerLabel(uint32_t verPos,uint32_t verLabel);
	void RemoveVerLabel(uint32_t verPos);
	bool IsValidToLabel(uint32_t verPos,uint32_t verLabel);
	uint32_t MinDef();
};