public static GrafEntity getFirstTestGraf() { var gr1 = new GrafEntity(1,null); var gr2 = new GrafEntity(2, null); var gr3 = new GrafEntity(3, null); var gr4 = new GrafEntity(4, null); var gr5 = new GrafEntity(5, null); var gr6 = new GrafEntity(6, null); gr1.children.Add(gr2); gr2.children.AddRange(new []{gr3,gr5}); gr3.children.AddRange(new [] {gr1,gr4}); gr4.children.Add(gr5); gr6.children.Add(gr2); gr5.children.Add(gr6); return gr1; }
private static void SearchWays(GrafEntity item, List<GrafEntity> way) { foreach (var pointItem in item.children) { if (way.Contains(pointItem)) { var tList = way.ToList(); tList.Add(pointItem); WaysList.Add(tList); } else { var tList = way.ToList(); tList.Add(pointItem); SearchWays(pointItem, tList); } } }