小编use*_*212的帖子

图吞吐量算法

我的任务是计算图表中的最大吞吐量。

描述图形的最简单方法是int[][]。内部数组是图中的节点,外部数组是连接图中每个节点的距离,例如:

new int[][] {
    {0, 5, 0, 0}, // node 0 (the "source")
    {0, 0, 4, 0}, // node 1
    {0, 0, 0, 8}, // node 2
    {0, 0, 0, 0}  // node 3 (the "destination")
}
Run Code Online (Sandbox Code Playgroud)

因此,要从node 0(源)到node 3(目标),“最大吞吐量”将是每圈 4,因为:

  • 5 个数据包可以从节点 0 到节点 1
  • 4 个数据包可以从节点 1 到节点 2
  • 8 个数据包可以从节点 2 到节点 3

在“每转”的基础上,瓶颈在node 1和之间node 2,其中最大吞吐量为 4。

可有人点我会解决这个“最大吞吐量”问题,以这种方式定义的任何给定的图形算法int[][],并给出sourcedestination节点?

示例图将使用多个“源”和“目的地”进行扩展,我将需要在任何给定的“转弯”上计算整个系统的最大吞吐量。

我很感激以学习算法或“伪代码”的形式提供的帮助。

algorithm graph max throughput data-structures

5
推荐指数
1
解决办法
758
查看次数

标签 统计

algorithm ×1

data-structures ×1

graph ×1

max ×1

throughput ×1