知识卡片

普通读书笔记卡 · 3645.i.2

权重矩阵用无穷表示缺边

理解等级:中级
  • 权重矩阵 W 的对角元素为0;
  • 有向边(i,j)的元素是其边权;
  • 不存在该边则为∞。

这样初始化既含零边自达,也避免把缺边误当零权边。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《算法导论(第4版)》第23章《所有结点对的最短路径》(OEBPS/chapter023.xhtml,文本字符[0,5000))。 - 结论依据:原文以邻接矩阵作为输入;Art_P679给出三种元素取值。 - 原始内容:For convenience, we assume that the vertices are numbered 1, 2, … , | V |, so that the input is an n × n matrix W = ( w ij ) representing the edge weights of an n -vertex directed graph G = ( V , E ), where - 公式图核读:`_epub-src/OEBPS/images/Art_P679.jpg`:wᵢⱼ=0(i=j);若 i≠j 且 (i,j)∈E,则为该边权重;若 i≠j 且 (i,j)∉E,则为 ∞。