public bool Pick(Node node) { if (!myCache.ContainsKey(node.Id)) { myCache[node.Id] = myPicking.Pick(node); } return(myCache[node.Id]); }
public int Execute() { using (myWriter = new StreamWriter(myOwner.myPath)) { myWriter.WriteLine("digraph {"); ApplySettings(); var relevantNodes = myGraph.Nodes .Where(n => myPicking.Pick(n)) .OrderByIf(n => n.Id, myOwner.PrettyPrint) .ToList(); if (myOwner.FastRenderingNodeCountLimit.HasValue && relevantNodes.Count > myOwner.FastRenderingNodeCountLimit.Value) { // http://www.graphviz.org/content/attrs#dnslimit myWriter.WriteLine(" nslimit=0.2"); myWriter.WriteLine(" nslimit1=0.2"); myWriter.WriteLine(" splines=line"); myWriter.WriteLine(" mclimit=0.5"); } foreach (var cluster in myGraph.Clusters) { var relevantClusterNodes = cluster.Nodes .Where(relevantNodes.Contains) .OrderByIf(n => n.Id, myOwner.PrettyPrint) .ToList(); if (relevantClusterNodes.Count == 0) { continue; } var clusterId = cluster.Id.StartsWith("cluster_") ? cluster.Id : "cluster_" + cluster.Id; myWriter.WriteLine(" subgraph \"" + clusterId + "\" {"); myWriter.WriteLine(" label = \"{0}\"", myCaptions.Get(cluster.Id).DisplayText); foreach (var node in relevantClusterNodes) { Write(node, " "); } myWriter.WriteLine(" }"); } foreach (var node in relevantNodes) { Write(node, " "); } var relevantEdges = myGraph.Edges .Where(e => myPicking.Pick(e)) .OrderByIf(e => e.Id, myOwner.PrettyPrint); foreach (var edge in relevantEdges) { Write(edge, " "); } myWriter.WriteLine("}"); return(relevantNodes.Count); } }
public bool ShouldBeVisibile(IGraphPicking picking) { return(Originals.Any(e => picking.Pick(e))); }