Exemplo n.º 1
0
        static IEnumerable <Choosability.Graph> EnumerateWeightings(Choosability.Graph g)
        {
            if (g.MaxDegree > Delta)
            {
                yield break;
            }

            _wonWeightings = new List <List <int> >();
            foreach (var weighting in g.Vertices.Select(v => Enumerable.Range(g.Degree(v), Delta + 1 - g.Degree(v)).Reverse()).CartesianProduct())
            {
                var www = weighting.ToList();
                if (_wonWeightings.Any(ww => ww.Zip(www, (a, b) => a - b).Min() >= 0))
                {
                    continue;
                }

                var gg = g.Clone();
                gg.VertexWeight = www;

                if (LowGirth)
                {
                    if (!gg.Contains(BadG, true, GraphEnumerator.WeightConditionEqual))
                    {
                        continue;
                    }
                }

                yield return(gg);
            }
        }
Exemplo n.º 2
0
        public void Paint(GraphicsLayer.IGraphics g, int width, int height)
        {
            Choosability.Graph graph = null;

            lock (_ModifyListsToken)
            {
                if (ParametersDirty)
                {
                    graph = new Choosability.Graph(GetEdgeWeights());
                    var n = Vertices.Count;

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

                    ParametersDirty = false;
                }

                foreach (var v in _vertices)
                {
                    v.Paint(g, width, height);
                }
                foreach (var e in _edges)
                {
                    e.Paint(g, width, height);
                }
            }

            if (graph != null)
            {
                DoGraphChange(graph);
            }
        }
Exemplo n.º 3
0
 static IEnumerable <Choosability.Graph> EnumerateWeightings(Choosability.Graph g)
 {
     foreach (var weighting in g.Vertices.Select(v => Enumerable.Range(g.Degree(v), 2 + 1)).CartesianProduct())
     {
         var gg = g.Clone();
         gg.VertexWeight = weighting.ToList();
         yield return(gg);
     }
 }
Exemplo n.º 4
0
        public void DoDegreeLabeling()
        {
            var g = new Choosability.Graph(_graph.GetEdgeWeights());

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

            Invalidate();
            GraphChanged();
        }