public static Microsoft.Glee.Drawing.Graph mstPrintGraph(int[][] graphMatrix, int numberOfVertex)

        {
            //create a graph object
            //   Microsoft.Glee.Drawing.Graph graph = new Microsoft.Glee.Drawing.Graph("graph");

            for (int i = 0; i < numberOfVertex; i++)
            {
                for (int j = i; j < numberOfVertex; j++)
                {
                    if (graphMatrix[i][j] > 0)
                    {
                        Edge e = tempGraph.AddEdge("Node" + (i + 1), "Node" + (j + 1));
                        e.EdgeAttr.ArrowHeadAtTarget = ArrowStyle.None;

                        e.EdgeAttr.Label = graphMatrix[i][j].ToString();
                    }
                }
            }


            //bind the graph to the viewer
            viewer.Graph = tempGraph;

            //associate the viewer with the form
            mstForm.SuspendLayout();
            viewer.Dock = System.Windows.Forms.DockStyle.Fill;
            mstForm.Controls.Add(viewer);
            mstForm.ResumeLayout();

            //show the form
            mstForm.Show();

            return(tempGraph);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Desenha o grafo atual.
        /// </summary>
        private void DrawGraph(EDA.Graph graphToDraw, EDA.Node[] highlightedNodes)
        {
            List <EDA.Edge> edges = new List <EDA.Edge>();

            Glee.Graph drawingGraph = new Glee.Graph("Grafo - EDA2");
            // Adiciona nós ao grafo..
            foreach (EDA.Node node in graphToDraw.Nodes)
            {
                Glee.Node drawingNode = drawingGraph.AddNode(node.Name);
                drawingNode.Attr.Shape = Glee.Shape.Circle;
                if (highlightedNodes != null && Array.IndexOf(highlightedNodes, node) >= 0)
                {
                    drawingNode.Attr.Color = Glee.Color.Red;
                }
                // Consolida os arcos..
                edges.AddRange(node.Edges);
            }
            foreach (EDA.Edge edge in edges)
            {
                Glee.Edge drawingEdge = drawingGraph.AddEdge(edge.From.Name, edge.To.Name);
                drawingEdge.Attr.Label = String.Format("{0:F4}", edge.Cost);
            }
            // Gera controle de desenho..
            GleeUI.GViewer viewer = new GleeUI.GViewer();
            viewer.NavigationVisible = false;
            viewer.OutsideAreaBrush  = Brushes.White;
            viewer.RemoveToolbar();
            viewer.Graph = drawingGraph;
            viewer.Dock  = System.Windows.Forms.DockStyle.Fill;
            pnlGraph.Controls.Clear();
            pnlGraph.Controls.Add(viewer);
        }
        public static void printGraph(int[][] graphMatrix, int numberOfVertex, Form form)
        {
            //create a graph object
            Microsoft.Glee.Drawing.Graph graph = new Microsoft.Glee.Drawing.Graph("graph");

            for (int i = 0; i < numberOfVertex; i++)
            {
                for (int j = 0; j < numberOfVertex; j++)
                {
                    if (graphMatrix[i][j] > 0)
                    {
                        Edge e = graph.AddEdge("Node" + (i + 1), "Node" + (j + 1));


                        e.EdgeAttr.Label = graphMatrix[i][j].ToString();
                    }
                }
            }



            //bind the graph to the viewer
            viewer.Graph = graph;

            //associate the viewer with the form
            form.SuspendLayout();
            viewer.Dock = System.Windows.Forms.DockStyle.Fill;
            form.Controls.Add(viewer);
            form.ResumeLayout();

            //show the form
            form.Show();
        }
        public static void printDirectGraph(int[][] graphMatrix, int[][] basicGraph, int numberOfVertics)
        {
            Microsoft.Glee.Drawing.Graph graph = new Microsoft.Glee.Drawing.Graph("graph");

            for (int i = 0; i < numberOfVertics; i++)
            {
                for (int j = 0; j < i; j++)
                {
                    if ((basicGraph[j][i] > 0) && graphMatrix[i][j] > 0)
                    {
                        Edge e = graph.AddEdge("Node" + (j + 1), "Node" + (i + 1));
                        e.EdgeAttr.Label = graphMatrix[i][j].ToString() + "/" + basicGraph[j][i];
                        e.EdgeAttr.Color = Microsoft.Glee.Drawing.Color.Green;
                    }
                }
            }

            //bind the graph to the viewer
            viewer.Graph = graph;

            //associate the viewer with the form
            maxFlowform.SuspendLayout();
            viewer.Dock = System.Windows.Forms.DockStyle.Fill;
            maxFlowform.Controls.Add(viewer);
            maxFlowform.ResumeLayout();

            //show the form
            maxFlowform.Show();
        }
        public static void printAugmentedPath(int[][] graphMatrix, int numberOfVertex, int[] parent)
        {
            Microsoft.Glee.Drawing.Graph graph = new Microsoft.Glee.Drawing.Graph("graph");

            for (int i = 0; i < numberOfVertex; i++)
            {
                for (int j = 0; j < numberOfVertex; j++)
                {
                    if (graphMatrix[i][j] > 0)
                    {
                        Edge e = graph.AddEdge("Node" + (i + 1), "Node" + (j + 1));
                        e.EdgeAttr.Label = graphMatrix[i][j].ToString();
                    }
                }
            }

            int u;

            try
            {
                for (int v = numberOfVertex - 1; v != 0; v = parent[v])
                {
                    u = parent[v];
                    Node n1 = graph.FindNode("Node" + (u + 1));
                    Node n2 = graph.FindNode("Node" + (v + 1));

                    n1.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.Red;
                    n2.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.Red;

                    //    Edge e = graph.AddEdge("Node" + u, "Node" + v);
                    //   e.EdgeAttr.Color = Microsoft.Glee.Drawing.Color.Red;
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Your graph is incorrect \nGraph should be directed with source and sink");
            }



            //bind the graph to the viewer
            viewer.Graph = graph;

            //associate the viewer with the form
            //  form.SuspendLayout();
            viewer.Dock = System.Windows.Forms.DockStyle.Fill;
            maxFlowform.Controls.Add(viewer);
            maxFlowform.ResumeLayout();

            //show the form
            maxFlowform.Show();
        }
Ejemplo n.º 6
0
        protected object AddEdge(string idFrom, string idTo, EdgeStyle edgeStyle, Color color)
        {
            GD.Edge edge = (GD.Edge)AddEdge(idFrom, idTo, edgeStyle);
            if (edge == null)
            {
                return(null);
            }

            GD.Color gcolor = new GD.Color(color.A, color.R, color.G, color.B);
            edge.Attr.Color = gcolor;

            return(edge);
        }
        public static Microsoft.Glee.Drawing.Graph printMinNode(int[][] graphMatrix, int numberOfVertex, int[] distance, int minNode)
        {
            //create a graph object
            Microsoft.Glee.Drawing.Graph graph = new Microsoft.Glee.Drawing.Graph("graph");

            for (int i = 0; i < numberOfVertex; i++)
            {
                for (int j = 0; j < numberOfVertex; j++)
                {
                    if (graphMatrix[i][j] > 0)
                    {
                        Edge e = graph.AddEdge("Node" + (i + 1), "Node" + (j + 1));

                        e.EdgeAttr.Label = graphMatrix[i][j].ToString();
                    }
                }
            }


            for (int i = 0; i < numberOfVertex; i++)
            {
                Node n = graph.FindNode("Node" + (i + 1));
                if (distance[i] == Int32.MaxValue)
                {
                    n.Attr.Label += "\n(" + "infinity" + ")";
                }
                else
                {
                    n.Attr.Label += "\n(" + distance[i].ToString() + ")";
                }
            }

            Node n1 = graph.FindNode("Node" + (minNode + 1));

            n1.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.Red;

            //bind the graph to the viewer
            viewer.Graph = graph;

            //associate the viewer with the form
            dijkstraForm.SuspendLayout();
            viewer.Dock = System.Windows.Forms.DockStyle.Fill;
            dijkstraForm.Controls.Add(viewer);
            dijkstraForm.ResumeLayout();

            //show the form
            dijkstraForm.Show();
            return(graph);
        }
Ejemplo n.º 8
0
        void gViewer_SelectionChanged(object sender, EventArgs e)
        {
            if (selectedObject != null)
            {
                if (selectedObject is Microsoft.Glee.Drawing.Edge)
                {
                    ((Edge)selectedObject).Attr = selectedObjectAttr as EdgeAttr;
                }
                else if (selectedObject is Node)
                {
                    ((Node)selectedObject).Attr = selectedObjectAttr as NodeAttr;
                }

                selectedObject = null;
            }

            if (gViewerIDS.SelectedObject == null)
            {
                label1.Text = "No object under the mouse";
                gViewerIDS.SetToolTip(toolTip, "");
            }
            else
            {
                selectedObject = gViewerIDS.SelectedObject;

                if (selectedObject is Edge)
                {
                    selectedObjectAttr = ((Edge)gViewerIDS.SelectedObject)?.Attr.Clone();
                    ((Edge)gViewerIDS.SelectedObject).Attr.Color     = Color.Yellow;
                    ((Edge)gViewerIDS.SelectedObject).Attr.Fontcolor = Color.Yellow;
                    Edge edge = (Edge)gViewerIDS.SelectedObject;

                    //here you can use e.Attr.Id or e.UserData to get back to you data
                    gViewerIDS.SetToolTip(toolTip, $"edge from {edge.Source} {edge.Target}");
                }
                else if (selectedObject is Node)
                {
                    selectedObjectAttr = ((Node)gViewerIDS.SelectedObject)?.Attr.Clone();
                    (selectedObject as Node).Attr.Color     = Color.Yellow;
                    (selectedObject as Node).Attr.Fontcolor = Color.Yellow;
                    //here you can use e.Attr.Id to get back to your data
                    gViewerIDS.SetToolTip(toolTip, $"node {((Node) selectedObject).Attr.Label}");
                }
                label1.Text = selectedObject.ToString();
            }
            gViewerIDS.Invalidate();
        }
Ejemplo n.º 9
0
        protected override void InternalCompute()
        {
            this.gleeGraph = new Microsoft.Glee.Drawing.Graph("");

            foreach (var v in this.VisitedGraph.Vertices)
            {
                Node node = this.AddNode(v);
                node.UserData = v;
                this.OnNodeAdded(new GleeVertexEventArgs <TVertex>(v, node));
            }

            foreach (var e in this.VisitedGraph.Edges)
            {
                Microsoft.Glee.Drawing.Edge edge = this.AddEdge(e);
                edge.UserData = e;
                this.OnEdgeAdded(new GleeEdgeEventArgs <TVertex, TEdge>(e, edge));
            }
        }
Ejemplo n.º 10
0
        //[STAThread]
        static void buildTree(ref StreamReader sr, int jmlRumah)
        {
            tree      = new List <List <int> >(jmlRumah + 1);
            pointsTo  = new int[jmlRumah + 1];
            isBody    = new bool[jmlRumah + 1];
            isBody[1] = true;

            for (int i = 0; i <= jmlRumah; i++)
            {
                tree.Add(new List <int>());
            }

            List <(int, int)> pending = new List <(int a, int b)>();

            for (int i = 0; i < jmlRumah - 1; i++)
            {
                string[] line = sr.ReadLine().Split();

                int a = Int32.Parse(line[0]);
                int b = Int32.Parse(line[1]);


                if (isBody[a])
                {
                    pointsTo[b] = a;
                    isBody[b]   = true;
                }
                else if (isBody[b])
                {
                    pointsTo[a] = b;
                    isBody[a]   = true;
                }
                else
                {
                    pending.Add((a, b));
                }
                tree[a].Add(b);
                tree[b].Add(a);
                // Add edges between 2 vertices to graph object:
                Microsoft.Glee.Drawing.Edge e = defaultG.AddEdge(line[0], line[1]);
                // Set edges without arrowhead => UNDIRECTED GRAPH!
                e.Attr.ArrowHeadAtTarget = ArrowStyle.None;
            }

            int idx = 0;

            while (pending.Any())
            {
                if (idx >= pending.Count())
                {
                    idx = 0;
                }
                int a = pending[idx].Item1;
                int b = pending[idx].Item2;
                if (isBody[a])
                {
                    pointsTo[b] = a;
                    isBody[b]   = true;
                    pending.RemoveAt(idx);
                }
                else if (isBody[b])
                {
                    pointsTo[a] = b;
                    isBody[a]   = true;
                    pending.RemoveAt(idx);
                }
                else
                {
                    idx++;
                }
            }
        }
        public static void printDijkstraPath(int[][] graphMatrix, int numberOfVertex, int[] distance,
                                             int[] path, int distination)
        {
            //create a graph object
            Microsoft.Glee.Drawing.Graph graph = new Microsoft.Glee.Drawing.Graph("graph");

            for (int i = 0; i < numberOfVertex; i++)
            {
                for (int j = 0; j < numberOfVertex; j++)
                {
                    if (graphMatrix[i][j] > 0)
                    {
                        Edge e = graph.AddEdge("Node" + (i + 1), "Node" + (j + 1));

                        e.EdgeAttr.Label = graphMatrix[i][j].ToString();
                    }
                }
            }


            for (int i = 0; i < numberOfVertex; i++)
            {
                Node n = graph.FindNode("Node" + (i + 1));
                if (distance[i] == Int32.MaxValue)
                {
                    n.Attr.Label += "\n(" + "infinity" + ")";
                }
                else
                {
                    n.Attr.Label += "\n(" + distance[i].ToString() + ")";
                }
            }

            int iTemp = distination;
            int jTemp = 0;

            while (iTemp != (-1))
            {
                jTemp = path[iTemp];

                if (iTemp != 0)
                {
                    Node nsource = graph.FindNode("Node" + (jTemp + 1));
                    Node ntarget = graph.FindNode("Node" + (iTemp + 1));
                    foreach (var edge in nsource.OutEdges)
                    {
                        if (edge.TargetNode == ntarget)
                        {
                            edge.EdgeAttr.Color = Microsoft.Glee.Drawing.Color.Red;
                        }
                    }
                }


                iTemp = jTemp;
            }

            //bind the graph to the viewer
            viewer.Graph = graph;

            //associate the viewer with the form
            dijkstraForm.SuspendLayout();
            viewer.Dock = System.Windows.Forms.DockStyle.Fill;
            dijkstraForm.Controls.Add(viewer);
            dijkstraForm.ResumeLayout();

            //show the form
            dijkstraForm.Show();
        }
Ejemplo n.º 12
0
        private void BuildGraph()
        {
            // The only way I can see to do this is to create another graph, and
            // copy what we want to the new graph, which is slow. Grim, we need
            // to rebuild addedNodes and edges as well.

            // Considering options, it's easier to do this each time anyway,
            // and don't build the initial graph at all. TODO, split this.

            GD.Graph newGraph = CreateGraph();
            Dictionary <string, object>         newAddedNodes = new Dictionary <string, object>();
            Dictionary <string, List <object> > newAddedEdges = new Dictionary <string, List <object> >();

            newGraph.GraphAttr.AspectRatio = _options.AspectRatio;
            newGraph.GraphAttr.NodeSep     = _options.NodeSep;

            foreach (KeyValuePair <string, object> pair in _addedNodes)
            {
                GD.Node node = pair.Value as GD.Node;

                if (!_options.ShowOrphans && !_notOrphans.ContainsKey(pair.Key))
                {
                    continue;
                }

                GD.Node newNode = newGraph.AddNode(node.Id);
                newNode.Attr             = node.Attr.Clone();
                newNode.Attr.LabelMargin = _options.TextSpacing;
                newNode.Attr.Fontsize    = _options.FontSize;

                newNode.UserData = node.UserData;
                newAddedNodes.Add(node.Id, newNode);
            }

            foreach (KeyValuePair <string, List <object> > pair in _addedEdges)
            {
                if (pair.Value.Count == 0)
                {
                    return;
                }

                string idFrom = (pair.Value[0] as GD.Edge).Source;
                string idTo   = (pair.Value[0] as GD.Edge).Target;

                if (_options.MultipleEdges)
                {
                    int count = _addedEdges[pair.Key].Count;

                    // Perhaps thicken edges.
                    if (_options.ThickenEdges)
                    {
                        // Interesting, but any greater than 2 looks bad.
                        int thickness = 1;
                        if (count > 1)
                        {
                            thickness = 2;
                        }

                        // Create a thickened edge. Take the properties of the first one.
                        GD.Edge edge    = pair.Value[0] as GD.Edge;
                        GD.Edge newEdge = newGraph.AddEdge(idFrom, idTo);
                        newEdge.Attr           = edge.Attr.Clone();
                        newEdge.Attr.LineWidth = thickness;
                        newAddedEdges.Add(pair.Key, new List <object>()
                        {
                            newEdge
                        });
                    }
                    else
                    {
                        // Show multiple edges.
                        newAddedEdges.Add(pair.Key, new List <object>());
                        foreach (GD.Edge edge in pair.Value)
                        {
                            GD.Edge newEdge = newGraph.AddEdge(idFrom, idTo);
                            newEdge.Attr = edge.Attr.Clone();
                            newAddedEdges[pair.Key].Add(newEdge);
                        }
                    }
                }
                else
                {
                    // Show single edges. Take the properties of the first one.
                    GD.Edge edge    = pair.Value[0] as GD.Edge;
                    GD.Edge newEdge = newGraph.AddEdge(idFrom, idTo);
                    newEdge.Attr = edge.Attr.Clone();
                    newAddedEdges.Add(pair.Key, new List <object> {
                        newEdge
                    });
                }
            }

            _hasOrphans = _notOrphans.Count < _addedNodes.Count;

            _graph      = newGraph;
            _addedEdges = newAddedEdges;
            _addedNodes = newAddedNodes;
        }
Ejemplo n.º 13
0
        protected object AddEdge(string idFrom, string idTo, EdgeStyle edgeStyle)
        {
            if (_ignoreSidePanelItems && _sidePanel.Lookup(idFrom))
            {
                return(null);
            }
            if (_ignoreSidePanelItems && _sidePanel.Lookup(idTo))
            {
                return(null);
            }

            string key         = idFrom + "?" + idTo;
            bool   edgePresent = _addedEdges.ContainsKey(key);

            if (!_options.MultipleEdges && edgePresent)
            {
                return(null);
            }

            // Don't add it to the graph yet.
            GD.Edge edge = new GD.Edge(idFrom, string.Empty, idTo);

            if (edgeStyle == EdgeStyle.NormalArrow)
            {
                edge.Attr.ArrowHeadAtTarget = GD.ArrowStyle.Normal;
            }
            else
            {
                edge.Attr.ArrowHeadAtTarget = GD.ArrowStyle.None;
            }

            if (_options.ShowOrphans)
            {
                // Things are easy if we're showing everything.
                if (!edgePresent)
                {
                    _addedEdges.Add(key, new List <object>());
                }
                _addedEdges[key].Add(edge);
            }
            else
            {
                // Nodes linked to themselves still count as orphans.
                if (idFrom != idTo)
                {
                    // Update non orphan list.
                    if (!_notOrphans.ContainsKey(idFrom))
                    {
                        _notOrphans.Add(idFrom, true);
                    }
                    if (!_notOrphans.ContainsKey(idTo))
                    {
                        _notOrphans.Add(idTo, true);
                    }

                    if (!edgePresent)
                    {
                        _addedEdges.Add(key, new List <object>());
                    }
                    _addedEdges[key].Add(edge);
                }
                else
                {
                    // We still want to show cyclic, as long as their not orphans.
                    if (_notOrphans.ContainsKey(idFrom) || _notOrphans.ContainsKey(idTo))
                    {
                        if (!edgePresent)
                        {
                            _addedEdges.Add(key, new List <object>());
                        }
                        _addedEdges[key].Add(edge);
                    }
                }
            }

            return(edge);
        }
Ejemplo n.º 14
0
        private void UpdateAnswerAndGraph(object sender)
        {
            Connectivity Con = IsConnected(DensityProbabsMatrix);

            if (Con == Connectivity.None)
            {
                if (!(sender is Button && (sender as Button).Name == "btnCalcul"))
                {
                    if (!checkBox1.Checked)
                    {
                        throw new Exception("Unsuitable graph");
                    }
                }
                lblConnect.ForeColor = System.Drawing.Color.Red;
                lblConnect.Text      = "Not connected";
            }
            else if (Con == Connectivity.Weakly)
            {
                if (!(sender is Button && (sender as Button).Name == "btnCalcul"))
                {
                    if (!checkBox2.Checked)
                    {
                        throw new Exception("Unsuitable graph");
                    }
                }
                lblConnect.ForeColor = System.Drawing.Color.Coral;
                lblConnect.Text      = "Weakly connected";
            }
            else if (Con == Connectivity.Connected)
            {
                if (!(sender is Button && (sender as Button).Name == "btnCalcul"))
                {
                    if (!checkBox3.Checked)
                    {
                        throw new Exception("Unsuitable graph");
                    }
                }
                lblConnect.ForeColor = System.Drawing.Color.YellowGreen;
                lblConnect.Text      = "Connected";
            }
            else
            {
                if (!(sender is Button && (sender as Button).Name == "btnCalcul"))
                {
                    if (!checkBox4.Checked)
                    {
                        throw new Exception("Unsuitable graph");
                    }
                }
                lblConnect.ForeColor = System.Drawing.Color.ForestGreen;
                lblConnect.Text      = "Strongly connected";
            }

            double[,] MarkMatrix = ConvertToMarkMatrix(DensityProbabsMatrix);

            double[] Answer = Gauss.Solve(MarkMatrix);
            for (int i = 0; i < Answer.Length; i++)
            {
                dgvAnswer[0, i].Value = Answer[i].ToString("0.00");
            }

            //this is abstract.dot of GraphViz
            Graph g = new Graph("graph");

            g.GraphAttr.NodeAttr.Padding = 3;

            for (int i = 0; i < DensityProbabsMatrix.GetLength(0); i++)
            {
                for (int j = 0; j < DensityProbabsMatrix.GetLength(1); j++)
                {
                    if (DensityProbabsMatrix[i, j] != double.PositiveInfinity && DensityProbabsMatrix[i, j] != 0)
                    {
                        Microsoft.Glee.Drawing.Edge edge = g.AddEdge("S" + (i + 1).ToString(), "S" + (j + 1).ToString());
                        edge.Attr.Label = DensityProbabsMatrix[i, j].ToString("0.00");
                    }
                }
            }

            if (Con == Connectivity.None)
            {
                for (int i = 0; i < DensityProbabsMatrix.GetLength(0); i++)
                {
                    bool brk = false;
                    for (int j = 0; j < DensityProbabsMatrix.GetLength(0); j++)
                    {
                        if (j != i)
                        {
                            if (DensityProbabsMatrix[j, i] != double.PositiveInfinity || DensityProbabsMatrix[i, j] != double.PositiveInfinity)
                            {
                                brk = true;
                                break;
                            }
                        }
                    }
                    if (!brk)
                    {
                        g.AddNode("S" + (i + 1).ToString());
                    }
                }
            }

            //layout the graph and draw it
            gViewer1.Graph = g;
            //this.propertyGrid1.SelectedObject = g;
        }
Ejemplo n.º 15
0
        protected object AddEdge(string idFrom, string idTo, EdgeStyle edgeStyle)
        {
            if (_ignoreSidePanelItems && _sidePanel.Lookup(idFrom)) return null;
            if (_ignoreSidePanelItems && _sidePanel.Lookup(idTo)) return null;

            string key = idFrom + "?" + idTo;
            bool edgePresent = _addedEdges.ContainsKey(key);

            if (!_options.MultipleEdges && edgePresent) return null;

            // Don't add it to the graph yet.
            GD.Edge edge = new GD.Edge(idFrom, string.Empty, idTo);

            if (edgeStyle == EdgeStyle.NormalArrow)
                edge.Attr.ArrowHeadAtTarget = GD.ArrowStyle.Normal;
            else
                edge.Attr.ArrowHeadAtTarget = GD.ArrowStyle.None;

            if (_options.ShowOrphans)
            {
                // Things are easy if we're showing everything.
                if (!edgePresent) _addedEdges.Add(key, new List<object>());
                _addedEdges[key].Add(edge);
            }
            else
            {
                // Nodes linked to themselves still count as orphans.
                if (idFrom != idTo)
                {
                    // Update non orphan list.
                    if (!_notOrphans.ContainsKey(idFrom)) _notOrphans.Add(idFrom, true);
                    if (!_notOrphans.ContainsKey(idTo)) _notOrphans.Add(idTo, true);

                    if (!edgePresent) _addedEdges.Add(key, new List<object>());
                    _addedEdges[key].Add(edge);
                }
                else
                {
                    // We still want to show cyclic, as long as their not orphans.
                    if (_notOrphans.ContainsKey(idFrom) || _notOrphans.ContainsKey(idTo))
                    {
                        if (!edgePresent) _addedEdges.Add(key, new List<object>());
                        _addedEdges[key].Add(edge);
                    }
                }
            }

            return edge;
        }