Skip to content
Snippets Groups Projects
Commit 4ef672d7 authored by dawehr's avatar dawehr
Browse files

Missed files from last commit. Adds ability to print or not print output values on DOT graph.

parent 887f7807
No related branches found
No related tags found
No related merge requests found
......@@ -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");
}
}
}
......
......@@ -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__
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