Exemple #1
0
        static bool children_unbalanced(D7Graph g, string root)
        {
            HashSet <int> ws = new HashSet <int>();

            foreach (string c in g.children(root))
            {
                ws.Add(g.weight(c));
            }

            return(ws.Count > 1);
        }
Exemple #2
0
        static string get_unbalanced(D7Graph g, string[] cs)
        {
            var q = cs.GroupBy(
                str => g.weight(str),
                str => str,
                (w, n) => new
            {
                Key   = w,
                Count = n.Count(),
                Res   = n.Min()
            });

            foreach (var res in q)
            {
                if (res.Count == 1)
                {
                    return(res.Res);
                }
            }

            return(null);
        }