@@ -45,7 +45,8 @@ void ReactionDependencyGraph::populate_graph_with_priority_edges(const Reactor*
45
45
auto iterator = reactions.begin ();
46
46
auto next = std::next (iterator);
47
47
while (next != reactions.end ()) {
48
- graph.add_edge (vertex_map.at (*iterator), vertex_map.at (*next));
48
+ auto edge = graph.add_edge (vertex_map.at (*iterator), vertex_map.at (*next)).first ;
49
+ put (get_dependency_property_map (), edge, DependencyType::Priority);
49
50
iterator = next;
50
51
next = std::next (iterator);
51
52
}
@@ -64,7 +65,12 @@ void ReactionDependencyGraph::populate_graph_with_dependency_edges(const Reactor
64
65
source = source->inward_binding ();
65
66
}
66
67
for (auto * antidependency : source->antidependencies ()) {
67
- graph.add_edge (vertex_map.at (antidependency), vertex_map.at (reaction));
68
+ auto edge = graph.add_edge (vertex_map.at (antidependency), vertex_map.at (reaction)).first ;
69
+ if (reaction->port_triggers ().count (dependency) == 0 ) {
70
+ put (get_dependency_property_map (), edge, DependencyType::Effect);
71
+ } else {
72
+ put (get_dependency_property_map (), edge, DependencyType::Trigger);
73
+ }
68
74
}
69
75
}
70
76
}
@@ -114,6 +120,7 @@ auto ReactionDependencyGraph::transitive_reduction() -> ReactionDependencyGraph
114
120
115
121
void ReactionDependencyGraph::export_graphviz (const std::string& file_name) {
116
122
auto reaction_proprty_map = get_reaction_property_map ();
123
+ auto dependency_proprty_map = get_dependency_property_map ();
117
124
dynamic_properties dp;
118
125
dp.property (" node_id" , get (boost::vertex_index, graph));
119
126
dp.property (" label" , make_function_property_map<ReactionGraph::vertex_descriptor, std::string>(
@@ -136,6 +143,21 @@ void ReactionDependencyGraph::export_graphviz(const std::string& file_name) {
136
143
return ss.str ();
137
144
}));
138
145
dp.property (" style" , make_constant_property<ReactionGraph::vertex_descriptor, std::string>(" filled" ));
146
+ dp.property (" style" , make_function_property_map<ReactionGraph::edge_descriptor, std::string>(
147
+ [&dependency_proprty_map](ReactionGraph::edge_descriptor edge) {
148
+ auto dependency_type = boost::get (dependency_proprty_map, edge);
149
+ switch (dependency_type) {
150
+ case DependencyType::Undefined:
151
+ return " solid" ;
152
+ case DependencyType::Priority:
153
+ return " dotted" ;
154
+ case DependencyType::Effect:
155
+ return " dashed" ;
156
+ case DependencyType::Trigger:
157
+ return " bold" ;
158
+ }
159
+ return " invis" ;
160
+ }));
139
161
140
162
std::ofstream dot_file (file_name);
141
163
write_graphviz_dp (dot_file, graph, dp);
@@ -150,7 +172,11 @@ GroupedDependencyGraph::GroupedDependencyGraph(ReactionDependencyGraph& reaction
150
172
group.push_back (boost::get (reactionGraph.get_reaction_property_map (), in));
151
173
boost::put (get_group_property_map (), out, group);
152
174
vertex_map[group[0 ]] = out;
153
- }));
175
+ })
176
+ .edge_copy ([]([[maybe_unused]] ReactionDependencyGraph::ReactionGraph::edge_descriptor in,
177
+ [[maybe_unused]] GroupGraph::edge_descriptor out) {
178
+ // do nothing; simply drop the edge descriptors
179
+ }));
154
180
}
155
181
156
182
void GroupedDependencyGraph::export_graphviz (const std::string& file_name) {
0 commit comments