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


Python networkx.graph_number_of_cliques方法代码示例

本文整理汇总了Python中networkx.graph_number_of_cliques方法的典型用法代码示例。如果您正苦于以下问题:Python networkx.graph_number_of_cliques方法的具体用法?Python networkx.graph_number_of_cliques怎么用?Python networkx.graph_number_of_cliques使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在networkx的用法示例。


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

示例1: test_number_of_cliques

# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import graph_number_of_cliques [as 别名]
def test_number_of_cliques(self):
        G = self.G
        assert_equal(nx.graph_number_of_cliques(G), 5)
        assert_equal(nx.graph_number_of_cliques(G, cliques=self.cl), 5)
        assert_equal(nx.number_of_cliques(G, 1), 1)
        assert_equal(list(nx.number_of_cliques(G, [1]).values()), [1])
        assert_equal(list(nx.number_of_cliques(G, [1, 2]).values()), [1, 2])
        assert_equal(nx.number_of_cliques(G, [1, 2]), {1: 1, 2: 2})
        assert_equal(nx.number_of_cliques(G, 2), 2)
        assert_equal(nx.number_of_cliques(G),
                     {1: 1, 2: 2, 3: 1, 4: 2, 5: 1,
                      6: 2, 7: 1, 8: 1, 9: 1, 10: 1, 11: 1})
        assert_equal(nx.number_of_cliques(G, nodes=G.nodes()),
                     {1: 1, 2: 2, 3: 1, 4: 2, 5: 1,
                      6: 2, 7: 1, 8: 1, 9: 1, 10: 1, 11: 1})
        assert_equal(nx.number_of_cliques(G, nodes=[2, 3, 4]),
                     {2: 2, 3: 1, 4: 2})
        assert_equal(nx.number_of_cliques(G, cliques=self.cl),
                     {1: 1, 2: 2, 3: 1, 4: 2, 5: 1,
                      6: 2, 7: 1, 8: 1, 9: 1, 10: 1, 11: 1})
        assert_equal(nx.number_of_cliques(G, G.nodes(), cliques=self.cl),
                     {1: 1, 2: 2, 3: 1, 4: 2, 5: 1,
                      6: 2, 7: 1, 8: 1, 9: 1, 10: 1, 11: 1}) 
开发者ID:SpaceGroupUCL,项目名称:qgisSpaceSyntaxToolkit,代码行数:25,代码来源:test_clique.py

示例2: test_number_of_cliques

# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import graph_number_of_cliques [as 别名]
def test_number_of_cliques(self):
        G = self.G
        assert_equal(nx.graph_number_of_cliques(G), 5)
        assert_equal(nx.graph_number_of_cliques(G, cliques=self.cl), 5)
        assert_equal(nx.number_of_cliques(G, 1), 1)
        assert_equal(list(nx.number_of_cliques(G, [1]).values()), [1])
        assert_equal(list(nx.number_of_cliques(G, [1, 2]).values()), [1, 2])
        assert_equal(nx.number_of_cliques(G, [1, 2]), {1: 1, 2: 2})
        assert_equal(nx.number_of_cliques(G, 2), 2)
        assert_equal(nx.number_of_cliques(G),
                     {1: 1, 2: 2, 3: 1, 4: 2, 5: 1,
                      6: 2, 7: 1, 8: 1, 9: 1, 10: 1, 11: 1})
        assert_equal(nx.number_of_cliques(G, nodes=list(G)),
                     {1: 1, 2: 2, 3: 1, 4: 2, 5: 1,
                      6: 2, 7: 1, 8: 1, 9: 1, 10: 1, 11: 1})
        assert_equal(nx.number_of_cliques(G, nodes=[2, 3, 4]),
                     {2: 2, 3: 1, 4: 2})
        assert_equal(nx.number_of_cliques(G, cliques=self.cl),
                     {1: 1, 2: 2, 3: 1, 4: 2, 5: 1,
                      6: 2, 7: 1, 8: 1, 9: 1, 10: 1, 11: 1})
        assert_equal(nx.number_of_cliques(G, list(G), cliques=self.cl),
                     {1: 1, 2: 2, 3: 1, 4: 2, 5: 1,
                      6: 2, 7: 1, 8: 1, 9: 1, 10: 1, 11: 1}) 
开发者ID:holzschu,项目名称:Carnets,代码行数:25,代码来源:test_clique.py


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