Skip to content
Snippets Groups Projects
Commit 5a26bbc0 authored by Jaime Arias's avatar Jaime Arias
Browse files

refactor: ExportGraphToDotFile

parent c12aa8a1
No related branches found
No related tags found
No related merge requests found
Pipeline #9267 failed with stage
......@@ -3,6 +3,7 @@
#include <fstream>
// Table with the BDD nodes of the graph
bdd *bdd_tab;
void SOG::set_initial_state(Aggregate *state) {
......@@ -85,9 +86,9 @@ void SOG::PrintGraph(Aggregate *state, size_t counter) {
}
}
void SOG::GenerateReachabilityGraphDotfile(const std::string &filename) const {
void SOG::ExportGraphToDotFile(const std::string &filename) const {
// Open file for writing
std::ofstream file("./result/" + filename + ".dot");
std::ofstream file(filename + ".dot");
// Check if the file opened successfully
if (!file.is_open()) {
......@@ -95,12 +96,12 @@ void SOG::GenerateReachabilityGraphDotfile(const std::string &filename) const {
return;
}
std::cout << "le graph contient : " << states.size() << '\n';
std::cout << "the graph contains: " << nb_states << ' states\n';
file << "digraph reachab_graph {" << '\n';
for (const auto *GONode : states) {
for (const auto &edge : GONode->successors) {
file << "ag_" << GONode->state.id() << " -> "
for (const auto *aggr : states) {
for (const auto &edge : aggr->successors) {
file << "ag_" << aggr->state.id() << " -> "
<< "ag_" << edge.state->state.id() << " [ label = \"t"
<< edge.transition + 1 << "\"]" << '\n';
}
......
......@@ -110,10 +110,10 @@ class SOG {
void PrintGraph(Aggregate *state, size_t counter);
/**
* Print reachability graph using graphviz notation
* @param filename
* Export graph to graphviz file
* @param filename the name of the file
*/
void GenerateReachabilityGraphDotfile(const std::string &filename) const;
void ExportGraphToDotFile(const std::string &filename) const;
};
#endif // SOG_H_
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment