/// <summary>
        /// Adds ports with different colors to the node.
        /// </summary>
        private void AddIndividualPorts(IGraph graph, INode node)
        {
            var portStyle = new ColorPortStyle();

            graph.AddPort(node, FreeNodePortLocationModel.Instance.CreateParameter(new PointD(0.25, 0)), portStyle, Color.Firebrick);
            graph.AddPort(node, FreeNodePortLocationModel.Instance.CreateParameter(new PointD(0.75, 0)), portStyle, Color.Green);
            graph.AddPort(node, FreeNodePortLocationModel.Instance.CreateParameter(new PointD(0, 0.25)), portStyle, Color.Black);
            graph.AddPort(node, FreeNodePortLocationModel.Instance.CreateParameter(new PointD(0, 0.75)), portStyle, Color.Black);
            graph.AddPort(node, FreeNodePortLocationModel.Instance.CreateParameter(new PointD(1, 0.25)), portStyle, Color.RoyalBlue);
            graph.AddPort(node, FreeNodePortLocationModel.Instance.CreateParameter(new PointD(1, 0.75)), portStyle, Color.Orange);
            graph.AddPort(node, FreeNodePortLocationModel.Instance.CreateParameter(new PointD(0.25, 1)), portStyle, Color.Purple);
            graph.AddPort(node, FreeNodePortLocationModel.Instance.CreateParameter(new PointD(0.75, 1)), portStyle, Color.Purple);
        }
        private void CreateSampleGraph()
        {
            IGraph graph = graphControl.Graph;

            CreateNode(graph, 100, 100, 80, 30, Colors.Firebrick, "No Edge");
            CreateNode(graph, 350, 100, 80, 30, Colors.Green, "Green Only");
            CreateNode(graph, 100, 200, 80, 30, Colors.Green, "Green Only");
            CreateNode(graph, 350, 200, 80, 30, Colors.Firebrick, "No Edge");

            // The blue nodes have predefined ports
            var portStyle = new ColorPortStyle();

            var blue1 = CreateNode(graph, 100, 300, 80, 30, Colors.RoyalBlue, "One   Port");

            graph.AddPort(blue1, blue1.Layout.GetCenter(), portStyle).Tag = Colors.Black;

            var blue2 = CreateNode(graph, 350, 300, 100, 100, Colors.RoyalBlue, "Many Ports");
            var portCandidateProvider = PortCandidateProviders.FromShapeGeometry(blue2, 0, 0.25, 0.5,
                                                                                 0.75);

            portCandidateProvider.Style = portStyle;
            portCandidateProvider.Tag   = Colors.Black;
            var candidates = portCandidateProvider.GetSourcePortCandidates(graphControl.InputModeContext);

            foreach (IPortCandidate portCandidate in candidates)
            {
                if (portCandidate.Validity != PortCandidateValidity.Dynamic)
                {
                    portCandidate.CreatePort(graphControl.InputModeContext);
                }
            }

            // The orange node
            CreateNode(graph, 100, 400, 100, 100, Colors.Orange, "Dynamic Ports");

            INode n = CreateNode(graph, 100, 540, 100, 100, Colors.Purple, "Individual\nPort Constraints");

            AddIndividualPorts(graph, n);

            n = CreateNode(graph, 350, 540, 100, 100, Colors.Purple, "Individual\nPort Constraints");
            AddIndividualPorts(graph, n);
        }