private void DrawGrid()
        {
            var shortcutSet = run.Output.GetShortcuts(currentLevel);
            var numPoints   = run.Input.Trajectory.Count;

            grid.SetDimensions(numPoints, numPoints);
            for (var i = 0; i < numPoints; i++)
            {
                for (var j = 0; j < numPoints; j++)
                {
                    var color = Color.White;

                    if (i == j)
                    {
                        color = Color.Black;
                    }

                    grid.ColorCell(i, j, color);
                }
            }

            foreach (var shortcut in shortcutSet)
            {
                grid.ColorCell(shortcut.Start.Index, shortcut.End.Index, Color.Black);
                grid.ColorCell(shortcut.End.Index, shortcut.Start.Index, Color.Black);
            }

            grid.DrawGrid();
        }
        private void DrawGrid()
        {
            var shortcutGraph = Output.Graphs[currentLevel];

            var trajectory = run.Input.Trajectory;
            var numPoints  = run.Input.Trajectory.Count;

            var gradientSize  = 1000;
            var colorGradient = ColorableGrid.CreateColorGradient(gradientSize, new [] { Color.Black, Color.Red, Color.Yellow, Color.White });
            //var colorGradient = ColorableGrid.CreateColorGradient(gradientSize, new[] { Color.White, Color.Black });
            var maxWeight = 0;
            var minWeight = int.MaxValue;

            foreach (var shortcut in shortcutGraph.Shortcuts.Keys)
            {
                var weight = ((WeightedEdge)shortcutGraph.Shortcuts[shortcut]).Data;
                maxWeight = Math.Max(maxWeight, weight);
                minWeight = Math.Min(minWeight, weight);
            }

            var weightRange = maxWeight - minWeight;

            grid.SetDimensions(numPoints, numPoints);
            for (var i = 0; i < numPoints; i++)
            {
                for (var j = 0; j < numPoints; j++)
                {
                    Color color;

                    if (i == j)
                    {
                        color = colorGradient[0];
                    }
                    else if (weightRange == 0)
                    {
                        color = colorGradient[colorGradient.Count - 1];
                    }
                    else
                    {
                        var shortcut = j > i ? new Shortcut(trajectory[i], trajectory[j]) : new Shortcut(trajectory[j], trajectory[i]);
                        if (shortcutGraph.Shortcuts.ContainsKey(shortcut))
                        {
                            var weight = ((WeightedEdge)shortcutGraph.Shortcuts[shortcut]).Data;

                            if (j == numPoints - 1 && j > i)
                            {
                                Debug.WriteLine(weight);
                            }

                            var weightFraction = ((double)weight - minWeight) / weightRange;
                            var index          = (int)(weightFraction * (gradientSize - 1));
                            color = colorGradient[index];
                        }
                        else
                        {
                            color = Color.White;
                        }
                    }

                    grid.ColorCell(i, j, color);
                }
            }
            grid.DrawGrid();
        }