1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using DesterMethod.Models;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace DesterMethod.WorkWithUser
- {
- internal class MainWork
- {
- public static void MainCicle()
- {
- for (int i = 0; i < GravEdge.listEdge.Count; i++)
- {
- List<int> egdeGraf = GravEdge.listEdge[i];
- int startVerh = egdeGraf[0];
- int endVerh = egdeGraf[1];
- switch (startVerh == 1)
- {
- case true:
- var listVerh = GrafVerh.verhValues[endVerh-1];
- listVerh[1] = egdeGraf[2];
- break;
- case false:
- var listVerhStart = GrafVerh.verhValues[startVerh - 1];
- var listVerhEnd = GrafVerh.verhValues[endVerh - 1];
- int newRootNorm = listVerhStart[1] + egdeGraf[2];
- int newRootRevers = listVerhEnd[1] + egdeGraf[2];
- int minvalue = Math.Min(newRootRevers, newRootNorm);
- if (minvalue < listVerhEnd[1]) listVerhEnd[1] = minvalue;
- if (minvalue < listVerhStart[1]) listVerhStart[1] = minvalue;
- break;
- };
- }
- foreach (var item in GrafVerh.verhValues)
- {
- Console.Write($"{item[0]} - {item[1]}");
- Console.WriteLine();
- }
- }
- }
- }
|