当前位置: 首页>>代码示例>>Python>>正文


Python networkx.is_simple_path函数代码示例

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


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

示例1: test_trivial_nonpath

    def test_trivial_nonpath(self):
        """Tests that a list whose sole element is an object not in the
        graph is not considered a simple path.

        """
        G = nx.trivial_graph()
        assert_false(nx.is_simple_path(G, ['not a node']))
开发者ID:iaciac,项目名称:networkx,代码行数:7,代码来源:test_simple_paths.py

示例2: test_trivial_path

    def test_trivial_path(self):
        """Tests that the trivial path, a path of length one, is
        considered a simple path in a graph.

        """
        G = nx.trivial_graph()
        assert_true(nx.is_simple_path(G, [0]))
开发者ID:iaciac,项目名称:networkx,代码行数:7,代码来源:test_simple_paths.py

示例3: test_empty_list

    def test_empty_list(self):
        """Tests that the empty list is not a valid path, since there
        should be a one-to-one correspondence between paths as lists of
        nodes and paths as lists of edges.

        """
        G = nx.trivial_graph()
        assert_false(nx.is_simple_path(G, []))
开发者ID:iaciac,项目名称:networkx,代码行数:8,代码来源:test_simple_paths.py

示例4: test_multidigraph

 def test_multidigraph(self):
     G = nx.MultiDiGraph([(0, 1), (0, 1), (1, 0), (1, 0)])
     assert_true(nx.is_simple_path(G, [0, 1]))
开发者ID:iaciac,项目名称:networkx,代码行数:3,代码来源:test_simple_paths.py

示例5: test_directed_cycle

 def test_directed_cycle(self):
     G = nx.DiGraph([(0, 1), (1, 2), (2, 0)])
     assert_false(nx.is_simple_path(G, [0, 1, 2, 0]))
开发者ID:iaciac,项目名称:networkx,代码行数:3,代码来源:test_simple_paths.py

示例6: test_directed_non_path

 def test_directed_non_path(self):
     G = nx.DiGraph([(0, 1), (1, 2)])
     assert_false(nx.is_simple_path(G, [2, 1, 0]))
开发者ID:iaciac,项目名称:networkx,代码行数:3,代码来源:test_simple_paths.py

示例7: test_directed_path

 def test_directed_path(self):
     G = nx.DiGraph([(0, 1), (1, 2)])
     assert_true(nx.is_simple_path(G, [0, 1, 2]))
开发者ID:iaciac,项目名称:networkx,代码行数:3,代码来源:test_simple_paths.py

示例8: test_missing_node

 def test_missing_node(self):
     G = nx.path_graph(2)
     assert_false(nx.is_simple_path(G, [0, 2]))
开发者ID:iaciac,项目名称:networkx,代码行数:3,代码来源:test_simple_paths.py

示例9: test_cycle

 def test_cycle(self):
     G = nx.cycle_graph(3)
     assert_false(nx.is_simple_path(G, [0, 1, 2, 0]))
开发者ID:iaciac,项目名称:networkx,代码行数:3,代码来源:test_simple_paths.py

示例10: test_non_simple_path

 def test_non_simple_path(self):
     G = nx.path_graph(2)
     assert_false(nx.is_simple_path(G, [0, 1, 0]))
开发者ID:iaciac,项目名称:networkx,代码行数:3,代码来源:test_simple_paths.py

示例11: test_simple_path

 def test_simple_path(self):
     G = nx.path_graph(2)
     assert_true(nx.is_simple_path(G, [0, 1]))
开发者ID:iaciac,项目名称:networkx,代码行数:3,代码来源:test_simple_paths.py


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