本文整理汇总了Python中matching.max_cardinality_matching函数的典型用法代码示例。如果您正苦于以下问题:Python max_cardinality_matching函数的具体用法?Python max_cardinality_matching怎么用?Python max_cardinality_matching使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了max_cardinality_matching函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test180_tutte_cage_graph
def test180_tutte_cage_graph(self):
""" Tutte 12-cage graph. """
g = nx.LCF_graph(126, [17, 27, -13, -59, -35, 35, -11, 13, -53\
, 53, -27, 21, 57, 11, -21, -57, 59, -17], 7)
mate1 = mv.max_cardinality_matching( g )
mate2 = nx.max_weight_matching( g, True )
self.assertEqual( len(mate1), len(mate2) )
示例2: test142_utility_graph
def test142_utility_graph(self):
""" Larger utility graph from LCF notation. """
g = nx.LCF_graph(60, [3, -3], 3)
mate1 = mv.max_cardinality_matching( g )
mate2 = nx.max_weight_matching( g, True )
td.showGraph(g, mate1, "test142_utility_graph")
self.assertEqual( len(mate1), len(mate2) )
示例3: test025_barbell_graph
def test025_barbell_graph(self):
""" Very small barbell graph. """
g = nx.barbell_graph(9, 2)
mate2 = nx.max_weight_matching( g, True )
td.showGraph(g, mate2, "test025_barbell_graph_edmonds")
mate1 = mv.max_cardinality_matching( g )
self.assertEqual( len(mate1), len(mate2) )
示例4: test103_lollipop_graph
def test103_lollipop_graph(self):
""" Large lollipop graph. """
g = nx.lollipop_graph(17, 11)
mate1 = mv.max_cardinality_matching( g )
mate2 = nx.max_weight_matching( g, True )
td.showGraph(g, mate1, "test103_lollipop_graph")
self.assertEqual( len(mate1), len(mate2) )
示例5: test200_icosahedralgraph
def test200_icosahedralgraph(self):
""" Icosahedral graph. """
g = nx.icosahedral_graph()
mate1 = mv.max_cardinality_matching( g )
mate2 = nx.max_weight_matching( g, True )
#td.showGraph(g, mate1, "test200_icosahedralgraph")
self.assertEqual( len(mate1), len(mate2) )
示例6: test090_singlebloom
def test090_singlebloom(self):
""" Single bloom, two edge extensions, case 1. """
g = nx.Graph()
g.add_edges_from([(0,1),(1,2),(2,3),(3,4),(4,5),(5,1),(3,6)])
mate1 = mv.max_cardinality_matching( g )
mate2 = nx.max_weight_matching( g, True )
self.assertEqual( len(mate1), len(mate2) )
示例7: test030_twoedges
def test030_twoedges(self):
""" Two edges. """
g = nx.Graph()
g.add_edges_from([(0,1),(1,2)])
mate1 = mv.max_cardinality_matching( g )
mate2 = nx.max_weight_matching( g, True )
self.assertEqual( len(mate1), len(mate2) )
示例8: test083_barabasi_albert_graph
def test083_barabasi_albert_graph(self):
""" Random graph using Barabasi-Albert preferential
attachment model. """
g = nx.barabasi_albert_graph(100, 5)
mate1 = mv.max_cardinality_matching(g)
mate2 = nx.max_weight_matching(g, True)
self.assertEqual(len(mate1), len(mate2))
示例9: test040_threeedges
def test040_threeedges(self):
""" Three edges, linear. """
g = nx.Graph()
g.add_edges_from([(0,1),(1,2),(2,3)])
mate1 = mv.max_cardinality_matching( g )
mate2 = nx.max_weight_matching( g, True )
self.assertEqual( len(mate1), len(mate2) )
示例10: test170_bullgraph
def test170_bullgraph(self):
""" Bull graph. """
g = nx.bull_graph()
mate1 = mv.max_cardinality_matching( g )
mate2 = nx.max_weight_matching( g, True )
#td.showGraph(g, mate1, "test170_bullgraph")
self.assertEqual( len(mate1), len(mate2) )
示例11: test190_octahedralgraph
def test190_octahedralgraph(self):
""" Octahedral graph. """
g = nx.octahedral_graph()
mate1 = mv.max_cardinality_matching( g )
mate2 = nx.max_weight_matching( g, True )
td.showGraph(g, mate1, "test190_octahedralgraph")
self.assertEqual( len(mate1), len(mate2) )
示例12: test050_linear
def test050_linear(self):
""" Multiple edges, linear. """
g = nx.Graph()
g.add_edges_from([(0,1),(1,2),(2,3),(3,4),(4,5),(5,6)])
mate1 = mv.max_cardinality_matching( g )
mate2 = nx.max_weight_matching( g, True )
self.assertEqual( len(mate1), len(mate2) )
示例13: test160_petersengraph
def test160_petersengraph(self):
""" Petersen graph. """
g = nx.petersen_graph()
mate1 = mv.max_cardinality_matching( g )
mate2 = nx.max_weight_matching( g, True )
td.showGraph(g, mate1, "test160_petersengraph")
self.assertEqual( len(mate1), len(mate2) )
示例14: test070_circle
def test070_circle(self):
""" Multiple edges, circle of even length. """
g = nx.Graph()
g.add_edges_from([(0,1),(1,2),(2,3),(3,4),(4,5),(5,0)])
mate1 = mv.max_cardinality_matching( g )
mate2 = nx.max_weight_matching( g, True )
self.assertEqual( len(mate1), len(mate2) )
示例15: test020_singleedge
def test020_singleedge(self):
""" Single edge. """
g = nx.Graph()
g.add_edge(0,1)
mate1 = mv.max_cardinality_matching( g )
mate2 = nx.max_weight_matching( g, True )
self.assertEqual( len(mate1), len(mate2) )