/// <summary> /// Pops a graph handle from stack, no checks performed. /// </summary> private void EndGraphInternal() { GraphHandle h = _subGraphs.Pop(); h.MarkAsUsed(); Line("}"); }
public IGraphHandle StartGraph(GraphMode graphMode, bool strict) { _graphMode = graphMode; if (_subGraphs.Count != 0) { throw new InvalidOperationException(); } string line = ""; if (strict) { line += "strict "; } line += graphMode == GraphMode.Graph ? "graph" : "digraph"; line += " \"\" {"; Line(line); GraphHandle g = new GraphHandle(this); _subGraphs.Push(g); return(g); }
/// <summary> /// Ends graph or subgraph when called by handle disposal. /// </summary> internal void EndGraphFromHandle(GraphHandle handle) { if (!ReferenceEquals(_subGraphs.Peek(), handle)) { throw new InvalidOperationException(); } EndGraphInternal(); }
public IGraphHandle StartSubGraph() { if (_subGraphs.Count == 0) { throw new InvalidOperationException(); } Line("subgraph {"); GraphHandle g = new GraphHandle(this); _subGraphs.Push(g); return(g); }