Browse Source

Double-quote nodes in graphviz network file

This is needed for all nodes with a name starting with a digit,
otherwise the ID would be interpreted as a numeral.
Quentin Rameau 5 years ago
parent
commit
d22f4cb856
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/graph.c

+ 2 - 2
src/graph.c

@@ -360,13 +360,13 @@ void dump_graph(void) {
 	/* dump all nodes first */
 	for(node = node_tree->head; node; node = node->next) {
 		n = node->data;
-		fprintf(file, "	%s [label = \"%s\"];\n", n->name, n->name);
+		fprintf(file, "	\"%s\" [label = \"%s\"];\n", n->name, n->name);
 	}
 
 	/* now dump all edges */
 	for(node = edge_weight_tree->head; node; node = node->next) {
 		e = node->data;
-		fprintf(file, "	%s -> %s;\n", e->from->name, e->to->name);
+		fprintf(file, "	\"%s\" -> \"%s\";\n", e->from->name, e->to->name);
 	}
 
 	fprintf(file, "}\n");