diff --git a/quad/computation_graph/src/computation_graph.c b/quad/computation_graph/src/computation_graph.c index caf7a593c7010a39b8d62e648c6c961ac37c30f6..412c1d49e436b8093639a0e4b5d1147c2ead5ce8 100644 --- a/quad/computation_graph/src/computation_graph.c +++ b/quad/computation_graph/src/computation_graph.c @@ -193,7 +193,7 @@ void graph_compute_nodes(struct computation_graph *graph, int* node_ids, int n_n } } -int export_dot(const struct computation_graph* graph, FILE* of) { +int export_dot(const struct computation_graph* graph, FILE* of, int print_outputs) { fprintf(of, "digraph G {\n"); // Header fprintf(of, "rankdir=\"LR\"\n"); // Horizontal layout @@ -221,7 +221,11 @@ int export_dot(const struct computation_graph* graph, FILE* of) { struct graph_node* src_node = &graph->nodes[input_id]; int output_id = node->input_srcs[j].controller_output; const char* output_name = src_node->type->output_names[output_id]; - fprintf(of, "\"%s\" -> \"%s\":f%d [label=\"%s=%.3f\"]\n", src_node->name, node->name, j+1, output_name, src_node->output_values[output_id]); + fprintf(of, "\"%s\" -> \"%s\":f%d", src_node->name, node->name, j+1); + if (print_outputs) { + fprintf(of, " [label=\"%s=%.3f\"]", output_name, src_node->output_values[output_id]); + } + fprintf(of, "\n"); } } } diff --git a/quad/computation_graph/src/computation_graph.h b/quad/computation_graph/src/computation_graph.h index 946ffa67d20ef1b73f335babeea9752f6b1b9959..5b38d252f95db85b2556044ed965bc250c703a8b 100644 --- a/quad/computation_graph/src/computation_graph.h +++ b/quad/computation_graph/src/computation_graph.h @@ -105,6 +105,6 @@ void graph_compute_nodes(struct computation_graph *graph, int* node_ids, int n_n /* * Writes a graphical representation of the given graph to <of> in the DOT language */ -int export_dot(const struct computation_graph* graph, FILE* of); +int export_dot(const struct computation_graph* graph, FILE* of, int print_outputs); #endif // __COMPUTATION_GRAPH_H__