public void ToDotFile(string path, VisualizationOptions options)
        {
            var graphviz = new GraphvizAlgorithm <Unit, Conversion>(this);

            graphviz.GraphFormat.RankDirection = GraphvizRankDirection.LR;

            graphviz.FormatVertex += (sender, args) =>
            {
                var label = args.Vertex.Name;

                if (options == (options | VisualizationOptions.ShowSystem))
                {
                    if (!String.IsNullOrEmpty(args.Vertex.System))
                    {
                        label += string.Format(" [{0}]", args.Vertex.System);
                    }
                }
                args.VertexFormatter.Label = label;
            };

            var edgeIndex = 0;

            graphviz.FormatEdge +=
                (sender, args) =>
            {
                string label = String.Empty;

                if (options == (options | VisualizationOptions.NumberEdges))
                {
                    edgeIndex += 1;
                    label      = edgeIndex.ToString(CultureInfo.InvariantCulture);
                }

                if (options == (options | VisualizationOptions.ShowFullConversionDescriptions))
                {
                    label +=
                        args.Edge.Steps.Aggregate(String.Empty,
                                                  (output, step) =>
                                                  (String.IsNullOrEmpty(output.Trim()) ? String.Empty : " ") +
                                                  output + step.ToString() +
                                                  (String.IsNullOrEmpty(output.Trim()) ? String.Empty : ", "));
                }

                args.EdgeFormatter.Label.Value = label;
            };

            graphviz.Generate(new FileDotEngine(), path);
        }
Esempio n. 2
0
        internal static string VisualizeIndentedObjectGraph(
            this InstanceProducer producer, VisualizationOptions options)
        {
            if (!producer.IsExpressionCreated)
            {
                return(ExpressionNotCreatedYetMessage);
            }

            var set = new HashSet <InstanceProducer>(InstanceProducer.EqualityComparer);
            var objectGraphBuilder = new ObjectGraphStringBuilder(options.IncludeLifestyleInformation);

            producer.VisualizeIndentedObjectGraph(
                indentingDepth: 0, last: true, set: set, objectGraphBuilder: objectGraphBuilder);

            return(objectGraphBuilder.ToString());
        }
Esempio n. 3
0
        private void NNViewer_Load(object sender, System.EventArgs e)
        {
            VisualizationOptions vo = new VisualizationOptions();

            vo.Width  = pictureBox1.Width;
            vo.Height = pictureBox1.Height;
            vo.InputLayerPrimaryColor  = Color.PaleVioletRed;
            vo.OutputLayerPrimaryColor = Color.PaleGreen;
            vo.HiddenLayerPrimaryColor = Color.SteelBlue;
            vo.BackgroundColor         = Color.PowderBlue;
            vo.ShowValues     = true;
            vo.ValueFontColor = Color.Black;
            visualizer        = new Visualizer(network, vo);
            pictureBox1.Image = visualizer.Draw();
            network.Train(new double[] { 2, 4, 7 }, new double[] { 2, 2 }, 10);
            pictureBox1.Image = visualizer.Draw();
        }
Esempio n. 4
0
 public ObjectGraphStringBuilder(VisualizationOptions visualizationOptions)
 {
     this.visualizationOptions = visualizationOptions;
 }
Esempio n. 5
0
 public Settings(VisualizationOptions visualizationOptions)
 {
     VisualizationOptions = visualizationOptions;
 }