def test_graph() -> object:
    test_graph = g.Graph()
    file_name = "test_graph.txt"
    test_graph.importFromFile(file_name=file_name)
    print(test_graph.graph)
    draw.plotGraph(test_graph.exportEdgesDict())
    coloring1 = c.ColorGraph(test_graph)
    coloring1.greedyColoring()
    coloring1.countColors()
    print(file_name, "Number of colors greedy: ", coloring1.numberOfUsedColor)
    coloring2 = c.ColorGraph(test_graph)
    coloring2.tabuColoring(maxIterations=80, singleIterations=80, debug=True)
    coloring2.countColors()
    print(file_name, "Number of colors: ", coloring2.numberOfUsedColor)
def test40Tabu():
    test_graph = g.Graph(40, 0.4)
    test_graph.generate()
    file_name = "mTabu40.txt"
    test_graph.exportToFile(file_name)
    draw.plotGraph(test_graph.exportEdgesDict())
    print("Graph: ", test_graph.graph)
    coloring = c.ColorGraph(test_graph)
    coloring.greedyColoring()
    coloring.countColors()
    print(file_name, "Number of colors greedy: ", coloring.numberOfUsedColor)
    coloring = c.ColorGraph(test_graph)
    coloring.tabuColoring(maxIterations=20, singleIterations=50, debug=True)
    coloring.countColors()
    print(file_name, "Number of colors: ", coloring.numberOfUsedColor)
def graphLE450Greedy():
    test_graph = g.Graph()
    file_name = "le450_5a.txt"
    test_graph.importFromFile(file_name)
    coloring = c.ColorGraph(test_graph)
    coloring.greedyColoring(showSteps=False)
    print(file_name, "Number of colors: ", coloring.numberOfUsedColor)
def graphGC500Greedy():
    test_graph = g.Graph()
    file_name = "gc500.txt"
    test_graph.importFromFile(file_name)
    coloring = c.ColorGraph(test_graph)
    coloring.greedyColoring(showSteps=False)
    print(file_name, "Number of colors: ", coloring.numberOfUsedColor)
    print(file_name, "Colors ", coloring.colorOfVertex)
def greedyImproved():
    test_graph = g.Graph()
    file_name = "gc500.txt"
    test_graph.importFromFile(file_name)

    coloring = c.ColorGraph(test_graph)
    coloring.greedyImproved()
    print(file_name, "Number of colors: ", coloring.numberOfUsedColor)
    print(file_name, "Number of colors: ", coloring.colorOfVertex)
def coloring():
    test_graph = g.Graph(15, 0.30)  # initialize graph with 8 vertex
    test_graph.generate()  # generate random graph
    edgesDict = test_graph.exportEdgesDict()  # export for visualisation
    draw.plotGraph(edgesDict)  # draw graph
    coloring = c.ColorGraph(test_graph)  # initialize graph coloring object which take test_graph
    coloring.greedyColoring(showSteps=True)  # greedy coloring of taken graph
    print("Colored vertex: ", coloring.colorOfVertex)
    print("Number of colors: ", coloring.numberOfUsedColor)
def gc1000Tabu():
    test_graph = g.Graph()
    file_name = "gc1000_300013.txt"
    test_graph.importFromFile(file_name)
    #draw.plotGraph(test_graph.exportEdgesDict())
    coloring = c.ColorGraph(test_graph)
    coloring.tabuColoring(maxIterations=500, singleIterations=500, debug=False)
    coloring.countColors()
    print(file_name, "Number of colors: ", coloring.numberOfUsedColor)
    print(file_name, "Colors: ", coloring.colorOfVertex)
def testTabu():
    test_graph = g.Graph()
    file_name = "greedy5tabu4.txt"
    test_graph.importFromFile(file_name)
    #draw.plotGraph(test_graph.exportEdgesDict())
    print("Graph: ", test_graph.graph)
    coloring = c.ColorGraph(test_graph)
    coloring.tabuColoring(maxIterations=40, singleIterations=50, debug=True)
    coloring.countColors()
    print(file_name, "Number of colors: ", coloring.numberOfUsedColor)
    print(file_name, "Number of colors: ", coloring.colorOfVertex)
def machowiakGreedy():
    test_graph = g.Graph()
    file_name = "machowiakInstance.txt"
    test_graph.importFromFile(file_name)
    edgesDict = test_graph.exportEdgesDict()
    draw.plotGraph(edgesDict)
    print("Graph: ", test_graph.graph)
    coloring = c.ColorGraph(test_graph)
    coloring.greedyColoring()
    print(file_name, "Number of colors: ", coloring.numberOfUsedColor)
    print(file_name, "Number of colors: ", coloring.colorOfVertex)