public string LinksAndForms(PageGraph graph) { var sb = new StringBuilder(); sb.AppendLine("digraph G {"); foreach (var n in graph.Nodes.OrderBy(x => x.ParameterizedUrl).ToArray()) { sb.AppendLine(StrNode(n)); } foreach (var e in graph.Edges) { sb.AppendLine(StrEdge(e)); } sb.AppendLine("}"); return(CmdDot(sb.ToString())); }
public string LinksAndForms(PageGraph graph) { var sb = new StringBuilder(); sb.AppendLine("digraph G {"); sb.AppendLine(" rankdir=\"LR\""); sb.AppendLine(" node [shape=\"box\"]"); sb.AppendLine(" node [margin=\"0.50,0.055\"]"); foreach (var n in graph.Nodes.OrderBy(x => x.ParameterizedUrl).ToArray()) { sb.AppendLine(StrNode(n)); } foreach (var e in graph.Edges) { sb.AppendLine(StrEdge(e)); } sb.AppendLine("}"); return(CmdDot(sb.ToString())); }
public string LinksAndFormsWithClusters(PageGraph graph) { var sb = new StringBuilder(); sb.AppendLine("digraph G {"); var clusters = graph.Nodes .Where(x => x.ParameterizedUrl != "/api") .GroupBy(x => x.ParameterizedUrl.Split("/", StringSplitOptions.RemoveEmptyEntries)[1]) .ToArray(); sb.AppendLine(StrNode(graph.Nodes.First(n => n.ParameterizedUrl == "/api"))); foreach (var g in clusters) { sb.AppendLine($"subgraph cluster_{g.Key}" + "{"); sb.AppendLine("style=filled;"); sb.AppendLine("color=lightgrey;"); sb.AppendLine($"label=\"{g.Key}\";"); foreach (var n in g) { sb.AppendLine(StrNode(n)); } sb.AppendLine("}"); } foreach (var e in graph.Edges) { sb.AppendLine(StrEdge(e)); } sb.AppendLine("}"); return(CmdDot(sb.ToString())); }