



_lowercase						  =		{0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []}

_lowercase						  =		{0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]}



def 		lowerCAmelCase__    (					UpperCamelCase_				:       dict[int, list[int]] ,       UpperCamelCase_				:       int ,       UpperCamelCase_				:       list[bool]	)->  list[int]:
    A__		 =					True
    A__		 =					[]

    for neighbour in graph[vert]:
        if not visited[neighbour]:
            order += topology_sort(UpperCamelCase_ ,       UpperCamelCase_ ,       UpperCamelCase_	)

    order.append(UpperCamelCase_	)

    return order



def 		lowerCAmelCase__    (					UpperCamelCase_				:       dict[int, list[int]] ,       UpperCamelCase_				:       int ,       UpperCamelCase_				:       list[bool]	)->  list[int]:
    A__		 =					True
    A__		 =					[vert]

    for neighbour in reversed_graph[vert]:
        if not visited[neighbour]:
            component += find_components(UpperCamelCase_ ,       UpperCamelCase_ ,       UpperCamelCase_	)

    return component



def 		lowerCAmelCase__    (					UpperCamelCase_				:       dict[int, list[int]]	)->  list[list[int]]:
    A__		 =					len(UpperCamelCase_	) * [False]
    A__		 =					{vert: [] for vert in range(len(UpperCamelCase_	)	)}

    for vert, neighbours in graph.items():
        for neighbour in neighbours:
            reversed_graph[neighbour].append(UpperCamelCase_	)

    A__		 =					[]
    for i, was_visited in enumerate(UpperCamelCase_	):
        if not was_visited:
            order += topology_sort(UpperCamelCase_ ,       UpperCamelCase_ ,       UpperCamelCase_	)

    A__		 =					[]
    A__		 =					len(UpperCamelCase_	) * [False]

    for i in range(len(UpperCamelCase_	)	):
        A__		 =					order[len(UpperCamelCase_	) - i - 1]
        if not visited[vert]:
            A__		 =					find_components(UpperCamelCase_ ,       UpperCamelCase_ ,       UpperCamelCase_	)
            components_list.append(UpperCamelCase_	)

    return components_list





import numpy as np
from matplotlib import pyplot as plt
from sklearn.datasets import load_iris
from sklearn.metrics import ConfusionMatrixDisplay
from sklearn.model_selection import train_test_split
from xgboost import XGBClassifier



def 		lowerCAmelCase__    (					UpperCamelCase_				:       dict	)->  tuple:
    return (data["data"], data["target"])



def 		lowerCAmelCase__    (					UpperCamelCase_				:       np.ndarray ,       UpperCamelCase_				:       np.ndarray	)->  XGBClassifier:
    A__		 =					XGBClassifier()
    classifier.fit(UpperCamelCase_ ,       UpperCamelCase_	)
    return classifier



def 		lowerCAmelCase__    (					)->  None:
    A__		 =					load_iris()
    A__ ,	A__		 =					data_handling(UpperCamelCase_	)
    A__ ,	A__ ,	A__ ,	A__		 =					train_test_split(
        UpperCamelCase_ ,       UpperCamelCase_ ,       test_size=0.25	)

    A__		 =					iris['''target_names''']

    # Create an XGBoost Classifier from the training data
    A__		 =					xgboost(UpperCamelCase_ ,       UpperCamelCase_	)

    # Display the confusion matrix of the classifier with both training and test sets
    ConfusionMatrixDisplay.from_estimator(
        UpperCamelCase_ ,       UpperCamelCase_ ,       UpperCamelCase_ ,       display_labels=UpperCamelCase_ ,       cmap='''Blues''' ,       normalize='''true''' ,       )
    plt.title('''Normalized Confusion Matrix - IRIS Dataset'''	)
    plt.show()


if __name__ == "__main__":
   import doctest

   doctest.testmod(verbose=True)
   main()
