Пример #1
0
        private void WriteSubGraph(ISubGraph subGraph, HashSet <INode> scope)
        {
            if (SubGraphAdorner is null)
            {
                WriteHeader("subgraph", null);
                Writer.Indent++;
            }
            else
            {
                WriteHeader("subgraph", SubGraphAdorner.GetSubGraphName(subGraph));
                Writer.Indent++;

                var attributes = SubGraphAdorner.GetSubGraphAttributes(subGraph);
                if (attributes?.Count > 0)
                {
                    string delimeter = IncludeSemicolons
                        ? ";"
                        : string.Empty;

                    WriteAttributes(attributes, delimeter, true);
                    Writer.WriteLine(delimeter);
                    Writer.WriteLine();
                }
            }

            foreach (var nested in subGraph.GetSubGraphs())
            {
                WriteSubGraph(nested, scope);
            }

            foreach (var node in subGraph.GetNodes())
            {
                if (scope.Remove(node))
                {
                    WriteNode(node);
                }
            }

            Writer.Indent--;
            WriteFooter();

            Writer.WriteLine();
        }