private static void getPossibleWays() { for (int i = 0; i < graph.Count; i++) { PossibleConnection pc = new PossibleConnection(graph[i].getValue()); pc.addCoveredNodes(graph[i]); getWay(pc, graph[i]); possibleBest.Add(pc); } }
private static void getWay(PossibleConnection pc, Node node) { foreach (var neighbour in node.getNeighbours()) { if (!pc.getCoveredNodes().Exists(x => x.getId() == neighbour.Key.getId())) { pc.addCoveredNodes(neighbour.Key); StringBuilder sb = new StringBuilder(); if (neighbour.Value == 0) { /* if (!errorsList.Contains(neighbour.Key)) * { * errorsList.Add(neighbour.Key); * } */ pc.addErrorNode(neighbour.Key); /*string currentSuperstring = pc.getSuperString(); * string superstring = sb.Append(currentSuperstring).Append(" ").Append(neighbour.Key.getValue()) * .ToString(); * * pc.setSuperString(superstring);*/ } else { string currentSuperstring = pc.getSuperString(); string toadd = neighbour.Key.getValue() .Substring(neighbour.Key.getValue().Length - (neighbour.Key.getValue().Length - neighbour.Value)); string superstring = sb.Append(currentSuperstring).Append(toadd).ToString(); pc.setSuperString(superstring); } pc.addSumCoverage(neighbour.Value); getWay(pc, neighbour.Key); } } return; }