graph.h

来自「我写的,画出最短路径,及最小生成树 Prim Dijistra算法+ GDI实」· C头文件 代码 · 共 55 行

H
55
字号
// Graph.h: interface for the CGraph class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_GRAPH_H__F524152D_AE4F_4720_9F4B_3D214CDA3117__INCLUDED_)
#define AFX_GRAPH_H__F524152D_AE4F_4720_9F4B_3D214CDA3117__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CGraph  
{
public:
	CGraph();
	virtual ~CGraph();
struct Point
	{
         int Index;
		 int x,y;
			struct Adj
			{
				bool Visited;
				double Weight;
				struct Point *Address;
				struct Adj *Next; 
			}*AjNow;
        struct Adj *First;
		struct Point *Next;
		 
	}*Head,*Now,*Latest,*Bridge,*SNow;
    int P[100];//
	int CloseVertex[100];
	int Max;
	void AddNew(int x,int y);
	bool SetPath(int &x1,int &y1,int &x2,int &y2);
	void ReDraw();
	bool StartToEnd(int &x1,int &y1,int &x2,int &y2);
	int StartIndex;
	int EndIndex;
	bool Orient;
	void SearchPath();
	void Prim();
private: 
	
	double Min;
	double PathValue;
	double D[100];
	double LowCost[100];
	bool Final[100];
    void SetAdj(int Index1,int Index2);
};

#endif // !defined(AFX_GRAPH_H__F524152D_AE4F_4720_9F4B_3D214CDA3117__INCLUDED_)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?