Example #1
0
        private void AddNodesBelow(GraphNodeDay7 node, GroupCollection groups)
        {
            for (int i = 0; i < groups[3].Captures.Count; i++)
            {
                var name   = GetNameOfNodeBelow(groups, i);
                var weight = GetWeightOfNodeBelow(groups, i);

                node.AddNodeBellow(name, weight);
            }
        }
Example #2
0
        public GraphNodeDay7 CreateNode(GroupCollection matches)
        {
            var node = new GraphNodeDay7();

            node.Name = GetNameOfNode(matches);

            if (matches.Count == 4)
            {
                AddNodesBelow(node, matches);
            }

            return(node);
        }
        public Dictionary <string, GraphNodeDay7> AddNode(Dictionary <string, GraphNodeDay7> nodes, GraphNodeDay7 newNode)
        {
            var newNodes = new Dictionary <string, GraphNodeDay7>(nodes);

            var key = newNode.Name;

            if (newNodes.ContainsKey(key))
            {
                var existingNode = newNodes[key];

                foreach (var nodebelow in existingNode.ConnectedNodesBelow)
                {
                    newNode.ConnectedNodesBelow.TryAdd(nodebelow.Key, nodebelow.Value);
                }

                newNodes[key] = newNode;
            }
            else
            {
                newNodes.Add(key, newNode);
            }

            return(newNodes);
        }