本文整理汇总了Python中matching.max_cardinality_matching函数的典型用法代码示例。如果您正苦于以下问题:Python max_cardinality_matching函数的具体用法?Python max_cardinality_matching怎么用?Python max_cardinality_matching使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了max_cardinality_matching函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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) )
开发者ID:AlexanderSoloviev,项目名称:mv-matching,代码行数:7,代码来源:test_matching_compound.py
示例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) )
开发者ID:AlexanderSoloviev,项目名称:mv-matching,代码行数:7,代码来源:test_matching_compound.py
示例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) )
开发者ID:AlexanderSoloviev,项目名称:mv-matching,代码行数:7,代码来源:test_matching_compound.py
示例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) )
开发者ID:AlexanderSoloviev,项目名称:mv-matching,代码行数:7,代码来源:test_matching_compound.py
示例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) )
开发者ID:mskmoorthy,项目名称:mv-matching,代码行数:7,代码来源:test_matching_simple.py
示例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) )
开发者ID:mskmoorthy,项目名称:mv-matching,代码行数:7,代码来源:test_matching_simple.py
示例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) )
开发者ID:mskmoorthy,项目名称:mv-matching,代码行数:7,代码来源:test_matching_simple.py
示例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))
开发者ID:AlexanderSoloviev,项目名称:mv-matching,代码行数:7,代码来源:test_matching_random.py
示例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) )
开发者ID:mskmoorthy,项目名称:mv-matching,代码行数:7,代码来源:test_matching_simple.py
示例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) )
开发者ID:mskmoorthy,项目名称:mv-matching,代码行数:7,代码来源:test_matching_simple.py
示例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) )
开发者ID:mskmoorthy,项目名称:mv-matching,代码行数:7,代码来源:test_matching_simple.py
示例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) )
开发者ID:mskmoorthy,项目名称:mv-matching,代码行数:7,代码来源:test_matching_simple.py
示例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) )
开发者ID:mskmoorthy,项目名称:mv-matching,代码行数:7,代码来源:test_matching_simple.py
示例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) )
开发者ID:mskmoorthy,项目名称:mv-matching,代码行数:7,代码来源:test_matching_simple.py
示例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) )
开发者ID:mskmoorthy,项目名称:mv-matching,代码行数:7,代码来源:test_matching_simple.py
示例16: test035_dense_gnm_random_graph
def test035_dense_gnm_random_graph(self):
""" Larger random graph picked from set of all graphs
with n nodes and m edges. """
g = nx.dense_gnm_random_graph(300, 10000)
mate1 = mv.max_cardinality_matching(g)
mate2 = nx.max_weight_matching(g, True)
self.assertEqual(len(mate1), len(mate2))
开发者ID:AlexanderSoloviev,项目名称:mv-matching,代码行数:7,代码来源:test_matching_random.py
示例17: test142_doublebloom
def test142_doublebloom(self):
""" Two blooms, connected together by one edge. """
g = nx.Graph()
g.add_edges_from([(0,1),(1,2),(2,3),(3,4),(4,0),(3,6),(6,7),(7,8),(8,9),(9,10),(10,6)])
mate1 = mv.max_cardinality_matching( g )
mate2 = nx.max_weight_matching( g, True )
td.showGraph(g, mate1, "test142_doublebloom")
self.assertEqual( len(mate1), len(mate2) )
开发者ID:mskmoorthy,项目名称:mv-matching,代码行数:8,代码来源:test_matching_simple.py
示例18: test220_fruchtgraph
def test220_fruchtgraph(self):
""" Frucht graph, smallest cubical graph. """
g = nx.frucht_graph()
mate1 = mv.max_cardinality_matching( g )
mate2 = nx.max_weight_matching( g, True )
td.showGraph(g, mate1, "test220_fruchtgraph")
td.showGraph(g, mate2, "test220_fruchtgraph_edmonds")
self.assertEqual( len(mate1), len(mate2) )
开发者ID:mskmoorthy,项目名称:mv-matching,代码行数:8,代码来源:test_matching_simple.py
示例19: test149_doublebloom
def test149_doublebloom(self):
""" Two blooms, one embedded, connected at their centers. """
g = nx.Graph()
g.add_edges_from([(0,1),(1,2),(2,3),(4,6),(4,1),(3,4),(4,0),(3,7),(7,8),(8,9),(9,10),(10,3)])
mate1 = mv.max_cardinality_matching( g )
mate2 = nx.max_weight_matching( g, True )
td.showGraph(g, mate1, "test149_doublebloom")
self.assertEqual( len(mate1), len(mate2) )
开发者ID:mskmoorthy,项目名称:mv-matching,代码行数:8,代码来源:test_matching_simple.py
示例20: test145_doublebloom
def test145_doublebloom(self):
""" Two blooms, with three vertices, connected by one edge. """
g = nx.Graph()
g.add_edges_from([(0,1),(1,2),(2,0),(2,3),(3,4),(4,5),(5,3),(4,6),(6,7),(7,8),(8,6)])
mate1 = mv.max_cardinality_matching( g )
mate2 = nx.max_weight_matching( g, True )
td.showGraph(g, mate1, "test145_doublebloom")
self.assertEqual( len(mate1), len(mate2) )
开发者ID:mskmoorthy,项目名称:mv-matching,代码行数:8,代码来源:test_matching_simple.py
注:本文中的matching.max_cardinality_matching函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论