• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python networkx.goldberg_radzik函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中networkx.goldberg_radzik函数的典型用法代码示例。如果您正苦于以下问题:Python goldberg_radzik函数的具体用法?Python goldberg_radzik怎么用?Python goldberg_radzik使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了goldberg_radzik函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_others

    def test_others(self):
        (P, D) = nx.bellman_ford(self.XG, 's')
        assert_equal(P['v'], 'u')
        assert_equal(D['v'], 9)
        (P, D) = nx.goldberg_radzik(self.XG, 's')
        assert_equal(P['v'], 'u')
        assert_equal(D['v'], 9)

        G = nx.path_graph(4)
        assert_equal(nx.bellman_ford(G, 0),
                     ({0: None, 1: 0, 2: 1, 3: 2}, {0: 0, 1: 1, 2: 2, 3: 3}))
        assert_equal(nx.goldberg_radzik(G, 0),
                     ({0: None, 1: 0, 2: 1, 3: 2}, {0: 0, 1: 1, 2: 2, 3: 3}))
        assert_equal(nx.bellman_ford(G, 3),
                     ({0: 1, 1: 2, 2: 3, 3: None}, {0: 3, 1: 2, 2: 1, 3: 0}))
        assert_equal(nx.goldberg_radzik(G, 3),
                     ({0: 1, 1: 2, 2: 3, 3: None}, {0: 3, 1: 2, 2: 1, 3: 0}))

        G = nx.grid_2d_graph(2, 2)
        pred, dist = nx.bellman_ford(G, (0, 0))
        assert_equal(sorted(pred.items()),
                     [((0, 0), None), ((0, 1), (0, 0)),
                      ((1, 0), (0, 0)), ((1, 1), (0, 1))])
        assert_equal(sorted(dist.items()),
                     [((0, 0), 0), ((0, 1), 1), ((1, 0), 1), ((1, 1), 2)])
        pred, dist = nx.goldberg_radzik(G, (0, 0))
        assert_equal(sorted(pred.items()),
                     [((0, 0), None), ((0, 1), (0, 0)),
                      ((1, 0), (0, 0)), ((1, 1), (0, 1))])
        assert_equal(sorted(dist.items()),
                     [((0, 0), 0), ((0, 1), 1), ((1, 0), 1), ((1, 1), 2)])
开发者ID:666888,项目名称:networkx,代码行数:31,代码来源:test_weighted.py


示例2: test_multigraph

 def test_multigraph(self):
     assert_equal(nx.bellman_ford_path(self.MXG, 's', 'v'), ['s', 'x', 'u', 'v'])
     assert_equal(nx.bellman_ford_path_length(self.MXG, 's', 'v'), 9)
     assert_equal(nx.single_source_bellman_ford_path(self.MXG, 's')['v'], ['s', 'x', 'u', 'v'])
     assert_equal(nx.single_source_bellman_ford_path_length(self.MXG, 's')['v'], 9)
     D, P = nx.single_source_bellman_ford(self.MXG, 's', target='v')
     assert_equal(D, 9)
     assert_equal(P, ['s', 'x', 'u', 'v'])
     P, D = nx.bellman_ford_predecessor_and_distance(self.MXG, 's')
     assert_equal(P['v'], ['u'])
     assert_equal(D['v'], 9)
     P, D = nx.goldberg_radzik(self.MXG, 's')
     assert_equal(P['v'], 'u')
     assert_equal(D['v'], 9)
     assert_equal(nx.bellman_ford_path(self.MXG4, 0, 2), [0, 1, 2])
     assert_equal(nx.bellman_ford_path_length(self.MXG4, 0, 2), 4)
     assert_equal(nx.single_source_bellman_ford_path(self.MXG4, 0)[2], [0, 1, 2])
     assert_equal(nx.single_source_bellman_ford_path_length(self.MXG4, 0)[2], 4)
     D, P = nx.single_source_bellman_ford(self.MXG4, 0, target=2)
     assert_equal(D, 4)
     assert_equal(P, [0, 1, 2])
     P, D = nx.bellman_ford_predecessor_and_distance(self.MXG4, 0)
     assert_equal(P[2], [1])
     assert_equal(D[2], 4)
     P, D = nx.goldberg_radzik(self.MXG4, 0)
     assert_equal(P[2], 1)
     assert_equal(D[2], 4)
