-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShowAdjacency.cs
36 lines (32 loc) · 1.08 KB
/
ShowAdjacency.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.Data;
using System.Windows.Forms;
namespace VisualGraph
{
/// <summary>
/// Displays the adjacency matrix
/// </summary>
public partial class ShowAdjacency : Form
{
public ShowAdjacency(Dijekstra dijekstra, char language)
{
InitializeComponent();
DataTable tabele = new DataTable();
dataGridView1.DataSource = tabele;
if (language == 'D') laAdj.Text = "Adjazenzmatrix";
else laAdj.Text = "Adjacency matrix";
for (int i = 0; i < dijekstra.vertexList.Count; i++)
{
tabele.Columns.Add(dijekstra.vertexList[i].name);
}
for (int i = 0; i < dijekstra.vertexList.Count; i++)
{
DataRow row = tabele.NewRow();
for (int j = 0; j < dijekstra.vertexList.Count; j++)
{
row[dijekstra.vertexList[j].name] = dijekstra.adjacencyMatrix[i, j];
}
tabele.Rows.Add(row);
}
}
}
}