本文整理汇总了Python中Graph.graphAlea方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.graphAlea方法的具体用法?Python Graph.graphAlea怎么用?Python Graph.graphAlea使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph
的用法示例。
在下文中一共展示了Graph.graphAlea方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: moyenne50
# 需要导入模块: import Graph [as 别名]
# 或者: from Graph import graphAlea [as 别名]
def moyenne50(n,p,algo) :
if algo == 0:
print("algoNaif")
elif algo == 1 :
print("algoDSATUR")
elif algo == 2 :
print("algoWelshPowel")
temps = []
couleurs = []
for i in range(50) :
graph = g.graphAlea(n,5,p)
if algo == 0 :
start_time = time.time()
graph.algoNaif()
elif algo == 1 :
start_time = time.time()
graph.algoDSATUR()
elif algo == 2 :
start_time = time.time()
graph.algoWelshPowel()
interval = time.time() - start_time
temps.append(interval)
couleurs.append(graph.totalColor())
sommeT = sum(temps)
sommeC = sum(couleurs)
return (float(sommeT)/50.,float(sommeC)/50)
示例2: testalgoWelshPowel
# 需要导入模块: import Graph [as 别名]
# 或者: from Graph import graphAlea [as 别名]
import Graph as g
import matplotlib.pyplot as plt
import time
import numpy as np
graph = g.graphAlea(5, 5, 0.5)
def testalgoWelshPowel() :
graph.algoWelshPowel()
print(graph)
def testalgoDSATUR() :
graph.algoDSATUR()
print(graph)
def testalgoNaif() :
graph.algoNaif()
print(graph)
def moyenne50(n,p,algo) :
if algo == 0:
print("algoNaif")
elif algo == 1 :
print("algoDSATUR")
elif algo == 2 :
print("algoWelshPowel")
temps = []
couleurs = []
for i in range(50) :