开发者ID:networkx,项目名称:networkx,代码行数:27,代码来源:test_weighted.py


示例3: test_others

    def test_others(self):
        assert_equal(nx.bellman_ford_path(self.XG, 's', 'v'), ['s', 'x', 'u', 'v'])
        assert_equal(nx.bellman_ford_path_length(self.XG, 's', 'v'), 9)
        assert_equal(nx.single_source_bellman_ford_path(self.XG, 's')['v'], ['s', 'x', 'u', 'v'])
        assert_equal(dict(nx.single_source_bellman_ford_path_length(self.XG, 's'))['v'], 9)
        D, P = nx.single_source_bellman_ford(self.XG, 's', target='v')
        assert_equal(D['v'], 9)
        assert_equal(P['v'], ['s', 'x', 'u', 'v'])
        (P, D) = nx.bellman_ford_predecessor_and_distance(self.XG, 's')
        assert_equal(P['v'], ['u'])
        assert_equal(D['v'], 9)
        (P, D) = nx.goldberg_radzik(self.XG, 's')
        assert_equal(P['v'], 'u')
        assert_equal(D['v'], 9)

        G = nx.path_graph(4)
        assert_equal(nx.single_source_bellman_ford_path(G, 0),
                     {0: [0], 1: [0, 1], 2: [0, 1, 2], 3: [0, 1, 2, 3]})
        assert_equal(dict(nx.single_source_bellman_ford_path_length(G, 0)),
                     {0: 0, 1: 1, 2: 2, 3: 3})
        assert_equal(nx.single_source_bellman_ford(G, 0),
                     ({0: 0, 1: 1, 2: 2, 3: 3}, {0: [0], 1: [0, 1], 2: [0, 1, 2], 3: [0, 1, 2, 3]}))
        assert_equal(nx.bellman_ford_predecessor_and_distance(G, 0),
                     ({0: [None], 1: [0], 2: [1], 3: [2]}, {0: 0, 1: 1, 2: 2, 3: 3}))
        assert_equal(nx.goldberg_radzik(G, 0),
                     ({0: None, 1: 0, 2: 1, 3: 2}, {0: 0, 1: 1, 2: 2, 3: 3}))
        assert_equal(nx.single_source_bellman_ford_path(G, 3),
                     {0: [3, 2, 1, 0], 1: [3, 2, 1], 2: [3, 2], 3: [3]})
        assert_equal(dict(nx.single_source_bellman_ford_path_length(G, 3)),
                     {0: 3, 1: 2, 2: 1, 3: 0})
        assert_equal(nx.single_source_bellman_ford(G, 3),
                     ({0: 3, 1: 2, 2: 1, 3: 0}, {0: [3, 2, 1, 0], 1: [3, 2, 1], 2: [3, 2], 3: [3]}))
        assert_equal(nx.bellman_ford_predecessor_and_distance(G, 3),
                     ({0: [1], 1: [2], 2: [3], 3: [None]}, {0: 3, 1: 2, 2: 1, 3: 0}))
        assert_equal(nx.goldberg_radzik(G, 3),
                     ({0: 1, 1: 2, 2: 3, 3: None}, {0: 3, 1: 2, 2: 1, 3: 0}))

        G = nx.grid_2d_graph(2, 2)
        dist, path = nx.single_source_bellman_ford(G, (0, 0))
        assert_equal(sorted(dist.items()),
                     [((0, 0), 0), ((0, 1), 1), ((1, 0), 1), ((1, 1), 2)])
        assert_equal(sorted(path.items()),
                     [((0, 0), [(0, 0)]), ((0, 1), [(0, 0), (0, 1)]),
                      ((1, 0), [(0, 0), (1, 0)]),  ((1, 1), [(0, 0), (0, 1), (1, 1)])])
        pred, dist = nx.bellman_ford_predecessor_and_distance(G, (0, 0))
        assert_equal(sorted(pred.items()),
                     [((0, 0), [None]), ((0, 1), [(0, 0)]),
                      ((1, 0), [(0, 0)]), ((1, 1), [(0, 1), (1, 0)])])
        assert_equal(sorted(dist.items()),
                     [((0, 0), 0), ((0, 1), 1), ((1, 0), 1), ((1, 1), 2)])
        pred, dist = nx.goldberg_radzik(G, (0, 0))
        assert_equal(sorted(pred.items()),
                     [((0, 0), None), ((0, 1), (0, 0)),
                      ((1, 0), (0, 0)), ((1, 1), (0, 1))])
        assert_equal(sorted(dist.items()),
                     [((0, 0), 0), ((0, 1), 1), ((1, 0), 1), ((1, 1), 2)])
