From 7ba0efc60ca4411fb19309250010539a2df8b9a4 Mon Sep 17 00:00:00 2001 From: c9s Date: Tue, 20 May 2014 23:48:35 +0800 Subject: [PATCH] use doublecirlce for endpoint nodes --- config.h | 3 +++ config.h.in | 3 +++ configure.ac | 1 + include/r3_gvc.h | 1 - src/gvc.c | 10 ++++------ tests/bench_str.csv | 2 ++ 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/config.h b/config.h index 8e5c6a4..e766a43 100644 --- a/config.h +++ b/config.h @@ -1,6 +1,9 @@ /* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ +/* "whether graphviz is enable" */ +#define ENABLE_GRAPHVIZ test "x$enable_graphviz" = "xyes" + /* Define to 1 if you have the header file. */ #define HAVE_DLFCN_H 1 diff --git a/config.h.in b/config.h.in index 4aa7a2f..c74bb06 100644 --- a/config.h.in +++ b/config.h.in @@ -1,5 +1,8 @@ /* config.h.in. Generated from configure.ac by autoheader. */ +/* "whether graphviz is enable" */ +#undef ENABLE_GRAPHVIZ + /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H diff --git a/configure.ac b/configure.ac index 66a2beb..b6fd07b 100644 --- a/configure.ac +++ b/configure.ac @@ -45,6 +45,7 @@ AC_ARG_ENABLE(debug, AM_CONDITIONAL(ENABLE_DEBUG, test "x$enable_debug" = "xyes") AM_CONDITIONAL(ENABLE_GRAPHVIZ, test "x$enable_graphviz" = "xyes") +AC_DEFINE(ENABLE_GRAPHVIZ, test "x$enable_graphviz" = "xyes", "whether graphviz is enable") PKG_CHECK_MODULES(DEPS, [libpcre check]) diff --git a/include/r3_gvc.h b/include/r3_gvc.h index 012470d..e6ef6ea 100644 --- a/include/r3_gvc.h +++ b/include/r3_gvc.h @@ -4,7 +4,6 @@ * * Distributed under terms of the MIT license. */ - #ifndef R3_GVC_H #define R3_GVC_H diff --git a/src/gvc.c b/src/gvc.c index 5a9bcca..86ccb67 100644 --- a/src/gvc.c +++ b/src/gvc.c @@ -12,7 +12,7 @@ #include "r3_gvc.h" -char * node_id_str(int id) { +static char * node_id_str(int id) { char * name = malloc(sizeof(char) * 20); sprintf(name, "#%d", id); return name; @@ -30,12 +30,10 @@ void r3_tree_build_ag_nodes(Agraph_t * g, Agnode_t * ag_parent_node, node * n, i agn_child = agnode(g, node_id_str(node_cnt) , 1); agn_edge = agedge(g, ag_parent_node, agn_child, 0, 1); agsafeset(agn_edge, "label", e->pattern, ""); - + if (e->child && e->child->endpoint) { + agsafeset(agn_child, "shape", "doublecircle", ""); + } r3_tree_build_ag_nodes(g, agn_child, e->child, node_cnt); - - // agedgeattr(agn_edge, "label", e->pattern ); - // agattr(gr, AGEDGE, "style","invis"); - // agattr(agn_edge, AGEDGE, "label", "test"); } } diff --git a/tests/bench_str.csv b/tests/bench_str.csv index d2601b5..f42892a 100644 --- a/tests/bench_str.csv +++ b/tests/bench_str.csv @@ -391,3 +391,5 @@ 1400600045,13977543.80 1400600057,13901438.41 1400600326,14049707.03 +1400600677,13384789.38 +1400600754,13649118.34