本文整理汇总了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})
示例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})