コード例 #1
0
        public IEnumerable <OriginalLocation> AddMessage(OriginalLocation msc)
        {
            _im.Add(msc);
            _hm.Add(msc);
            _gm.AddNode(msc);

            var n = _im.RangeSearch(Bcn(msc)).ToList();

            foreach (var ms in n.Where(ms => ms != msc))
            {
                if (Bcn(ms).Contains(new Point {
                    X = msc.Lat, Y = msc.Lon
                }))
                {
                    //Add two edges to simulate a unidirectional graph
                    _gm.AddEdge(msc, ms);
                    _gm.AddEdge(ms, msc);
                }
            }

            return(n);
        }
コード例 #2
0
        public ConstraintGraph SubGraph(IEnumerable <OriginalLocation> n)
        {
            var result = new ConstraintGraph();

            foreach (var node in _nodes.Where(node => n.Contains(node.Message)))
            {
                result.AddNode(node.Message);

                foreach (var edge in node.Edges.Where(edge => n.Contains(edge.To)))
                {
                    result.AddEdge(edge.From, edge.To);
                }
            }

            return(result);
        }