Esempio 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);
            }
        }
Esempio n. 2
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);
     }
 }