private Tuple <IEnumerable <string>, string> GetDecompositionWithGraph(AdjacencyListGraph <string> graph, string k, List <Vertex> parcoured, List <string> result, StringBuilder vs) { if (parcoured == null) { parcoured = new List <Vertex>(); } if (result == null) { result = new List <string>(); } Vertex v = graph.GetVertex(k); if (v != null && !parcoured.Contains(v)) { parcoured.Add(v); foreach (Vertex link in v.LinkedVertices) { result.Add(link.Value); vs.Append(String.Format("{0} -> {1};\r\n", v.Value, link.Value)); GetDecompositionWithGraph(graph, link.Value, parcoured, result, vs); } } return(new Tuple <IEnumerable <string>, string>(result, vs.ToString())); }
private IEnumerable <string> GetDecomposition(AdjacencyListGraph <string> graph, string k, List <Vertex> parcoured, List <string> result) { if (parcoured == null) { parcoured = new List <Vertex>(); } if (result == null) { result = new List <string>(); } Vertex v = graph.GetVertex(k); if (v != null && !parcoured.Contains(v)) { parcoured.Add(v); foreach (Vertex link in v.LinkedVertices) { result.Add(link.Value); GetDecomposition(graph, link.Value, parcoured, result); } } return(result); }
private Tuple<IEnumerable<string>, string> GetDecompositionWithGraph(AdjacencyListGraph<string> graph, string k, List<Vertex> parcoured, List<string> result, StringBuilder vs) { if (parcoured == null) { parcoured = new List<Vertex>(); } if (result == null) { result = new List<string>(); } Vertex v = graph.GetVertex(k); if (v != null && !parcoured.Contains(v)) { parcoured.Add(v); foreach (Vertex link in v.LinkedVertices) { result.Add(link.Value); vs.Append(String.Format("{0} -> {1};\r\n", v.Value, link.Value)); GetDecompositionWithGraph(graph, link.Value, parcoured, result, vs); } } return new Tuple<IEnumerable<string>, string>(result, vs.ToString()); }
private IEnumerable<string> GetDecomposition(AdjacencyListGraph<string> graph, string k, List<Vertex> parcoured, List<string> result) { if (parcoured == null) { parcoured = new List<Vertex>(); } if (result == null) { result = new List<string>(); } Vertex v = graph.GetVertex(k); if (v != null && !parcoured.Contains(v)) { parcoured.Add(v); foreach (Vertex link in v.LinkedVertices) { result.Add(link.Value); GetDecomposition(graph, link.Value, parcoured, result); } } return result; }