开发者ID:AllenDowney,项目名称:networkx,代码行数:56,代码来源:test_weighted.py


示例4: test_multigraph

 def test_multigraph(self):
     P, D = nx.bellman_ford(self.MXG, 's')
     assert_equal(P['v'], 'u')
     assert_equal(D['v'], 9)
     P, D = nx.goldberg_radzik(self.MXG, 's')
     assert_equal(P['v'], 'u')
     assert_equal(D['v'], 9)
     P, D = nx.bellman_ford(self.MXG4, 0)
     assert_equal(P[2], 1)
     assert_equal(D[2], 4)
     P, D = nx.goldberg_radzik(self.MXG4, 0)
     assert_equal(P[2], 1)
     assert_equal(D[2], 4)
开发者ID:666888,项目名称:networkx,代码行数:13,代码来源:test_weighted.py


示例5: test_single_node_graph

 def test_single_node_graph(self):
     G = nx.DiGraph()
     G.add_node(0)
     assert_equal(nx.bellman_ford(G, 0), ({0: None}, {0: 0}))
     assert_equal(nx.goldberg_radzik(G, 0), ({0: None}, {0: 0}))
     assert_raises(KeyError, nx.bellman_ford, G, 1)
     assert_raises(KeyError, nx.goldberg_radzik, G, 1)
开发者ID:666888,项目名称:networkx,代码行数:7,代码来源:test_weighted.py


示例6: test_single_node_graph

 def test_single_node_graph(self):
     G = nx.DiGraph()
     G.add_node(0)
     assert_equal(nx.single_source_bellman_ford_path(G, 0), {0: [0]})
     assert_equal(nx.single_source_bellman_ford_path_length(G, 0), {0: 0})
     assert_equal(nx.single_source_bellman_ford(G, 0), ({0: 0}, {0: [0]}))
     assert_equal(nx.bellman_ford_predecessor_and_distance(G, 0), ({0: []}, {0: 0}))
     assert_equal(nx.goldberg_radzik(G, 0), ({0: None}, {0: 0}))
开发者ID:networkx,项目名称:networkx,代码行数:8,代码来源:test_weighted.py


示例7: test_path_graph

 def test_path_graph(self):
     G = nx.path_graph(4)
     assert_equal(nx.single_source_bellman_ford_path(G, 0),
                  {0: [0], 1: [0, 1], 2: [0, 1, 2], 3: [0, 1, 2, 3]})
     assert_equal(nx.single_source_bellman_ford_path_length(G, 0),
                  {0: 0, 1: 1, 2: 2, 3: 3})
     assert_equal(nx.single_source_bellman_ford(G, 0),
                  ({0: 0, 1: 1, 2: 2, 3: 3}, {0: [0], 1: [0, 1], 2: [0, 1, 2], 3: [0, 1, 2, 3]}))
     assert_equal(nx.bellman_ford_predecessor_and_distance(G, 0),
                  ({0: [], 1: [0], 2: [1], 3: [2]}, {0: 0, 1: 1, 2: 2, 3: 3}))
     assert_equal(nx.goldberg_radzik(G, 0),
                  ({0: None, 1: 0, 2: 1, 3: 2}, {0: 0, 1: 1, 2: 2, 3: 3}))
     assert_equal(nx.single_source_bellman_ford_path(G, 3),
                  {0: [3, 2, 1, 0], 1: [3, 2, 1], 2: [3, 2], 3: [3]})
     assert_equal(nx.single_source_bellman_ford_path_length(G, 3),
                  {0: 3, 1: 2, 2: 1, 3: 0})
     assert_equal(nx.single_source_bellman_ford(G, 3),
                  ({0: 3, 1: 2, 2: 1, 3: 0}, {0: [3, 2, 1, 0], 1: [3, 2, 1], 2: [3, 2], 3: [3]}))
     assert_equal(nx.bellman_ford_predecessor_and_distance(G, 3),
                  ({0: [1], 1: [2], 2: [3], 3: []}, {0: 3, 1: 2, 2: 1, 3: 0}))
     assert_equal(nx.goldberg_radzik(G, 3),
                  ({0: 1, 1: 2, 2: 3, 3: None}, {0: 3, 1: 2, 2: 1, 3: 0}))
