neighbors
图节点的相邻节点
说明
示例
输入参数
输出参数
N
— 相邻节点
节点索引 | 节点名称
相邻节点 ID,如果 nodeID
是数值则以节点索引形式返回;如果 nodeID
是节点名称则以节点名称形式返回。通过一条边连接到自身的节点(自环)只作为其自身的相邻节点列出一次。
扩展功能
C/C++ 代码生成
使用 MATLAB® Coder™ 生成 C 代码和 C++ 代码。
用法说明和限制:
节点标识符
nodeID
必须为输入图G
的标量节点索引。不支持节点名称。
版本历史记录
在 R2015b 中推出R2018a: 自环计数变化
neighbors
对自环只进行一次计数。在以前的版本中,如果节点 u
有自环,则 neighbors(g,u)
会在输出中将 u
列出两次。现在,neighbors(g,u)
只返回 u
的一个实例。
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)