30 size_t vertexAndEdgeCount;
37 std::vector<std::vector<int>> adjacencyMatrix;
42 static constexpr size_t ESTIMATE_MULTIPLIER = 10;
58 auto maxCliqueHelper(
size_t currentVertex,
59 std::vector<size_t>& currentClique,
60 std::vector<std::vector<size_t>>& maxCliques,
62 size_t executionLimit,
auto adjacencyFunction)
const
73 [[nodiscard]]
auto totalConnections(
const std::vector<size_t>& clique)
const
84 [[nodiscard]]
auto edgeCount(
const std::vector<size_t>& clique)
const
94 Graph() : vertexCount{0}, vertexAndEdgeCount{0} {}
102 explicit Graph(
const std::vector<std::vector<int>>&& adjacencyMatrix);
113 explicit Graph(std::istream& graphStream);
123 explicit Graph(std::istream&& graphStream) :
Graph{graphStream} {}
139 [[nodiscard]]
static auto fromFilename(
const std::string& filename)
159 [[nodiscard]]
auto toDotLang() const -> std::
string;
168 [[nodiscard]] auto operator[](
size_t row) const -> std::vector<
int>;
179 friend auto operator<<(std::ostream& outputStream, const
Graph& graph)
190 friend auto operator==(const
Graph& lhs, const
Graph& rhs) ->
bool;
199 [[nodiscard]] auto
getSize() const ->
size_t;
243 -> std::vector<
size_t>;
255 -> std::vector<
size_t>;
289 [[nodiscard]] auto
subGraph(std::vector<
size_t>& vertices) const ->
Graph;
Class that represents a graph as a matrix (vector of vectors) of adjacencies.
Definition: graph.hpp:18
Graph(std::istream &&graphStream)
constructs graph from data in a stream
Definition: graph.hpp:123
auto getSize() const -> size_t
Returns graph size.
Definition: graph.cpp:61
auto maxClique(AlgorithmAccuracy accuracy=AlgorithmAccuracy::EXACT) const -> std::vector< size_t >
Finds the maximum clique of the graph using Bron-Kerbosch algorithm.
Definition: graph.cpp:210
auto toDotLang() const -> std::string
returns string in DOT language
Definition: graph.cpp:65
auto subGraph(std::vector< size_t > &vertices) const -> Graph
Gives the induced subgraph given by the vertices.
Definition: graph.cpp:345
auto modifiedMaxClique(AlgorithmAccuracy accuracy=AlgorithmAccuracy::EXACT) const -> std::vector< size_t >
modidfied max clique algorithm for finding maximum induced subgraphs.
Definition: graph.cpp:228
static auto fromFilename(const std::string &filename) -> Graph
constructs graph from data in specified filename
Definition: graph.cpp:83
auto maxSubgraph(const Graph &rhs, AlgorithmAccuracy accuracy=AlgorithmAccuracy::EXACT) -> Graph
Returns maximum induced subgraph of two graphs.
Definition: graph.cpp:287
auto modularProduct(const Graph &rhs) -> Graph
Returns modular product of two graphs.
Definition: graph.cpp:165
auto maxCliqueGraph(AlgorithmAccuracy accuracy) const -> Graph
Graph of max clique.
Definition: graph.cpp:361
auto getVertexCount() const -> size_t
Return vertex count.
Definition: graph.hpp:146
auto metricDistanceTo(const Graph &rhs, AlgorithmAccuracy accuracy=AlgorithmAccuracy::EXACT) const -> size_t
Returns distance to another graph.
Definition: graph.cpp:153
Graph()
Default constructor.
Definition: graph.hpp:94
AlgorithmAccuracy
Little enum for choosing between approximate and exact algorithms.
Definition: graph.hpp:12