开发者ID:networkx,项目名称:networkx,代码行数:22,代码来源:test_weighted.py


示例8: test_others

 def test_others(self):
     assert_equal(nx.bellman_ford_path(self.XG, 's', 'v'), ['s', 'x', 'u', 'v'])
     assert_equal(nx.bellman_ford_path_length(self.XG, 's', 'v'), 9)
     assert_equal(nx.single_source_bellman_ford_path(self.XG, 's')['v'], ['s', 'x', 'u', 'v'])
     assert_equal(nx.single_source_bellman_ford_path_length(self.XG, 's')['v'], 9)
     D, P = nx.single_source_bellman_ford(self.XG, 's', target='v')
     assert_equal(D, 9)
     assert_equal(P, ['s', 'x', 'u', 'v'])
     (P, D) = nx.bellman_ford_predecessor_and_distance(self.XG, 's')
     assert_equal(P['v'], ['u'])
     assert_equal(D['v'], 9)
     (P, D) = nx.goldberg_radzik(self.XG, 's')
     assert_equal(P['v'], 'u')
     assert_equal(D['v'], 9)
开发者ID:networkx,项目名称:networkx,代码行数:14,代码来源:test_weighted.py


示例9: test_not_connected

    def test_not_connected(self):
        G = nx.complete_graph(6)
        G.add_edge(10, 11)
        G.add_edge(10, 12)
        assert_equal(nx.bellman_ford(G, 0),
                     ({0: None, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0},
                      {0: 0, 1: 1, 2: 1, 3: 1, 4: 1, 5: 1}))
        assert_equal(nx.goldberg_radzik(G, 0),
                     ({0: None, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0},
                      {0: 0, 1: 1, 2: 1, 3: 1, 4: 1, 5: 1}))

        # not connected, with a component not containing the source that
        # contains a negative cost cycle.
        G = nx.complete_graph(6)
        G.add_edges_from([('A', 'B', {'load': 3}),
                          ('B', 'C', {'load': -10}),
                          ('C', 'A', {'load': 2})])
        assert_equal(nx.bellman_ford(G, 0, weight='load'),
                     ({0: None, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0},
                      {0: 0, 1: 1, 2: 1, 3: 1, 4: 1, 5: 1}))
        assert_equal(nx.goldberg_radzik(G, 0, weight='load'),
                     ({0: None, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0},
                      {0: 0, 1: 1, 2: 1, 3: 1, 4: 1, 5: 1}))
开发者ID:666888,项目名称:networkx,代码行数:23,代码来源:test_weighted.py


