Пример #1
0
        public override string CreateTreeRecursively(ref int nodeIndex, int prevIndex)
        {
            var graph = $"{Environment.NewLine}\tnode{nodeIndex} [ label = \"*\" ]";

            if (prevIndex != 0)
            {
                graph += $"{Environment.NewLine}\tnode{prevIndex} -- node{nodeIndex}";
            }

            prevIndex = nodeIndex;
            nodeIndex++;
            graph += LeftOperand.CreateTreeRecursively(ref nodeIndex, prevIndex);
            graph += RightOperand.CreateTreeRecursively(ref nodeIndex, prevIndex);

            return(graph);
        }