最近在开发一套自己的单细胞分析方法,所以copy paste事业有所停顿。

实例:

R eNetIt v0.1-1

data(ralu.site)
# Saturated spatial graph
sat.graph <- knn.graph(ralu.site, row.names=ralu.site@data[,"SiteName"])
head(sat.graph@data) # Distanced constrained spatial graph
dist.graph <- knn.graph(ralu.site, row.names=ralu.site@data[,"SiteName"], max.dist = 5000) par(mfrow=c(1,2))
plot(sat.graph, col="grey")
points(ralu.site, col="red", pch=20, cex=1.5)
box()
title("Saturated graph")
plot(dist.graph, col="grey")
points(ralu.site, col="red", pch=20, cex=1.5)
box()
title("Distance constrained graph")

  

  

一下来自wiki

The nearest neighbor graph (NNG) for a set of n objects P in a metric space (e.g., for a set of points in the plane with Euclidean distance) is a directed graph with P being its vertex set and with a directed edge from p to q whenever q is a nearest neighbor of p (i.e., the distance from p to q is no larger than from p to any other object from P).[1]

NNG图,在多维空间里我有很多个点,如上例,在17维空间里,我有31个点,一个常见的距离度量就是欧氏距离,NNG是有方向的,因为q是p的邻居并不代表p是q的邻居!

In many discussions, the directions of the edges are ignored and the NNG is defined as an ordinary (undirected) graph. However, the nearest neighbor relation is not a symmetric one, i.e., p from the definition is not necessarily a nearest neighbor for q.

In some discussions, in order to make the nearest neighbor for each object unique, the set P is indexed and in the case of a tie the object with, e.g., the largest index is taken for the nearest neighbor.[2]

The k-nearest neighbor graph (k-NNG) is a graph in which two vertices p and q are connected by an edge. if the distance between p and q is among the k-th smallest distances from p to other objects from P. The NNG is a special case of the k-NNG, namely, it is the 1-NNG. k-NNGs obey a separator theorem: they can be partitioned into two subgraphs of at most n(d + 1)/(d + 2) vertices each by the removal of O(k1/dn1 − 1/d) points.[3]

在k-NNG里,就不是最近邻了,而是考虑k-th,就是把k-th内的点都当做邻居。

Another special case is the (n − 1)-NNG. This graph is called the farthest neighbor graph (FNG).

如果k=n-1,那么就是FNG图。

In theoretical discussions of algorithms a kind of general position is often assumed, namely, the nearest (k-nearest) neighbor is unique for each object. In implementations of the algorithms it is necessary to bear in mind that this is not always the case.

NNGs for points in the plane as well as in multidimensional spaces find applications, e.g., in data compressionmotion planning, and facilities location. In statistical analysis, the nearest-neighbor chain algorithm based on following paths in this graph can be used to find hierarchical clusterings quickly. Nearest neighbor graphs are also a subject of computational geometry.

Nearest neighbor graph | 近邻图的更多相关文章

  1. Visualizing MNIST with t-SNE, MDS, Sammon’s Mapping and Nearest neighbor graph

    MNIST 可视化 Visualizing MNIST: An Exploration of Dimensionality Reduction At some fundamental level, n ...

  2. K Nearest Neighbor 算法

    文章出处:http://coolshell.cn/articles/8052.html K Nearest Neighbor算法又叫KNN算法,这个算法是机器学习里面一个比较经典的算法, 总体来说KN ...

  3. 【cs231n】图像分类-Nearest Neighbor Classifier(最近邻分类器)【python3实现】

    [学习自CS231n课程] 转载请注明出处:http://www.cnblogs.com/GraceSkyer/p/8735908.html 图像分类: 一张图像的表示:长度.宽度.通道(3个颜色通道 ...

  4. K NEAREST NEIGHBOR 算法(knn)

    K Nearest Neighbor算法又叫KNN算法,这个算法是机器学习里面一个比较经典的算法, 总体来说KNN算法是相对比较容易理解的算法.其中的K表示最接近自己的K个数据样本.KNN算法和K-M ...

  5. 使用perf生成Flame Graph(火焰图)

      具体的步骤参见这里: <flame graph:图形化perf call stack数据的小工具>   使用SystemTap脚本制作火焰图,内存较少时,分配存储采样的数组可能失败,需 ...

  6. 当前数据库普遍使用wait-for graph等待图来进行死锁检测

    当前数据库普遍使用wait-for graph等待图来进行死锁检测 较超时机制,这是一种更主动的死锁检测方式,innodb引擎也采用wait-for graph SQL Server也使用wait-f ...

  7. Nearest Neighbor Search

    ## Nearest Neighbor Search ## Input file: standard input Output file: standard output Time limit: 1 ...

  8. Rikka with Graph(联通图取边,暴力)

    Rikka with Graph Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) ...

  9. 从Random Walk谈到Bacterial foraging optimization algorithm(BFOA),再谈到Ramdom Walk Graph Segmentation图分割算法

    1. 从细菌的趋化性谈起 0x1:物质化学浓度梯度 类似于概率分布中概率密度的概念.在溶液中存在不同的浓度区域. 如放一颗糖在水盆里,糖慢慢溶于水,糖附近的水含糖量比远离糖的水含糖量要高,也就是糖附近 ...

随机推荐

  1. soapui调用redis,获取短信验证码

    1.首先,调用redis需要引入redis的jar包,放入到soapui指定目录中,例如我的目录D:\Program Files\SmartBear\SoapUI-Pro-5.1.2\bin\ext ...

  2. Jenkins+Jmeter持续集成笔记(二:ANT执行Jmeter脚本)

    Jmeter接口测试脚本运行后生成的是jtl(xml)格式的文件,这些文件不具备可读性,所以我们要把他转化为可以阅读的html格式报告. Ant是一个功能强大的打包编译工具.我们使用他的目的是将xml ...

  3. 20190422 DW/BI系统

    其实很多人都不能理解操作型应用系统和分析型系统的意义,主要问题在于这两个系统所面对的用户和需求是不相同的. 建模重点“凡事应该简单,简单到不能再简单”

  4. IdentityServer4授权和认证集成Identity和profile

    identiyt的使用可以看之前的文章:https://www.cnblogs.com/nsky/p/10323415.html 之前的ids4授权服务器都是用的in-men方式把数据添加到内存, 现 ...

  5. git之摘抄

    vn中央集权, 统一服务器, 权限安全管理 git 分布式,代码仓库历史本地有,不受约束, 可以随意开分支.

  6. C# 调用C++的dll 那些事

    之前从来没搞过C++,最近被安排的任务需要调用C++的接口,对于一个没用过 Dependency 的小白来说,原本以为像平时的Http接口那样,协议,端口一定义,方法参数一写就没事,结果踩了无数的坑. ...

  7. fpga板制作调试过程记录

    2010-09-11 22:49:00 昨天淘宝准备买块fpga核心板学习,为了练习焊接,我让老板给我散料及pcb板自己焊接. 一,在物料到之前的准备: 我先设计了一下焊接测试计划 1,检查电路板:特 ...

  8. 记账本微信小程序开发六

    记账本微信小程序开发六 我的界面 主界面

  9. 《CSS世界》读书笔记(九)

    <!-- <CSS世界>张鑫旭著 --> content内容生成技术 1. content 辅助元素生成 清除浮动: .clear:after { content: ''; d ...

  10. MySQL中group by , sum , case when then 的使用

    在我们使用数据库的时候,可能会遇到需要进行统计的情况. 比如需要统计一下,下表中各个年份的胜负场数. 遇到这样的情况,我们应该怎么办呢? 在mysql中我们可以使用group by sum  case ...