RTree解决NN问题PPT课件.ppt
《RTree解决NN问题PPT课件.ppt》由会员分享,可在线阅读,更多相关《RTree解决NN问题PPT课件.ppt(42页珍藏版)》请在三一文库上搜索。
1、NN查找问题n给定空间中的一点q,从数据库中找出离q最近的点n例如:例如:n找出离某家剧院最近的饭店n找出离空中某点最近的星球n找出和某张照片最相似的照片1简单方法:n逐点比较nmin=n从集合中取任一点p,求p和q间的距离n If,小于min,则更新minn缺点:效率低2改进策略n对数据库中的数据建索引,如R-tree.n采用排除法,排除掉一些根本不可能成为NN的点。3R-Tree:一种多维空间索引技术n空间数据库n多媒体数据库图象、文本、视频等特征向量 相似性查询n数据挖掘n聚类、异常检测等n空间数据挖掘n多媒体数据挖掘nCAD、分子生物学等4传统的索引方法n哈希表 n数值的精确匹配 n不
2、能进行范围查询 nB-Treesn键值的一维排序 n不能搜索多维空间5Tree-Structured IndexingnTree-structured indexing techniques support both range searches and equality searchesnindex file may still be quite large.But we can apply the idea repeatedly!Data pages6R-Tree Index StructurenA spatial database consists of a collection of
3、objects representing spatial objects,where each object has a unique identifier,which can be used to retrieve it.nAn R-tree is a height-balanced tree similar to a B-tree,with index records in its leaf nodes containing pointers to data objects.nNodes correspond to disk pages if the index is disk-resid
4、ent.7We will transverse through the R-Tree to give some idea of its structureR-tree:Structure(I)8R1We first move to the first layer of the R-tree which consist of the two nodes R1 and R2.R2R-tree:Structure(II)9R1Then we move to the second layer under node R1 which consist of node R3,R4 and R5R2R3R4R
5、5R-tree:Structure(III)10R1Then we move to the third layer under node R3 which consist of node R8,R9 and R10R2R3R4R5R-tree:Structure(III)11Assuming we want to find all objects lying within the yellow query box Q1R-tree:Searching(I)Q112R1We first move to the first layer of the R-tree and observe that
6、the Q1 intercept both R1 and R2.R2R-tree:Search(II)Q113R1Then we move to the second layer of both R1 and R2 and observe that the query box only intercept node R3,R4 and R5.Thus we will not access the children of R6 and R7.R2R3R4R5R-tree:Search(III)Q114R1Then we move to the third layer under R3,R4,R5
7、 and find the only R10,R11,R12,R13 and R14 intercept Q1.Thus we will only access the data objects under these five nodesR2R3R4R5R-tree:Search(IV)Q115Maintenance of R-treenVery much like the maintenance of B+Tree.Take average O(log n)to search,insert and delete.nConcern when splitting nodes:Need to e
8、nsure that the bounding box have the smallest area16使用R-tree进行NN查找nConstruct a index such as R-tree for the datanTo prune off those MBRs which can never contain a nearest neighbor.17R-tree:Finding Nearest NeighbornFirst problem to be solve:nGiven a query point p and a minimum bounding rectangle(MBR)
9、find an upper bound and lower bound for the distance r such that there exists at least one point in the MBR that is within a distance of r from p.nWhy?nTo facilitate some form of ranking to prune off uninteresting MBRsnEg.we can prune off MBR3 and MBR4.MBRprdistanceMBR1MBR3MBR2MBR418R-tree:Finding
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- RTree 解决 NN 问题 PPT 课件
