Answer the question
In order to leave comments, you need to log in
Adjacency matrix?
Help with building an adjacency matrix, I can't figure out how to write all this into a memo.
There are 2 loops for iterating over vertices and edges, and 2 test conditions.
for a := Low(vershini) to High(vershini) do begin // вершины
for b := Low(rebri) to High(rebri) do begin // ребра
if (((vershini[a].X-rebri[b].X)*(vershini[a].X-rebri[b].X)) + ((vershini[a].Y-rebri[b].Y)*(vershini[a].Y-rebri[b].Y))) < 100 then begin
Memo3.Lines.Add((rebri[b].name) + ' пересекает ' + (vershini[a].name));
end;
if (((vershini[a].X-rebri[b].XX)*(vershini[a].X-rebri[b].XX)) + ((vershini[a].Y-rebri[b].YY)*(vershini[a].Y-rebri[b].YY))) < 100 then begin
Memo3.Lines.Add((rebri[b].name) + ' пересекает ' + (vershini[a].name));
end;
end; // for a
end; // for b
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question