Program.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace Method_dekstra
  7. {
  8. internal class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. //int[,] graphMatrix =
  13. //{
  14. // { 0, 7, 9, 0, 0, 14 },
  15. // { 7, 0, 10, 15, 0, 0 },
  16. // { 9, 10, 0, 11, 0, 2 },
  17. // { 0, 15, 11, 0, 6, 0 },
  18. // { 0, 0, 0, 6, 0, 9 },
  19. // { 14, 0, 2, 0, 9, 0}
  20. //};
  21. //int startNode = 1;
  22. //int countNode = 6;
  23. //int[,] Matrix =
  24. //{
  25. //{ 0, 0, 0, 0, 0, 14, 0, 0, 0, 0 },
  26. //{ 0, 0, 19, 0, 1, 0, 1, 0, 0, 0 },
  27. //{ 0, 19, 0, 7, 0, 4, 0, 9, 0, 0 },
  28. //{ 0, 0, 7, 0, 0, 17, 0, 13, 13, 2 },
  29. //{ 0, 1, 0, 0, 0, 0, 12, 0, 0, 0 },
  30. //{ 14, 0, 4, 17, 0, 0, 14, 0, 0, 0},
  31. //{ 0, 1, 0, 0, 12, 14, 0, 7, 8, 8 },
  32. //{ 0, 0, 9, 13, 0, 0, 7, 0, 17, 20 },
  33. //{ 0, 0, 0, 13, 0, 0, 8, 17, 0, 0 },
  34. //{ 0, 0, 0, 2, 0, 0, 8, 20, 0, 0 }
  35. //};
  36. //int start = 1;
  37. //int count = 10;
  38. int[,] Matrix =
  39. {
  40. { 0, 23, 12, 0, 0, 0, 0, 0},
  41. { 23, 0, 25, 0, 22, 0, 0, 35},
  42. { 12, 25, 0, 18, 0, 0, 0, 0},
  43. { 0, 0, 18, 0, 0, 28, 0, 0},
  44. { 0, 22, 0, 0, 0, 23, 14, 0},
  45. { 0, 0, 0, 20, 23, 0, 24, 0},
  46. { 0, 0, 0, 0, 14, 24, 0, 16},
  47. { 0, 35, 0, 0, 0, 0, 16, 0}
  48. };
  49. int start= 1;
  50. int count = 8;
  51. Deikstra obj = new Deikstra(Matrix, start, count);
  52. obj.Deikstra_min();
  53. Console.WriteLine(obj.Exemple());
  54. Console.ReadKey();
  55. }
  56. }
  57. }