示例10: test_not_connected

    def test_not_connected(self):
        G = nx.complete_graph(6)
        G.add_edge(10, 11)
        G.add_edge(10, 12)
        assert_equal(nx.single_source_bellman_ford_path(G, 0),
                     {0: [0], 1: [0, 1], 2: [0, 2], 3: [0, 3], 4: [0, 4], 5: [0, 5]})
        assert_equal(nx.single_source_bellman_ford_path_length(G, 0),
                     {0: 0, 1: 1, 2: 1, 3: 1, 4: 1, 5: 1})
        assert_equal(nx.single_source_bellman_ford(G, 0),
                     ({0: 0, 1: 1, 2: 1, 3: 1, 4: 1, 5: 1},
                      {0: [0], 1: [0, 1], 2: [0, 2], 3: [0, 3], 4: [0, 4], 5: [0, 5]}))
        assert_equal(nx.bellman_ford_predecessor_and_distance(G, 0),
                     ({0: [], 1: [0], 2: [0], 3: [0], 4: [0], 5: [0]},
                      {0: 0, 1: 1, 2: 1, 3: 1, 4: 1, 5: 1}))
        assert_equal(nx.goldberg_radzik(G, 0),
                     ({0: None, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0},
                      {0: 0, 1: 1, 2: 1, 3: 1, 4: 1, 5: 1}))

        # not connected, with a component not containing the source that
        # contains a negative cost cycle.
        G = nx.complete_graph(6)
        G.add_edges_from([('A', 'B', {'load': 3}),
                          ('B', 'C', {'load': -10}),
                          ('C', 'A', {'load': 2})])
        assert_equal(nx.single_source_bellman_ford_path(G, 0, weight='load'),
                     {0: [0], 1: [0, 1], 2: [0, 2], 3: [0, 3], 4: [0, 4], 5: [0, 5]})
        assert_equal(nx.single_source_bellman_ford_path_length(G, 0, weight='load'),
                     {0: 0, 1: 1, 2: 1, 3: 1, 4: 1, 5: 1})
        assert_equal(nx.single_source_bellman_ford(G, 0, weight='load'),
                     ({0: 0, 1: 1, 2: 1, 3: 1, 4: 1, 5: 1},
                      {0: [0], 1: [0, 1], 2: [0, 2], 3: [0, 3], 4: [0, 4], 5: [0, 5]}))
        assert_equal(nx.bellman_ford_predecessor_and_distance(G, 0, weight='load'),
                     ({0: [], 1: [0], 2: [0], 3: [0], 4: [0], 5: [0]},
                      {0: 0, 1: 1, 2: 1, 3: 1, 4: 1, 5: 1}))
        assert_equal(nx.goldberg_radzik(G, 0, weight='load'),
                     ({0: None, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0},
                      {0: 0, 1: 1, 2: 1, 3: 1, 4: 1, 5: 1}))
开发者ID:networkx,项目名称:networkx,代码行数:37,代码来源:test_weighted.py


示例11: test_negative_weight_cycle

 def test_negative_weight_cycle(self):
     G = nx.cycle_graph(5, create_using=nx.DiGraph())
     G.add_edge(1, 2, weight=-7)
     for i in range(5):
         assert_raises(nx.NetworkXUnbounded, nx.single_source_bellman_ford_path, G, i)
         assert_raises(nx.NetworkXUnbounded, nx.single_source_bellman_ford_path_length, G, i)
         assert_raises(nx.NetworkXUnbounded, nx.single_source_bellman_ford, G, i)
         assert_raises(nx.NetworkXUnbounded, nx.bellman_ford_predecessor_and_distance, G, i)
         assert_raises(nx.NetworkXUnbounded, nx.goldberg_radzik, G, i)
     G = nx.cycle_graph(5)  # undirected Graph
     G.add_edge(1, 2, weight=-3)
     for i in range(5):
         assert_raises(nx.NetworkXUnbounded, nx.single_source_bellman_ford_path, G, i)
         assert_raises(nx.NetworkXUnbounded, nx.single_source_bellman_ford_path_length, G, i)
         assert_raises(nx.NetworkXUnbounded, nx.single_source_bellman_ford, G, i)
         assert_raises(nx.NetworkXUnbounded, nx.bellman_ford_predecessor_and_distance, G, i)
         assert_raises(nx.NetworkXUnbounded, nx.goldberg_radzik, G, i)
     G = nx.DiGraph([(1, 1, {'weight': -1})])
     assert_raises(nx.NetworkXUnbounded, nx.single_source_bellman_ford_path, G, 1)
     assert_raises(nx.NetworkXUnbounded, nx.single_source_bellman_ford_path_length, G, 1)
     assert_raises(nx.NetworkXUnbounded, nx.single_source_bellman_ford, G, 1)
     assert_raises(nx.NetworkXUnbounded, nx.bellman_ford_predecessor_and_distance, G, 1)
     assert_raises(nx.NetworkXUnbounded, nx.goldberg_radzik, G, 1)
     # no negative cycle but negative weight
     G = nx.cycle_graph(5, create_using=nx.DiGraph())
     G.add_edge(1, 2, weight=-3)
     assert_equal(nx.single_source_bellman_ford_path(G, 0),
                  {0: [0], 1: [0, 1], 2: [0, 1, 2], 3: [0, 1, 2, 3], 4: [0, 1, 2, 3, 4]})
     assert_equal(nx.single_source_bellman_ford_path_length(G, 0),
                  {0: 0, 1: 1, 2: -2, 3: -1, 4: 0})
     assert_equal(nx.single_source_bellman_ford(G, 0),
                  ({0: 0, 1: 1, 2: -2, 3: -1, 4: 0},
                   {0: [0], 1: [0, 1], 2: [0, 1, 2], 3: [0, 1, 2, 3], 4: [0, 1, 2, 3, 4]}))
     assert_equal(nx.bellman_ford_predecessor_and_distance(G, 0),
                  ({0: [], 1: [0], 2: [1], 3: [2], 4: [3]},
                   {0: 0, 1: 1, 2: -2, 3: -1, 4: 0}))
     assert_equal(nx.goldberg_radzik(G, 0),
                  ({0: None, 1: 0, 2: 1, 3: 2, 4: 3},
                   {0: 0, 1: 1, 2: -2, 3: -1, 4: 0}))
