#pragma once #include #include #include #include #include class Graph { public: Graph(); explicit Graph(int n); Graph(int n, bool directed, bool weighted, char form); int size() const { return n; } bool isDirected() const { return directed; } bool isWeighted() const { return weighted; } char repr() const { return form; } void readGraph(std::string fileName); void writeGraph(std::string fileName); void addEdge(int from, int to, int weight); void removeEdge(int from, int to); int changeEdge(int from, int to, int newWeight); void transformToAdjList(); void transformToAdjMatrix(); void transformToListOfEdges(); Graph getSpaingTreePrima() const; Graph getSpaingTreeKruscal() const; Graph getSpaingTreeBoruvka() const; int checkEuler(bool& circleExist) const; std::vector getEuleranTourFleri() const; std::vector getEuleranTourEffective() const; int checkBipart(std::vector& marks) const; std::vector> getMaximumMatchingBipart() const; Graph flowFordFulkerson(int source, int sink) const; Graph flowDinitz(int source, int sink) const; private: int n = 0; bool directed = false; bool weighted = false; char form = 'C'; std::vector> matrix; std::vector>> adj; std::vector> edges; bool hasEdge(int from, int to) const; int weightOf(int from, int to) const; std::vector>> toAdjList() const; std::vector> toMatrix() const; std::vector> toEdgeList() const; std::vector> toSimpleAdj() const; };