【问题标题】:How to calculate degree of a node in an undirected graph如何计算无向图中节点的度数
【发布时间】:2021-05-28 16:51:10
【问题描述】:

在无向图中找到其邻居度数之和最高的节点

我不解决这个问题可能使用威尔士鲍威尔算法

【问题讨论】:

    标签: graph-theory


    【解决方案1】:
    highest_sum = -1;
    best_node = -1
    Loop over nodes
      sum = 0;
      Loop over neighbours of the node
         count links connected to neighbour and add to sum
      IF sum > highest_sum
          highest_sum = sum
          best_node = this node
    Print best_node
    

    【讨论】:

    • 先谢谢你了,我刚学的,你能用伪代码解释一下吗?
    • 你使用什么编码语言?
    • only pseudo code-> in an undirected graph 找到其邻居度数总和最高的节点设计算法原则上我不想要代码,我只是想理解.谢谢您的支持。 (时间复杂度为 n^2 ?
    • 你有什么不明白的?
    • 邻域度如何计算?
    猜你喜欢
    • 1970-01-01
    • 2014-04-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多