开发者ID:networkx,项目名称:networkx,代码行数:39,代码来源:test_weighted.py


示例12: test_4_cycle

    def test_4_cycle(self):
        # 4-cycle
        G = nx.Graph([(0, 1), (1, 2), (2, 3), (3, 0)])
        dist, path = nx.single_source_bellman_ford(G, 0)
        assert_equal(dist, {0: 0, 1: 1, 2: 2, 3: 1})
        assert_equal(path[0], [0])
        assert_equal(path[1], [0, 1])
        assert_true(path[2] in [[0, 1, 2], [0, 3, 2]])
        assert_equal(path[3], [0, 3])

        pred, dist = nx.bellman_ford_predecessor_and_distance(G, 0)
        assert_equal(pred[0], [])
        assert_equal(pred[1], [0])
        assert_true(pred[2] in [[1, 3], [3, 1]])
        assert_equal(pred[3], [0])
        assert_equal(dist, {0: 0, 1: 1, 2: 2, 3: 1})

        pred, dist = nx.goldberg_radzik(G, 0)
        assert_equal(pred[0], None)
        assert_equal(pred[1], 0)
        assert_true(pred[2] in [1, 3])
        assert_equal(pred[3], 0)
        assert_equal(dist, {0: 0, 1: 1, 2: 2, 3: 1})
开发者ID:networkx,项目名称:networkx,代码行数:23,代码来源:test_weighted.py


示例13: test_negative_weight_cycle

 def test_negative_weight_cycle(self):
     G = nx.cycle_graph(5, create_using=nx.DiGraph())
     G.add_edge(1, 2, weight=-7)
     for i in range(5):
         assert_raises(nx.NetworkXUnbounded, nx.bellman_ford, G, i)
         assert_raises(nx.NetworkXUnbounded, nx.goldberg_radzik, G, i)
     G = nx.cycle_graph(5)  # undirected Graph
     G.add_edge(1, 2, weight=-3)
     for i in range(5):
         assert_raises(nx.NetworkXUnbounded, nx.bellman_ford, G, i)
         assert_raises(nx.NetworkXUnbounded, nx.goldberg_radzik, G, i)
     G = nx.DiGraph([(1, 1, {'weight': -1})])
     assert_raises(nx.NetworkXUnbounded, nx.bellman_ford, G, 1)
     assert_raises(nx.NetworkXUnbounded, nx.goldberg_radzik, G, 1)
     # no negative cycle but negative weight
     G = nx.cycle_graph(5, create_using=nx.DiGraph())
     G.add_edge(1, 2, weight=-3)
     assert_equal(nx.bellman_ford(G, 0),
                  ({0: None, 1: 0, 2: 1, 3: 2, 4: 3},
                   {0: 0, 1: 1, 2: -2, 3: -1, 4: 0}))
     assert_equal(nx.goldberg_radzik(G, 0),
                  ({0: None, 1: 0, 2: 1, 3: 2, 4: 3},
                   {0: 0, 1: 1, 2: -2, 3: -1, 4: 0}))
开发者ID:666888,项目名称:networkx,代码行数:23,代码来源:test_weighted.py


示例14: test_absent_source_goldberg_radzik

 def test_absent_source_goldberg_radzik(self):
     G = nx.path_graph(2)
     nx.goldberg_radzik(G, 3, 0)
开发者ID:networkx,项目名称:networkx,代码行数:3,代码来源:test_weighted.py



注:本文中的networkx.goldberg_radzik函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python networkx.graphviz_layout函数代码示例发布时间:2022-05-27
下一篇:
Python networkx.gnp_random_graph函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap