using System.Collections.Generic;
static main mn = new main();
public static void Main(string[] args)
private List<List<double>> fingerprintList = new List<List<double>>();
private int[] temp = new int[4] { 0, 0, 0, 0 };
private int[,] merge = new int[100, 100];
private List<List<int>> clusterList = new List<List<int>>();
Console.WriteLine("\nMergin Klusters, Press any key to start application: ");
Console.WriteLine("\nPress Any key to Close Application");
private void collectFingerpint()
Console.WriteLine("\nEntered fingerprints with values: ");
fingerprintList.Add(new List<double> { 1.4, 2, 8.1, 11.2 });
fingerprintList.Add(new List<double> { 0.6, 1.5, 7.4, 10.5 });
fingerprintList.Add(new List<double> { 1.8, 3.5, 4, 15 });
fingerprintList.Add(new List<double> { 1.6, 3, 5, 13 });
fingerprintList.Add(new List<double> { 1.2, 2.8, 7.5, 10.5 });
fingerprintList.Add(new List<double> { 1.3, 2.5, 7.3, 10.7 });
fingerprintList.Add(new List<double> { 1.4, 2, 8.1, 11.2 });
for (int t = 0; t < fingerprintList.Count; t++)
for (int j = 0; j < 4; j++)
Console.Write(fingerprintList[t][j].ToString());
private void countCluster()
if (fingerprintList.Count > 1)
for (int x = 0; x < fingerprintList.Count; x++)
for (int z = x + 1; z < fingerprintList.Count; z++)
for (int v = 0; v < 4; v++)
if (Math.Abs(fingerprintList[x][v] - fingerprintList[z][v]) <= 1)
private void countMerge()
if (fingerprintList.Count > 1)
for (int x = 0; x <= fingerprintList.Count; x++)
for (int z = x + 1; z < fingerprintList.Count; z++)
Console.Write(" ." + x + " check against " + z + " . #1 \t");
if (merge[x, z] == 1 || merge[z, x] == 1)
if (!clusterList.SelectMany(innerList => innerList).Any(s => s == x))
clusterList.Add(new List<int> { x, z });
Console.Write(" " + z + " " + x + " add to cluster \n");
for (int y = 0; y < clusterList[x].Count; y++)
if (merge[clusterList[x][y], z] == 1 || merge[z, clusterList[x][y]] == 1)
if(j >= clusterList[x].Count/2)
Console.Write(" " + z + " add to cluster with " + x + " \n");
Console.Write(" " + x + " do not have an + connection with " + z + " \n");
for (int x = 0; x <= fingerprintList.Count; x++)
for (int z = x + 1; z < fingerprintList.Count; z++)
Console.Write(" ." + x + " check against " + z + " . #2 \t");
if (!clusterList.SelectMany(innerList => innerList).Any(s => s == z))
clusterList.Add(new List<int> { z });
Console.Write(" " + z + " add to cluster \n");
Console.Write(" already exists \n");
private void outPrintClusters()
Console.WriteLine("Klusters: ");
foreach (var key in clusterList)
foreach (var keys in key)
Console.Write(keys + " ");