Exemplo n.º 1
0
        public void Paint(GraphicsLayer.IGraphics g, int width, int height)
        {
            lock (_ModifyListsToken)
            {
                if (ParametersDirty)
                {
                    var graph = new Algorithms.Graph(GetEdgeWeights());
                    var n     = Vertices.Count;

                    for (int i = 0; i < Vertices.Count; i++)
                    {
                        Vertices[i].IsUniversal = graph.Degree(i) == n - 1;
                    }

                    ParametersDirty = false;
                }

                var jj = 0;
                foreach (var v in _vertices)
                {
                    v.ParentIndex = jj++;
                    v.Paint(g, width, height);
                }

                jj = 0;
                foreach (var e in _edges)
                {
                    e.ParentIndex = jj++;
                    e.Paint(g, width, height);
                }
            }
        }
Exemplo n.º 2
0
        public void DoDegreeLabeling()
        {
            var g = new Algorithms.Graph(_graph.GetEdgeWeights());

            for (int i = 0; i < _graph.Vertices.Count; i++)
            {
                _graph.Vertices[i].Label = g.Degree(i).ToString();
            }

            Invalidate();
            GraphChanged();
        }