Exemplo n.º 1
0
        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()));
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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());
        }
Exemplo n.º 4
0
        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;
        }