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

fix: valid syntax in the export to graphviz

parent d1bc79c7
No related branches found
No related tags found
No related merge requests found
Pipeline #9282 passed with stage
......@@ -234,6 +234,7 @@ void ComputeAbstractPaths(const string& net_file, int bound,
auto paths_time = GetTime() - start_paths_time;
cout << " done\nTime for computing observable paths: " << paths_time
<< " seconds\n";
sog.ExportGraphToDotFile("./sog.dot");
// add abstract paths
cout << "\nComputing abstract paths ...";
......
......@@ -90,7 +90,7 @@ void SOG::PrintGraph(Aggregate *state, size_t counter) {
void SOG::ExportGraphToDotFile(const std::string &filename) const {
// Open file for writing
std::ofstream file(filename + ".dot");
std::ofstream file(filename);
// Check if the file opened successfully
if (!file.is_open()) {
......@@ -101,16 +101,19 @@ void SOG::ExportGraphToDotFile(const std::string &filename) const {
std::cout << "the graph contains: " << nb_states << " states\n";
file << "digraph reachab_graph {" << '\n';
// Add the initial node (start point)
file << " start [shape=point, width=0];\n\n";
file << " start -> ag_" << initial_state->state.id() << ";\n";
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';
file << " ag_" << aggr->state.id() << " -> "
<< "ag_" << edge.state->state.id() << " [ label = \"t"
<< edge.transition + 1 << "\"];" << '\n';
}
}
file << "ag_" << initial_state->state.id() << "[initialstate]\n";
file << " }\n";
file << "}\n";
file.close();
}
......
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