Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Расчетно Пояснительная записка_Шаханов.doc
Скачиваний:
1
Добавлен:
01.03.2025
Размер:
2.65 Mб
Скачать

Приложение 2

Блок-схемы основных процедур

      1. Процедура построения вектора - DrawArrow.

Рис П2.1. Рисование вектора

      1. Процедура обхода графа в глибину

Рис. П2.2. Обход в глубину

      1. Поиск компонент связности

Рис. П.2.3.Компоненты связности

      1. Визуализация графа

Рис. П2.4. Визуализация графа

Рис. П2.5. Визуализация графа

Прямая соединительная линия 9

Рис. П2.6. Визуализация графа

      1. Нахождение и построение точек сочленения

Рис. П2.7. Точки сочленения графа

Приложение 3 Листинг программы:

unit Graf;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, ComCtrls, ExtCtrls, Buttons, StdCtrls, Grids, XPMan;

type

TMainGraf = class(TForm)

PageControl1: TPageControl;

TabSheet1: TTabSheet;

TabSheet2: TTabSheet;

GroupBox1: TGroupBox;

Edit1: TEdit;

Label4: TLabel;

Button1: TButton;

Button2: TButton;

Label6: TLabel;

TabSheet3: TTabSheet;

RadioGroup1: TRadioGroup;

CheckBox1: TCheckBox;

GroupBox2: TGroupBox;

Label3: TLabel;

Label5: TLabel;

Label13: TLabel;

TabSheet4: TTabSheet;

Image2: TImage;

Panel3: TPanel;

Memo1: TMemo;

XPManifest1: TXPManifest;

XPManifest2: TXPManifest;

XPManifest3: TXPManifest;

XPManifest4: TXPManifest;

SpeedButton1: TSpeedButton;

SpeedButton3: TSpeedButton;

SpeedButton4: TSpeedButton;

SpeedButton2: TSpeedButton;

SpeedButton5: TSpeedButton;

SpeedButton6: TSpeedButton;

SpeedButton8: TSpeedButton;

SpeedButton7: TSpeedButton;

Edit2: TEdit;

StringGrid1: TStringGrid;

Image1: TImage;

StringGrid2: TStringGrid;

Image3: TImage;

Label2: TLabel;

BitBtn1: TBitBtn;

CheckBox2: TCheckBox;

Timer1: TTimer;

RadioGroup2: TRadioGroup;

Panel1: TPanel;

ColorBox2: TColorBox;

ColorBox3: TColorBox;

ColorBox1: TColorBox;

ColorBox7: TColorBox;

ColorBox4: TColorBox;

ColorBox5: TColorBox;

ColorBox6: TColorBox;

Label11: TLabel;

Label12: TLabel;

Label10: TLabel;

Label1: TLabel;

Label7: TLabel;

Label9: TLabel;

Label8: TLabel;

Label14: TLabel;

Label15: TLabel;

Label16: TLabel;

Label17: TLabel;

Label18: TLabel;

Label19: TLabel;

Label20: TLabel;

XPManifest5: TXPManifest;

procedure TabSheet2Resize(Sender: TObject);

procedure SpeedButton1Click(Sender: TObject);

procedure SpeedButton2Click(Sender: TObject);

procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

procedure Image1MouseMove(Sender: TObject; Shift: TShiftState; X,

Y: Integer);

procedure Image1MouseUp(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

procedure Button2Click(Sender: TObject);

procedure Button1Click(Sender: TObject);

procedure FormCreate(Sender: TObject);

procedure SpeedButton5Click(Sender: TObject);

procedure SpeedButton5MouseMove(Sender: TObject; Shift: TShiftState; X,

Y: Integer);

procedure PageControl1Change(Sender: TObject);

procedure SpeedButton7Click(Sender: TObject);

procedure SpeedButton4Click(Sender: TObject);

procedure SpeedButton3Click(Sender: TObject);

procedure SpeedButton6Click(Sender: TObject);

procedure SpeedButton8Click(Sender: TObject);

procedure FormResize(Sender: TObject);

procedure BitBtn1Click(Sender: TObject);

procedure Timer1Timer(Sender: TObject);

procedure StringGrid1SelectCell(Sender: TObject; ACol, ARow: Integer;

var CanSelect: Boolean);

procedure StringGrid1MouseUp(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

procedure StringGrid1SetEditText(Sender: TObject; ACol, ARow: Integer;

const Value: String);

procedure SpeedButton1MouseMove(Sender: TObject; Shift: TShiftState; X,

Y: Integer);

procedure SpeedButton2MouseMove(Sender: TObject; Shift: TShiftState; X,

Y: Integer);

procedure SpeedButton3MouseMove(Sender: TObject; Shift: TShiftState; X,

Y: Integer);

procedure SpeedButton4MouseMove(Sender: TObject; Shift: TShiftState; X,

Y: Integer);

procedure SpeedButton6MouseMove(Sender: TObject; Shift: TShiftState; X,

Y: Integer);

procedure SpeedButton7MouseMove(Sender: TObject; Shift: TShiftState; X,

Y: Integer);

procedure SpeedButton8MouseMove(Sender: TObject; Shift: TShiftState; X,

Y: Integer);

procedure BitBtn1MouseMove(Sender: TObject; Shift: TShiftState; X,

Y: Integer);

procedure CheckBox1MouseMove(Sender: TObject; Shift: TShiftState; X,

Y: Integer);

procedure StringGrid1KeyPress(Sender: TObject; var Key: Char);

procedure ColorBox2Change(Sender: TObject);

procedure ColorBox3Change(Sender: TObject);

procedure ColorBox1Change(Sender: TObject);

procedure ColorBox7Change(Sender: TObject);

procedure ColorBox4Change(Sender: TObject);

procedure ColorBox5Change(Sender: TObject);

procedure ColorBox6Change(Sender: TObject);

procedure Edit2KeyPress(Sender: TObject; var Key: Char);

procedure Memo1KeyPress(Sender: TObject; var Key: Char);

private

{ Private declarations }

public

Procedure Depth(v:byte; _Type:byte);

// Procedure Reach();

Procedure Recursiya(ii: integer);

Procedure Visualization(Canvas: TCanvas;_Type: byte);

procedure DrawArrow(Canvas: TCanvas;x0, y0,x1,y1: Integer; __type,penwidth: byte);

function FindKS(_Type: byte): byte;

end;

var

MainGraf: TMainGraf;

i,j: integer;

ShowGraf: boolean; //построен ли граф.

RSel,CSel: integer; //выделенная вершина

CountDel: integer; //делитель

CenterX, CenterY,Radius: integer; //цент окружности и построения

Vershina: byte; //количисетво вершин, не больше 255

masX,MasY: array of integer; //массивы координат вершин

MouseDowning,MouseMoving: boolean; //нажата ли клавиша мыши

UsingPoint: byte; //вершина которую можно переместить

R1: Array [1..255] of array[1..255] of integer; //массив для проверки на связность

mark,Emark: array of byte; //глобалные переменные для обхода в ширину

KountKS: byte; //счётчик количества компонент связности

GroupKS: array of byte; //прохождения вершин для нахождения компонент свяности.

ExceptionV: byte; //вершина проверяемая на точку сочленения.

Mark1:array [byte] of boolean; // в глубину

K: boolean;

S,c: integer;

PS: array of byte; //точки сочленения;

clrOfP: array[0..256] of TColor; //массив цетов для компонентов свяности\двусвязнсти

_TypeOV: byte;

implementation

{$R *.dfm}

//нахождение количества компонент связности:

function TmainGraf.FindKS(_Type: byte): byte;

begin

//стандартное количество компонент связности

for i:=1 to Vershina do begin Mark1[i]:=false; GroupKS[i-1]:=0; end;

KountKS:=1;

if _type=1 then

begin

Memo1.Clear;

Memo1.text:=('Компоненты связности: ( ');

For i:=1 to Vershina do begin

if GroupKS[i-1]=0 then

begin

Memo1.Text:=Memo1.Text+' {';

Depth(i,2);

Memo1.Text:=Memo1.Text+' } ';

inc(KountKS);

end;

end;

Memo1.Text:=Memo1.Text+' )';

Memo1.Lines.Add('Число компонентов связности: - '+inttostr(KountKS-1));

end;

//количество компонент связности, исключая вершину

if _type=2 then

begin

For i:=1 to Vershina do begin

if i<>ExceptionV then

if GroupKS[i-1]=0 then

begin

Depth(i,1);

inc(KountKS);

end;

end;

FindKS:=KountKS-1;

end;

//количество компонент связности, исключая все точки сочленения

if _type=3 then

begin

For i:=1 to Vershina do begin

if PS[i-1]<>1 then

if GroupKS[i-1]=0 then

begin

Depth(i,3);

inc(KountKS);

end;

end;

FindKS:=KountKS-1;

end;

end;

// Обход в глубину--------------------------------------------------------------

procedure TMainGraf.Depth(v:byte;_Type:byte);

var u,z:byte;

begin

GroupKS[v-1]:=KountKS;

Mark1[v]:=true;

//обход для нахождения точек сочленения

if _type=1 then begin

for u:=1 to Vershina do

if (u<>ExceptionV) then

if (not Mark1[u]) and (StringGrid2.Cells[v,u]='1') then Depth(u,1);

end;

//стандартный обход в глубину

if _type=2 then begin

Memo1.text:=Memo1.text+' '+inttostr(v);

for u:=1 to Vershina do

if not Mark1[u] and (StringGrid1.Cells[v,u]='1') then Depth(u,2);

end;

//обход если не рассматривать точки сочленения

if _type=3 then begin

for u:=1 to Vershina do

if (PS[u-1]<>1) then

if (not Mark1[u]) and (StringGrid1.Cells[v,u]='1') then Depth(u,3);

end;

end;

//Обход в ширину--------------------------------------

Procedure TMainGraf.Recursiya(ii: integer);

var

a,b: integer;

begin

//ОТМЕЧАЕМ ЧТО НА ДАННЫЙ МОМЕНТ ЭТА ВЕРШИНА ПО КОТОРОЙ БУДУТ ОПРЕДЕЛЯТЬСЯ СМЕЖНЫЕ

Emark[ii-1]:=0;

//ЕСЛИ ВСЕ ВЕРШИНЫ ПРОЙДЕНЫ ТО ВЫХОД

if k=false then begin

S:=0;

for b:=0 to Vershina-1 do

begin

S:=S+Mark[b];

end;

if S=Vershina then k:=true;

//ПРОВЕРЯЕМ СМЕЖНЫЕ ВЕРШИНЫ

For a:=1 to Vershina do begin

if a<>ii then begin

if (mark[a-1]=0) then begin

if (MainGraf.StringGrid1.Cells[a,ii]<>'0') then

begin

mark[a-1]:=1;

Memo1.Text:=Memo1.Text+' '+inttostr(a);

end;

end;

end;

end;

//ВЫЗВАЕМ РЕКРСИЮ НА КАЖДУЮ ИЗ НЕ ПРОЙДЕННЫХ!!! СМЕЖНЫХ ВЕРШИН

for c:=1 to Vershina do begin

if c<>ii then begin

if (Emark[c-1]=1) then begin

if (Mark[c-1]=1) then begin

Recursiya(c);

end;

end;

end;

end;

end;

end;

//Проверка графа на связность---------------------

procedure Reach();

{enoiaiua aaiiua - iao?eoa nia?iinoe A, aeiaaeuiay ia?aiaiiay}

var

S,T:set of 1..255;

i,j,l:integer;

begin

FillChar(R1,SizeOf(R1),0);

for i:=1 to Vershina do begin {ainoe?eiinou ec aa?oeiu n iiia?ii i}

T:=[i];

repeat

S:=T;

for l:=1 to Vershina do if l in S then{ii no?ieai iao?eou A, i?eiaaea?auei iii?anoao S}

for j:=1 to Vershina do if strtoint(MainGraf.StringGrid1.cells[l,j])=1 then T:=T+[j];

until S=T;{anee T ia eciaieeinu, oi iaeaaiu ana aa?oeiu a?aoa, ainoe?eiua ec aa?oeiu n iiia?ii i}

for j:=1 to Vershina do if j in T then R1[i,j]:=1;

end;

end;

//ПРОЦЕДУРА ПОСТРОЕНИЯ ЛИНИИ 2 ВАРИАНТОВ НАПРАВЛЕННУЮ(1) ИЛИ НЕТ(2)

//C НАСТРОЙКОЙ ШИРИНЫ ЛИНИИ

procedure TMainGraf.DrawArrow(Canvas: TCanvas;x0, y0,x1,y1: Integer; __type,penwidth: byte);

var

XB, YB, XE, YE, XM, YM,x11,y11: Integer;

Angle_Line, Angle_Arrow: Extended;

Length_Line, Length_Arrow: integer;

begin

Canvas.Pen.Width:=penwidth;

Canvas.MoveTo(x0,y0);

Angle_Arrow:=pi/24;

if (y1=y0) and (x1>x0) then Angle_Line:=0;

if (x1=x0) and (y1<y0) then Angle_Line:=pi/2;

if (y0=y0) and (x0>x1) then Angle_Line:=pi;

if (x1=x0) and (y1>y0) then Angle_Line:=-pi/2;

if (x0<x1) and (y0<>y1) then Angle_Line:=ArcTan((y0-y1)/(x1-x0));

if (x0>x1) and (y0<>y1) then Angle_Line:=ArcTan(((y0-y1)/(x1-x0)))+pi;

if (x0=x1) and (y0=y1) then

begin MainGraf.Image1.Picture.Bitmap.Canvas.MoveTo(x0,y0);

MainGraf.Image1.Picture.Bitmap.Canvas.LineTo(x0+1,y0+1);

exit;

end;

x11:= abs(Round(cos(Angle_Line)*10));

y11:=abs(Round(sin(Angle_Line)*10));

if (x0>x1) and (y0>y1) then

begin x1:=x1+x11; y1:=y1+y11; x0:=x0-x11; y0:=y0-y11; end;

if (x0<=x1) and (y0>y1) then

begin x1:=x1-x11; y1:=y1+y11; x0:=x0+x11; y0:=y0-y11; end;

if (x0>x1) and (y0<=y1) then

begin x1:=x1+x11; y1:=y1-y11; x0:=x0-x11; y0:=y0+y11; end;

if (x0<=x1) and (y0<=y1) then

begin x1:=x1-x11; y1:=y1-y11; x0:=x0+x11; y0:=y0+y11; end;

XM := Round(X1 - Cos(Angle_Arrow - Angle_Line) * 15);

YM := Round(Y1 - Sin(Angle_Arrow - Angle_Line) * 15);

XE := Round(X1 + Sin(Angle_Arrow + Angle_Line - Pi / 2) * 15);

YE := Round(Y1 + Cos(Angle_Arrow + Angle_Line - Pi / 2) * 15);

if __type=1 then begin

Canvas.MoveTo(x0, y0); Canvas.LineTo(x1, y1);

Canvas.LineTo(XM, YM); Canvas.MoveTo(XE, YE);

Canvas.LineTo(X1, Y1)

end;

if __type=2 then begin

Canvas.MoveTo(x0, y0); Canvas.LineTo(x1, y1);

end;

end;

//-построение графа-----------------------------------

Procedure TMainGraf.Visualization(Canvas: TCanvas;_Type: byte);

var

i,j: integer; //cчетчики

a,b,c: integer; //переменный для дополниельных вычислений

Xx,Yy :integer; //переменные для хранения координаты вершины

cosS,SinS: real; // син и косинус угла наклона

Ugol: real; // угол наклона прямой

alpha: real; // угол наклона стрелки у прямой

Step: integer; //шаг для построения квадрата

s1,s2: string; //строки для записи в лейбл

begin

Canvas.Pen.Color:=clWhite;

Canvas.Brush.Color:=clWhite;

canvas.Rectangle(0,0,MainGraf.Image1.Width, MainGraf.Image1.Height);

//НАЧАЛЬНОЕ ПОСТРОЕНИЕ ПО КРУГУ ВСЕХ ВЕРШИН

//ПОСТРОЕНИЕ ПО ОКРУЖНОСТИ ----------------

if _type=1 then begin

Ugol:=360/vershina;

ugol:=ugol*Pi/180;

alpha:=Pi;

Canvas.Pen.Width:=2;

Canvas.Pen.Color:=MainGraf.ColorBox3.Selected; //!!!

Canvas.Brush.Color:=MainGraf.ColorBox1.Selected;; //!!!

for i:=0 to Vershina-1 do

begin

if (ugol<=Pi/2) and (ugol>=3*Pi/2) then Xx:=Trunc(240+(200*cos(alpha)-0*sin(alpha))) else Xx:=trunc(240-(200*cos(alpha)-0*sin(alpha)));

If (ugol<=Pi) and (ugol>=2*Pi) then Yy:=Trunc(240+(200*sin(alpha)+0*cos(alpha))) else Yy:=Trunc(240-(200*sin(alpha)+0*cos(alpha)));

MasX[i]:=Xx;

MasY[i]:=Yy;

alpha:=alpha-ugol;

end;

end;

//ПОСТРОЕНИЕ ПРИ ПЕРЕМЩЕНИИ ВЕРШИНЫ --------------------------------------------

if _type=2 then begin

Canvas.Pen.Width:=2; Canvas.Pen.Color:=MainGraf.ColorBox3.Selected;; //!!!

Canvas.Brush.Color:=MainGraf.ColorBox1.Selected;; //!!!

MainGraf.Label3.Caption:='';

for i:=0 to Vershina-1 do

begin

if MasX[i]<=20 then MasX[i]:=20;

if MasY[i]<=20 then MasY[i]:=20;

if MasX[i]>=MainGraf.Image1.Width-10 then MasX[i]:=MainGraf.Image1.Width-10;

if MasY[i]>=MainGraf.Image1.Height-10 then MasY[i]:=MainGraf.Image1.Height-10;

Xx:=MasX[i];

Yy:=MasY[i];

alpha:=alpha-ugol;

end;

end;

//ПОСТРОЕНИЕ ПО КВАДРАТУ ---------------------

if _type=3 then begin

if Vershina=3 then begin

MasX[0]:=30;

MasY[0]:=450;

MasX[1]:=450;

MasY[1]:=450;

MasX[2]:=450;

MasY[2]:=30;

exit;

end;

if Vershina=2 then begin

MasX[0]:=30;

MasY[0]:=450;

MasX[1]:=450;

MasY[1]:=30;

exit;

end;

b:=Vershina div 2;

a:=b div 2;

c:=(Vershina-(b+1)) div 2 +(b+1);

//1

Step:=420 div a;

Yy:=450;

Xx:=30;

For i:=1 to a do

begin

MasX[i-1]:=Xx;

MasY[i-1]:=Yy;

Xx:=Xx+Step;

end;

//2

Step:=420 div (b-a);

Xx:=450;

Yy:=450;

For i:=a+1 to b do

begin

MasX[i-1]:=Xx;

MasY[i-1]:=Yy;

Yy:=Yy-Step;

end;

//3

Step:=420 div (c-b);

Yy:=30;

Xx:=450;

For i:=b+1 to c do

begin

MasX[i-1]:=Xx;

MasY[i-1]:=Yy;

Xx:=Xx-Step;

end;

//4

Step:=420 div (Vershina-c);

Xx:=30;

Yy:=30;

For i:=c+1 to Vershina do

begin

MasX[i-1]:=Xx;

MasY[i-1]:=Yy;

Yy:=Yy+Step;

end;

end;

//ПОСТРОЕНИЕ В РАНДОМНОМ СЛУЧАЕ -------

if _type=4 then begin

Randomize;

Canvas.Pen.Width:=2;

Canvas.Pen.Color:=MainGraf.ColorBox3.Selected;

Canvas.Brush.Color:=MainGraf.ColorBox1.Selected;; //!!!

if Vershina<=2 then Vershina:=3;

For i:=0 to Vershina-1 do begin

MasX[i]:=random(MainGraf.Image1.Width);

if MasX[i]<20 then MasX[i]:=20;

if MasX[i]>460 then MasX[i]:=460;

MasY[i]:=random(MainGraf.Image1.Height);

if MasY[i]<20 then MasY[i]:=20;

if MasY[i]>460 then MasY[i]:=460;

end;

end;

//-------------------------------------------------------------

for i:=1 to Vershina do begin

For j:=1 to Vershina do begin

if MainGraf.StringGrid1.cells[i,j]='1' then

begin Canvas.brush.Color:=MainGraf.ColorBox4.Selected; Canvas.pen.Color:=MainGraf.ColorBox4.Selected;

if (i<>UsingPoint+1) and (j<>UsingPoint+1) then

begin

DrawArrow(Canvas,MasX[i-1],MasY[i-1],MasX[j-1],MasY[j-1],2,1);

end;

end;

end;

end;

//выделение дуги

if (MainGraf.StringGrid1.cells[Rsel,CSel]='1') or (MainGraf.StringGrid1.cells[Csel,RSel]='1') then

begin Canvas.pen.Color:=MainGraf.ColorBox5.Selected;

DrawArrow(Canvas,MasX[Rsel-1],MasY[Rsel-1],MasX[CSel-1],MasY[CSel-1],2,2);

end;

//-выделение вершин

if (Mousedowning) and (MouseMoving) then begin

MainGraf.Memo1.Clear;

MainGraf.Memo1.Lines.Add('Выделенная вершина'); MainGraf.Memo1.Lines.Add(inttostr(UsingPoint+1));

MainGraf.Edit2.Text:=inttostr(UsingPoint+1);

MainGraf.Memo1.Lines.Add('Смежные вершины c данной: ');

end;

For j:=1 to Vershina do begin

if MainGraf.StringGrid1.cells[UsingPoint+1,j]='1' then

begin Canvas.brush.Color:=MainGraf.ColorBox4.Selected;; //!!! Canvas.Pen.Color:=MainGraf.ColorBox5.Selected; DrawArrow(Canvas,MasX[UsingPoint],MasY[UsingPoint],MasX[j-1],MasY[j-1],2,2);

if (Mousedowning) and (MouseMoving) then MainGraf.Memo1.Text:=MainGraf.Memo1.Text+' - '+inttostr(j);

end;

end;

//---------ПОСТРОЕНИЕ-ВЕРШИН-------------------

For i:=1 to Vershina do

begin

//Canvas.Font.Style:=[fsbold]; Canvas.Pen.Color:=MainGraf.ColorBox2.Selected; //!!!

Canvas.Pen.Width:=2; Canvas.Brush.Color:=MainGraf.ColorBox1.Selected; //!!!

if (i=UsingPoint+1) or (i=RSel) or (i=CSel) then

begin

Canvas.Ellipse(MasX[i-1]-15,MasY[i-1]-15,MasX[i-1]+15,masY[i-1]+15);

end;

if MainGraf.StringGrid1.Cells[UsingPoint+1,i]='1' then

begin

Canvas.Ellipse(MasX[i-1]-10,MasY[i-1]-10,MasX[i-1]+10,masY[i-1]+10);

end

else

begin

//-----СЕЛЕКТОР ТИПА ВЕРШИНЫ------------------ Canvas.Brush.Color:=MainGraf.ColorBox3.Selected;

if (_TypeOV=1) and(PS[i-1]=1) then Canvas.Brush.Color:=MainGraf.ColorBox7.Selected;

if (_TypeOV=2) then

begin

Canvas.Brush.Color:=ClrOfP[GroupKS[i-1]];

end;

Canvas.Ellipse(MasX[i-1]-10,MasY[i-1]-10,MasX[i-1]+10,masY[i-1]+10);

end;

Canvas.Pen.Width:=1;

Canvas.Font.Height:=6; Canvas.Font.Color:=MainGraf.ColorBox6.Selected; //!!!

if i<10 then Canvas.TextOut(MasX[i-1]-3,masY[i-1]-6,inttostr(i)) else

Canvas.TextOut(MasX[i-1]-6,masY[i-1]-6,inttostr(i));

end;

//----------------------------------------------------------

MainGraf.Label3.caption:='';

For i:=0 to Vershina-1 do begin

if masX[i]<100 then s1:='0'+inttostr(masX[i]) else s1:=inttostr(masX[i]);

if masY[i]<100 then s2:='0'+inttostr(masY[i]) else s2:=inttostr(masY[i]);

if ((i+1) mod CountDel)=0 then MainGraf.Label3.Caption:=MainGraf.Label3.caption+'('+s1+','+s2+')'+#13 else MainGraf.Label3.Caption:=MainGraf.Label3.caption+'('+s1+','+s2+')'+' ';

end;

CSel:=0;

RSel:=0;

end;

//---при изменени размера формы---------------

procedure TMainGraf.TabSheet2Resize(Sender: TObject);

var

a,b: integer;

begin

a:=MainGraf.ClientHeight;

b:=MainGraf.ClientWidth;

end;

//-------------------------------------------------------------

procedure TMainGraf.SpeedButton1Click(Sender: TObject);

var i,j,a: integer;

begin

//АВТОЗАПОЛНЕНИЕ МАТРИЦЫ СМЕЖНОСТИ (ТАБЛИЦЫ)

randomize;

if SpeedButton1.Caption='&Автозаполнение' then begin

For i:=1 to vershina do begin

For j:=1 to vershina do begin

if j>=i then begin

if i=j then StringGrid1.Cells[i,j]:='0'

else

begin

a:=random(2);

if (a=1) and (RadioGroup2.ItemIndex>=1) then a:=random(2);

if (a=1) and (RadioGroup2.ItemIndex>=2) then a:=random(2);

if (a=1) and (RadioGroup2.ItemIndex>=3) then a:=random(2);

if (a=1) and (RadioGroup2.ItemIndex>=4) then a:=random(2);

if (a=1) and (RadioGroup2.ItemIndex>=5) then a:=random(2);

if (a=1) and (RadioGroup2.ItemIndex>=6) then a:=random(2);

StringGrid1.Cells[i,j]:=IntToStr(a); StringGrid1.Cells[j,i]:=StringGrid1.Cells[i,j];

end;

end;

end;

end;

SpeedButton1.Caption:='О&чистить';

end

else

begin

ShowGraf:=false; //---!!!!___POSMOTRET'_______

For i:=1 to vershina do begin

MasX[i-1]:=0;

MasY[i-1]:=0;

GroupKs[i-1]:=0;

For j:=1 to vershina do begin

if i=j then StringGrid1.Cells[i,j]:='0'

else StringGrid1.Cells[i,j]:='';

end;

end;

SpeedButton1.Caption:='&Автозаполнение';

Label3.Caption:='';

{ For i:=0 to Image1.Height do

For j:=0 to Image1.Width do

Image1.Canvas.Pixels[i,j]:=clWhite; }

end;

end;

//-------------------------------------------------------------

procedure TMainGraf.SpeedButton2Click(Sender: TObject);

begin

For i:=1 to Vershina do

For j:=1 to Vershina do

if (StringGrid1.Cells[i,j]<>'1') and (StringGrid1.Cells[i,j]<>'0') then StringGrid1.Cells[i,j]:='0';

ShowGraf:=true;

Csel:=0;

RSel:=0;

_TypeOv:=0;

if RadioGroup1.ItemIndex=0 then if vershina<=60 then Visualization(MainGraf.Image1.Canvas,1) else

begin

For i:=0 to Maingraf.ClientHeight do

For j:=0 to MainGraf.ClientWidth do

MainGraf.Canvas.Pixels[i,j]:=clWhite; Image1.Canvas.TextOut(100,200,'Визуализация графа затруднена');

end;

if RadioGroup1.ItemIndex=1 then if vershina<=80 then Visualization(MainGraf.Image1.Canvas,3)else

begin

For i:=0 to Maingraf.ClientHeight do

For j:=0 to MainGraf.ClientWidth do

MainGraf.Canvas.Pixels[i,j]:=clWhite; Image1.Canvas.TextOut(100,200,'Визуализация графа затруднена');

end;

if RadioGroup1.ItemIndex=2 then if vershina<=255 then Visualization(MainGraf.Image1.Canvas,4)else

begin

For i:=0 to Maingraf.ClientHeight do

For j:=0 to MainGraf.ClientWidth do

MainGraf.Canvas.Pixels[i,j]:=clWhite; Image1.Canvas.TextOut(100,200,'Визуализация графа затруднена');

Image1.Canvas.TextOut(100,300,'Введите меньшее число вершин');

end;

end;

//-------------------------------------------------------------

procedure TMainGraf.Image1MouseDown(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

var Xpos, Ypos,i: integer;

begin

Timer1.Enabled:=false;

Timer1.Interval:=1000;

Xpos:=X;

Ypos:=Y;

mouseDowning:=true;

MouseMoving:=true;

UsingPoint:=255;

For i:=0 to VERSHINA-1 do begin

if (Xpos>=masX[i]-10) and (Xpos<=masX[i]+10) then begin

if (Ypos>=masY[i]-10) and (Ypos<=masY[i]+10) then begin

UsingPoint:=i;

end;

end;

end;

//-------------------------------------------------------------

Label5.Caption:=inttostr(UsingPoint+1);

if UsingPoint<=vershina-1 then begin

if CheckBox1.Checked then begin

masX[UsingPoint]:=X;

masY[UsingPoint]:=Y;

end;

Visualization(MainGraf.image1.Canvas,2);

MouseMoving:=false;

end;

end;

//-------------------------------------------------------------

procedure TMainGraf.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,

Y: Integer);

begin

if checkBox1.Checked then begin

if (MouseDowning) AND (MouseDowning) then begin //Label4.Caption:='('+inttostr(X)+','+inttostr(Y)+')';

if UsingPoint<=vershina-1 then begin

masX[UsingPoint]:=X;

masY[UsingPoint]:=Y;

Visualization(MainGraf.image1.Canvas,2);

end;

end;

end;

end;

//-------------------------------------------------------------

procedure TMainGraf.Image1MouseUp(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

begin

Timer1.Enabled:=true;

MouseMoving:=false;

MouseDowning:=false;

end;

//-------------------------------------------------------------

procedure TMainGraf.Button2Click(Sender: TObject);

begin

close;

end;

//-------------------------------------------------------------procedure TMainGraf.Button1Click(Sender: TObject);

var i,j: integer;

begin

PageControl1.TabIndex:=1;

MouseDowning:=false;

Label3.Caption:='';;

UsingPoint:=255;

//ЗАДАЕМ КОЛИЧЕСТВО ВЕРШИН И ИНИЦИАЛИЗИРУЕМ МАССИВЫ

//считываем количество вершин

try

Vershina:=StrToInt(Edit1.text);

if StrToInt(Edit1.text)>255 then

begin

Edit1.text:='255';

Vershina:=255;

end;

except

begin

Vershina:=2;

Edit1.text:='2';

end;

end;

PageControl1.Visible:=true;

//ВВОД НАЧАЛЬНЫХ ПАРАМЕТРОВ ГРАФА

if Vershina<2 then Vershina:=2;

if Vershina>255 then Vershina:=255;

StringGrid1.RowCount:=Vershina+1;

StringGrid2.RowCount:=Vershina+1;

StringGrid1.ColCount:=Vershina+1;

StringGrid2.ColCount:=Vershina+1;

//задаем длину массива точек

SetLength(MasX, Vershina);

SetLength(MasY, Vershina);

SetLength(GroupKS, Vershina);

SetLength(PS, Vershina);

For i:=1 to Vershina do

begin

PS[i-1]:=0;

StringGrid1.Cells[0,i]:=IntToStr(i);

StringGrid1.Cells[i,0]:=IntTostr(i);

end;

if i<21 then begin

StringGrid1.Height:=(i)*25+3;

StringGrid1.Width:=(i)*25+3;

end

else

begin

StringGrid1.Height:=481;

StringGrid1.Width:=441;

end;

//0-ЛИ НА ГЛАВНОЙ ДИАГОНАЛИ

For i:=1 to Vershina do

begin

StringGrid1.Cells[i,i]:='0';

end;

end;

//-------------------------------------------------------------

procedure TMainGraf.FormCreate(Sender: TObject);

var

i,j: integer;

a,b,c: byte;

F: textFile;

S: string;

begin

try

Label20.Caption:='';

AssignFile(f,'help.txt');

Reset(f);

while (Not EOF(F)) do

begin

Readln(f,s);

Label20.Caption:=Label20.Caption+s+#13;

end;

closeFile(F);

except

ShowMessage('Не найден файл справки');

end;

ShowGraf:=false;

CSEl:=0;

RSel:=0;

_TypeOV:=0;

randomize;

ClrOfP[0]:=ColorBox7.Selected;

for i:=1 to 256 do begin

a:=random(255);

b:=random(255);

c:=random(255);

ClrOfP[i]:=RGB(a,b,c);

for j:=1 to 25 do

begin Image3.Canvas.Pixels[i*2-1,j]:=ClrOfP[i];

Image3.Canvas.Pixels[(i)*2,j]:=ClrOfP[i];

end;

end;

CountDel:=18;

Memo1.ReadOnly:=true;

Edit2.Focused;

CenterX:=240;

CenterY:=240;

PageControl1.TabIndex:=0;

RadioGroup1.ItemIndex:=0;

RadioGroup2.ItemIndex:=0;

//ЗАКРАСКА ПОПИКСЕЛЬНО ИЗОБРАЖЕНИЯ БЕЛЫМ ФОНОМ

For i:=0 to Maingraf.ClientHeight do

For j:=0 to MainGraf.ClientWidth do

MainGraf.Canvas.Pixels[i,j]:=clWhite;

Edit1.Focused;

end;

//-------------------------------------------------------------

procedure TMainGraf.SpeedButton5Click(Sender: TObject);

var

TypeG: boolean;

begin

typeG:=true;

Reach();

For i:=1 to Vershina do

For j:=1 to vershina do

if R1[i,j]=0 then typeG:=false;

if typeG then

begin

Memo1.Clear; Memo1.Lines.Add('Данные о графе:');

Memo1.Lines.Add('Данный граф СВЯЗНЫЙ');

end

else begin

Memo1.Clear; Memo1.Lines.Add('Данные о графе:');

Memo1.Lines.Add('Данный граф НЕ СВЯЗНЫЙ');

end;

end;

//-------------------------------------------------------------

procedure TMainGraf.PageControl1Change(Sender: TObject);

begin

If PageControl1.TabIndex=1 then button1.Click;

end;

//-------------------------------------------------------------

procedure TMainGraf.SpeedButton7Click(Sender: TObject);

var z: integer;

begin

k:=false;

SetLength(mark, Vershina);

SetLength(Emark, Vershina);

try

z:=strtoint(Edit2.text);

except

z:=1;

end;

For j:=0 to Vershina-1 do begin mark[j]:=0; Emark[j]:=1; end;

mark[z-1]:=1;

Emark[z-1]:=0;

c:=1;

Memo1.Clear;

Memo1.Lines.Add('Обход в ширину, начиная с вершины: '+'('+inttostr(z)+')'+':');

Memo1.Text:=Memo1.Text+inttostr(z);

recursiya(z);

end;

//-------------------------------------------------------------

procedure TMainGraf.SpeedButton4Click(Sender: TObject);

var

i: integer;

begin

For i:=1 to Vershina do

For j:=1 to Vershina do

if (StringGrid1.Cells[i,j]<>'1') and (StringGrid1.Cells[i,j]<>'0') then StringGrid1.Cells[i,j]:='0';

if Not ShowGraf then SpeedButton2.Click;

Timer1.Interval:=1;

Timer1.Interval:=1000;

ExceptionV:=0;

FindKS(1);

_TypeOV:=2;

Visualization(MainGraf.Image1.Canvas, 2);

_TypeOV:=0;

For i:=0 to Vershina-1 do GroupKs[i]:=0;

end;

//-------------------------------------------------------------

procedure TMainGraf.SpeedButton3Click(Sender: TObject);

var

a,b: integer;

k: integer;

b1: boolean;

begin

Timer1.Interval:=1;

Timer1.Interval:=1000;

if Not ShowGraf then SpeedButton2.Click;

Memo1.Clear;

Memo1.Lines.Add('Точки сочленения:');

for i:=1 to vershina do

begin

PS[i-1]:=0;

for j:=1 to vershina do

StringGrid2.Cells[i,j]:=StringGrid1.Cells[i,j];

ExceptionV:=0;

end;

a:=FindKS(2);

For k:=1 to Vershina do

begin

ExceptionV:=k;

for i:=1 to Vershina do

for j:=1 to Vershina do

StringGrid2.Cells[i,j]:=StringGrid1.Cells[i,j];

for i:=1 to Vershina do

begin

StringGrid2.Cells[ExceptionV,i]:='0';

StringGrid2.Cells[i,ExceptionV]:='0';

end;

b:=FindKS(2);

if a<>b then

begin

Memo1.lines.Add('Вершина: '+inttostr(ExceptionV)+' - точка сочленения, число компонентов связности изменилось до '+inttostr(b));

PS[k-1]:=1;

end

else Memo1.lines.Add('Вершина: '+inttostr(ExceptionV)+ ' - не является точкой сочленения');

end;

Memo1.lines.Add('Таким образом, точки сочленения: ');

For i:=1 to Vershina do if PS[i-1]=1 then Memo1.Text:=Memo1.text+'('+inttostr(i)+')'+' ';

For i:=1 to Vershina do if PS[i-1]=1 then b1:=true;

if Not B1 then Memo1.Text:=Memo1.text+'отсутствуют.';

_TypeOV:=1;

Visualization(MainGraf.Image1.Canvas,2);

_TypeOV:=0;

For i:=0 to Vershina-1 do PS[i]:=0;

end;

//-------------------------------------------------------------

procedure TMainGraf.SpeedButton6Click(Sender: TObject);

var

TypeG: boolean;

a,k,b: integer;

PSP: array of integer; //масси тпа вершины (со связями или нет)

empty: boolean; //относится к массиву выше.

MAXGroups: byte; //число компонент связности, без точек сочленения

consist: boolean; //есть ли дуги из вершины

colKD: byte; //Число компонент двусвязнсти

begin

For i:=1 to Vershina do

For j:=1 to Vershina do

if (StringGrid1.Cells[i,j]<>'1') and (StringGrid1.Cells[i,j]<>'0') then StringGrid1.Cells[i,j]:='0';

if Not ShowGraf then SpeedButton2.Click;

Timer1.Interval:=1;

Timer1.Interval:=1000;

colKD:=0;

setLEngth(PSP, Vershina);

for i:=1 to vershina do

begin

PSP[i-1]:=0;

PS[i-1]:=0;

for j:=1 to vershina do

StringGrid2.Cells[i,j]:=StringGrid1.Cells[i,j];

ExceptionV:=0;

end;

a:=FindKS(2);

For k:=1 to Vershina do

begin

ExceptionV:=k;

for i:=1 to Vershina do

for j:=1 to Vershina do

StringGrid2.Cells[i,j]:=StringGrid1.Cells[i,j];

for i:=1 to Vershina do

begin

StringGrid2.Cells[ExceptionV,i]:='0';

StringGrid2.Cells[i,ExceptionV]:='0';

end;

b:=FindKS(2);

if a<>b then PS[k-1]:=1;

end;

typeG:=true;

For i:=1 to Vershina do if PS[i-1]=1 then typeG:=false;

//-------------------------------------------------------------

Memo1.Clear;

Memo1.Lines.Add('Компоненты двусвязности:');

//----------//нет точек сочленения-----------------

if typeG then

begin

typeG:=true;

Reach();

For i:=1 to Vershina do

For j:=1 to vershina do

if R1[i,j]=0 then typeG:=false;

if typeG then

begin

Memo1.Lines.Add('В данном графе всего одна компонента двусвязности,');

Memo1.Lines.Add('равная самому графу:');

For i:=1 to Vershina do

begin

if i=1 then

Memo1.Text:=Memo1.Text+'( { '+IntToStr(i)+' '

else

if i=Vershina then

Memo1.Text:=Memo1.Text+IntToStr(i)+' } )'

else

Memo1.Text:=Memo1.Text+IntToStr(i)+' '

end;

end;

GroupKS[Vershina-1]:=1;

_TypeOV:=2;

Visualization(MainGraf.Image1.Canvas,2);

end

//------------есть точки сочленения----------------

else

begin

For i:=1 to Vershina do

begin

empty:=true;

PSP[i-1]:=0;

if PS[i-1]=1 then

begin

PSP[i-1]:=1;

for j:=1 to Vershina do

if StringGrid1.Cells[i,j]='1' then empty:=false;

if Not empty then PSP[i-1]:=1 else PSP[i-1]:=-1;

end;

end;

FindKS(3); //точки сочленения помечены 0-ми

{остальные вершины разбиты на группы компонентов связности, исключая сами точки

в массиве PSP выедены типы точек сочленения 1 если т.с. и -1 иначе и 0 если просто вершина}

if Vershina<=9 then begin

for i:=1 to Vershina do

begin

Memo1.Text:=Memo1.Text+' '+inttostr(i)+' ';

if i=Vershina then Memo1.Text:=Memo1.Text+'| - № вершины';

end;

Memo1.Lines.Add('');

//

for i:=1 to Vershina do

begin

if PS[i-1]=1 then Memo1.Text:=Memo1.Text+' 1 ' else Memo1.Text:=Memo1.Text+' 0 ';

if i=Vershina then Memo1.Text:=Memo1.Text+'| - 1 если вершина точка сочленения';

end;

Memo1.Lines.Add('');

for i:=1 to Vershina do

begin

if PSP[i-1]=1 then Memo1.Text:=Memo1.Text+' 1 '

else

if PSP[i-1]=-1 then Memo1.Text:=Memo1.Text+' 2 '

else

Memo1.Text:=Memo1.Text+' 0 ';

if i=Vershina then Memo1.Text:=Memo1.Text+'| - 2 если данная вершина не связана с другими';

end;

Memo1.Lines.Add('');

for i:=1 to Vershina do

begin

Memo1.Text:=Memo1.Text+' '+inttostr(GroupKS[i-1])+' ';

if i=Vershina then Memo1.Text:=Memo1.Text+'| - группы связных вершин, 0 - точки сочленения';

end;

Memo1.Lines.Add('На основе этих данных легко разбить граф на двусвязные компоненты.');

end;

_TypeOV:=2;

Visualization(MainGraf.Image1.Canvas,2);

_TypeOV:=0;

//определить точки сочления: найднеы выше (+)

// и выделить компоненты связности исключая вершины (+)

//используя правила нахождения по обходу в глубину...(+)

//выписать двусвязные компоненты (+).

//PS

//PSP/

//GroupKS

//-------------------------------------------------------------MaxGroups:=0;

For i:=1 to Vershina do if (GroupKs[i-1]>=MaxGroups) then MaxGroups:=GroupKs[i-1];

//Memo1.Lines.add('');

Memo1.text:=Memo1.text+'( ';

For i:=1 to MaxGroups do

begin

Memo1.text:=Memo1.text+'{';

Inc(colKD);

// добавленние явно входящих в группу вершин

For j:=1 to Vershina do

if GroupKs[j-1]=i then Memo1.text:=Memo1.text+' '+inttostr(j);

//добавление точек сочленения

For j:=1 to Vershina do

begin

if (GroupKs[j-1]=0) and (PSP[j-1]=1) then

begin

consist:=false;

For k:=1 to Vershina do

begin

if (GroupKS[k-1]=i) and (StringGrid1.cells[k,j]='1') then

begin

consist:=true;

//break;

end;

if consist then begin Memo1.text:=Memo1.text+' '+inttostr(j); break; end;

end;

end;

if j=Vershina then Memo1.text:=Memo1.text+' } ';

end;

end;

//добавление связных точек сочленения как компонент двусвязности

For k:=1 to Vershina do

begin

if PSP[k-1]=1 then

begin

for j:=1 to Vershina do if (k>j) and (PSP[j-1]=1) then

begin

if StringGrid1.Cells[k,j]='1' then

begin

Memo1.text:=Memo1.Text+'{'+inttostr(j)+' '+inttostr(k)+'} ';

Inc(colKD);

end;

end;

end;

end;

Memo1.text:=Memo1.text+')';

Memo1.Lines.Add('Число компонент двусвязности: '+inttostr(colKD));

//-------------------------------------------------------------

end;

//очистка массивов для чистого построения

For i:=0 to Vershina-1 do begin PS[i]:=0; PSP[i]:=0; end;

end;

//-------------------------------------------------------------

procedure TMainGraf.SpeedButton8Click(Sender: TObject);

var

s: integer;

begin

Memo1.Clear;

KountKS:=1;

for i:=1 to Vershina do Mark1[i]:=false;

try

s:=strtoint(Edit2.text);

except

s:=1;

end;

Memo1.Lines.Add('Обход в глубину, начиная с вершины: ('+inttostr(s)+')');

Depth(s,2);

end;

//-------------------------------------------------------------

procedure TMainGraf.FormResize(Sender: TObject);

var x,y: integer;

begin

//

CountDel:=(MainGraf.ClientWidth div 52)+1;

GroupBox2.Width:=MainGraf.ClientWidth-2; PageControl1.ClientHeight:=MainGraf.ClientHeight; PageControl1.ClientWidth:=MainGraf.ClientWidth;

//

x:= MainGraf.ClientHeight div 2;

y:=MainGraf.ClientWidth div 2;

GroupBox1.Left:=y-150;

GroupBox1.top:=x-70;

//

Memo1.Left:=448;

Memo1.Width:=MainGraf.ClientWidth -460;

//

x:= (MainGraf.ClientHeight+158) div 2;

y:=(MainGraf.ClientWidth+448) div 2;

if (y-240)>=448 then Image1.Left:=y-240 else Image1.Left:=448;

if (x-240)>=94 then Image1.Top:=x-240 else Image1.Top:=94;

//

Panel3.Height:=151;

Panel3.Width:=MainGraf.ClientWidth-1;

StringGrid1.Top:=158;

//

end;

//-------------------------------------------------------------

procedure TMainGraf.BitBtn1Click(Sender: TObject);

var

a,b,c: byte;

begin

if Not CheckBox2.checked then

begin

randomize;

ClrOfP[0]:=ColorBox7.Selected;

for i:=1 to 256 do begin

a:=random(255);

b:=random(255);

c:=random(255);

ClrOfP[i]:=RGB(a,b,c);

for j:=1 to 25 do

begin Image3.Canvas.Pixels[i*2-1,j]:=ClrOfP[i];

Image3.Canvas.Pixels[i*2,j]:=ClrOfP[i];

end;

end;

end;

if CheckBox2.checked then

begin

a:=0; b:=160; c:=0;

for i:=1 to 256 do begin

{if i<85 then begin dec(a); b:=0; c:=0; end;

if (i>=85) and (i<170) then begin dec(b); a:=0; c:=0; end;

if i>=170 then begin dec(c); b:=0; a:=0; end; }

ClrOfP[i]:=RGB(a,b,c);

inc(a);

inc(c);

for j:=1 to 25 do

begin Image3.Canvas.Pixels[i*2-1,j]:=ClrOfP[i];

Image3.Canvas.Pixels[i*2,j]:=ClrOfP[i];

end;

end;

end;

end;

procedure TMainGraf.Timer1Timer(Sender: TObject);

begin

mouseDowning:=false;

UsingPoint:=255;

Visualization(MainGraf.image1.Canvas,2);

Timer1.Enabled:=false;

end;

procedure TMainGraf.StringGrid1SelectCell(Sender: TObject; ACol,

ARow: Integer; var CanSelect: Boolean);

begin

CSel:=ACol;

RSel:=ARow;

if CSel<>RSel then Edit2.Text:=' '+inttostr(ARow)+' - '+inttostr(ACol)

else

begin

Timer1.Interval:=0;

Timer1.Interval:=1000;

CSel:=0;

RSel:=0;

end;

if ShowGraf then Visualization(MainGraf.image1.Canvas,2);

end;

procedure TMainGraf.StringGrid1MouseUp(Sender: TObject;

Button: TMouseButton; Shift: TShiftState; X, Y: Integer);

begin

if ShowGraf then

begin

Timer1.Interval:=0;

Timer1.Interval:=1000;

Timer1.Enabled:=true;

end;

end;

procedure TMainGraf.StringGrid1SetEditText(Sender: TObject; ACol,

ARow: Integer; const Value: String);

begin

if Acol=Arow then StringGrid1.Cells[Arow, Acol]:='0';

if Acol<>Arow then

begin

StringGrid1.Cells[Arow, Acol]:=StringGrid1.Cells[ACol, ARow];

end;

end;

procedure TMainGraf.SpeedButton1MouseMove(Sender: TObject;

Shift: TShiftState; X, Y: Integer);

begin

SpeedButton1.Hint:='Заполнить таблицу рандомно, причем частота выпадения "0" задается в Настройка: '+#13+'в пункте Вероятность выпадения 0 при генерации.';

SpeedButton1.ShowHint:=true;

end;

procedure TMainGraf.SpeedButton2MouseMove(Sender: TObject;

Shift: TShiftState; X, Y: Integer);

begin

SpeedButton2.Hint:='Графически отобразить граф. Настройки внешнего вида графа, хранятся в Настройках - '+#13+'где можно задать цвет, вид и посмотреть координаты вершин если граф уже построен.';

SpeedButton2.ShowHint:=true;

end;

procedure TMainGraf.SpeedButton5MouseMove(Sender: TObject;

Shift: TShiftState; X, Y: Integer);

begin

SpeedButton5.Hint:='У связанного графа всего одна компонента связности и равна самому графу';

SpeedButton5.ShowHint:=true;

end;

//-------------------------------------------------------------

procedure TMainGraf.SpeedButton3MouseMove(Sender: TObject;

Shift: TShiftState; X, Y: Integer);

begin

SpeedButton3.Hint:='Нйти точки сочленения графа и обозначить их если он построен. Точки сочления - вершины'+#13+' графа при удалении которых число компонент связности увеличится или уменьшится.';

SpeedButton3.ShowHint:=true;

end;

procedure TMainGraf.SpeedButton4MouseMove(Sender: TObject;

Shift: TShiftState; X, Y: Integer);

begin

SpeedButton4.Hint:='Найти и отобразить компоненты связности графа, т.е. подграфы данного графа, вв виде'+#13+' связанных между собой групп вершин, не связанных с отсавшимися вершинами данного графа.';

SpeedButton4.ShowHint:=true;

end;

Procedure TMainGraf.SpeedButton6MouseMove(Sender: TObject;

Shift: TShiftState; X, Y: Integer);

begin

SpeedButton6.Hint:='Найти компоненты двусвязности. Т.е. найти группы связных вершин в которых нет точек'+#13+' сочленения.';

SpeedButton6.ShowHint:=true;

end;

procedure TMainGraf.SpeedButton7MouseMove(Sender: TObject;

Shift: TShiftState; X, Y: Integer);

begin

SpeedButton7.Hint:='Стандартный обход графа начиная с вершины указанной нижев ширину. Чтобы выделить '+#13+'верину с которой начать обход на построенном графе просто нажмите по нужной вершине.';

SpeedButton7.ShowHint:=true;

end;

procedure TMainGraf.SpeedButton8MouseMove(Sender: TObject;

Shift: TShiftState; X, Y: Integer);

begin

SpeedButton8.Hint:='Стандартный обход графа, начиная с вершины указанной ниже, в глубину. Чтобы выделить'+#13+' верину с которой начать обход на построенном графе просто нажмите по нужной вершине.';

SpeedButton8.ShowHint:=true;

end;

procedure TMainGraf.BitBtn1MouseMove(Sender: TObject; Shift: TShiftState;

X, Y: Integer);

begin

BitBtn1.Hint:='Задать массив цветов для выделения вершинв компоненты связности и двусвязности..';

BitBtn1.ShowHint:=true;

end;

procedure TMainGraf.CheckBox1MouseMove(Sender: TObject; Shift: TShiftState;

X, Y: Integer);

begin

CheckBox1.Hint:='Функция позволяет перемещать вершины в любую позицию на выделленном для рисования графе участке экрана';

CheckBox1.ShowHint:=true;

end;

procedure TMainGraf.StringGrid1KeyPress(Sender: TObject; var Key: Char);

begin

if (Key<>char('1')) and (key<>char('0')) then key:=char('0');

end;

procedure TMainGraf.ColorBox2Change(Sender: TObject);

begin

Label8.Color:=ColorBox2.Selected;

end;

procedure TMainGraf.ColorBox3Change(Sender: TObject);

begin

Label9.Color:=ColorBox3.Selected;

end;

procedure TMainGraf.ColorBox1Change(Sender: TObject);

begin

Label7.Color:=ColorBox1.Selected;

end;

procedure TMainGraf.ColorBox7Change(Sender: TObject);

begin

Label1.Color:=ColorBox7.Selected;

end;

procedure TMainGraf.ColorBox4Change(Sender: TObject);

begin

Label10.Color:=ColorBox4.Selected;

end;

procedure TMainGraf.ColorBox5Change(Sender: TObject);

begin

Label12.Color:=ColorBox5.Selected;

end;

procedure TMainGraf.ColorBox6Change(Sender: TObject);

begin

Label11.Color:=ColorBox6.Selected;

end;

procedure TMainGraf.Edit2KeyPress(Sender: TObject; var Key: Char);

begin

Key:=#0;

end;

procedure TMainGraf.Memo1KeyPress(Sender: TObject; var Key: Char);

begin

key:=#0;

end;

end.