Example #1
0
        public void RecursiveGetUser(string uid, int gen)
        {
            gen++;
            var result = ThriftTool.GetSingleKey(ThriftTool.ToByte(uid), "M01UserRelaction", 5000);

            var node = new RelactionNode {
                id = uid, weight = result.Count
            };

            if (!NodeList.Contains(node))
            {
                NodeList.Add(node); //add new node
                NodeStringList.Add(uid);
            }

            if (gen >= 4)
            {
                return;
            }
            foreach (var ks in result)
            {
                var target = ThriftTool.ToString(ks.Counter_column.Name);
                var weight = (int)ks.Counter_column.Value;
                var edge   = new RelactionEdge {
                    id = uid + "_" + target, source = uid, target = target, weight = weight
                };
                EdgeList.Add(edge);
                if (!NodeStringList.Contains(target))
                {
                    RecursiveGetUser(target, gen);
                }
            }
        }