incidence
图关联矩阵
说明
示例
图关联矩阵
使用边列表创建一个图,然后计算图关联矩阵。
s = [1 1 1 1 1]; t = [2 3 4 5 6]; G = graph(s,t); I = incidence(G)
I = (1,1) -1 (2,1) 1 (1,2) -1 (3,2) 1 (1,3) -1 (4,3) 1 (1,4) -1 (5,4) 1 (1,5) -1 (6,5) 1
I
中的每一列包含两个非零项,指示 G
中单条边的端节点。
计算图拉普拉斯矩阵 L
,并确认无向图的关系 L = I*I'
。
L = laplacian(G); L - I*I'
ans = All zero sparse: 6x6
有向图的关联矩阵
使用边列表创建一个有向图,然后计算关联矩阵。
s = [1 2 1 3 2 3 3 3]; t = [2 1 3 1 3 4 5 6]; G = digraph(s,t)
G = digraph with properties: Edges: [8x1 table] Nodes: [6x0 table]
I = incidence(G)
I = (1,1) -1 (2,1) 1 (1,2) -1 (3,2) 1 (1,3) 1 (2,3) -1 (2,4) -1 (3,4) 1 (1,5) 1 (3,5) -1 (3,6) -1 (4,6) 1 (3,7) -1 (5,7) 1 (3,8) -1 (6,8) 1
I
中的每一列表示 G
中单条边的源和目标节点。
输入参数
输出参量
I
— 关联矩阵
稀疏矩阵
关联矩阵,以稀疏矩阵形式返回。I
的大小为 numnodes(G)
×numedges(G)
。对于具有自环的图,未定义图关联矩阵。
提示
incidence
函数计算关联矩阵的簇,通常称为有符号或有向关联矩阵的簇。无向图I
的有符号关联矩阵与图拉普拉斯矩阵L
的关系为L == I*I'
。
扩展功能
基于线程的环境
使用 MATLAB® backgroundPool
在后台运行代码或使用 Parallel Computing Toolbox™ ThreadPool
加快代码运行速度。
版本历史记录
在 R2015b 中推出
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)