Ejemplo n.º 1
0
        public void RegisterItem(T item)
        {
            var name = _getName(item);

            _items.Add(name, item);
            _cycleDetector.AddNode(new Node(name));
            foreach (var dep in _getDependencies(item))
            {
                //bottle X needs bottle Y
                _cycleDetector.Connect(_getName(item), dep);
            }
        }
Ejemplo n.º 2
0
        public DirectedGraph Clone()
        {
            var result = new DirectedGraph();

            foreach (var node in _nodes)
            {
                var newNode = new Node(node.Name);
                result.AddNode(newNode);
            }

            foreach (var edge in _edges)
            {
                result.Connect(edge.Source.Name, edge.Target.Name);
            }

            return(result);
        }
Ejemplo n.º 3
0
        public DirectedGraph Clone()
        {
            var result = new DirectedGraph();

            foreach (var node in _nodes)
            {
                var newNode = new Node(node.Name);
                result.AddNode(newNode);
            }

            foreach (var edge in _edges)
            {
                result.Connect(edge.Source.Name, edge.Target.Name);
            }

            return result;
        }