From 6f84b0e9c819cb41f3a29bf09ebf3899748ca73a Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 23 Mar 2005 18:40:03 +0000 Subject: [PATCH] Compile the GraphViz reader separately, for sanity's sake [SVN r27783] --- build/Jamfile | 5 +- doc/index.html | 2 +- doc/read_graphviz.html | 56 +++--- doc/read_graphviz.rst | 38 ++-- .../graph/detail/read_graphviz_spirit.hpp | 169 +++-------------- include/boost/graph/graphviz.hpp | 172 +++++++++++++++++- src/Makefile | 9 +- src/graphviz_digraph_lex.cpp | 1 + src/graphviz_digraph_parser.cpp | 1 + src/graphviz_graph_lex.cpp | 1 + src/graphviz_graph_parser.cpp | 1 + test/Jamfile | 2 +- test/graphviz_test.cpp | 5 + 13 files changed, 262 insertions(+), 200 deletions(-) diff --git a/build/Jamfile b/build/Jamfile index e2ec5ae1..bd72193d 100644 --- a/build/Jamfile +++ b/build/Jamfile @@ -1,7 +1,9 @@ subproject libs/graph/build ; SOURCES = graphviz_graph_lex graphviz_digraph_lex - graphviz_graph_parser graphviz_digraph_parser ; + graphviz_graph_parser graphviz_digraph_parser + read_graphviz_spirit + ; GRAPHVIZ_DEFS(graphviz_graph_lex) = GRAPHVIZ_DIRECTED=0 @@ -35,6 +37,7 @@ GRAPHVIZ_DEFS(graphviz_digraph_parser) = : ../src/$(SOURCES).cpp : $(BOOST_ROOT) YY_NO_UNISTD_H : debug on #inlining prevents linker name clashes due to truncation! + off # Debugging symbols become HUGE ; } diff --git a/doc/index.html b/doc/index.html index 30c4014c..125331f1 100644 --- a/doc/index.html +++ b/doc/index.html @@ -63,7 +63,7 @@ download from here.

How to Build the BGL

DON'T! The Boost Graph Library is a header-only library and does not need to be built to be used. The only exception is the GraphViz input parser.

+href="read_graphviz.html">GraphViz input parser.

When compiling programs that use the BGL, be sure to compile with optimization. For instance, select "Release" mode with diff --git a/doc/read_graphviz.html b/doc/read_graphviz.html index c2470cf8..7c0f0efc 100644 --- a/doc/read_graphviz.html +++ b/doc/read_graphviz.html @@ -12,11 +12,14 @@

 template <typename MutableGraph>
 bool read_graphviz(std::istream& in, MutableGraph& graph,
-                   dynamic_properties& dp);
+                   dynamic_properties& dp, 
+                   const std::string& node_id = "node_id");
 
+// Only available if BOOST_GRAPH_READ_GRAPHVIZ_ITERATORS is defined
 template <typename MultiPassIterator, typename MutableGraph>
 bool read_graphviz(MultiPassIterator begin, MultiPassIterator end,
-                   MutableGraph& graph, dynamic_properties& dp);
+                   MutableGraph& graph, dynamic_properties& dp, 
+                   const std::string& node_id = "node_id");
 
 // Deprecated GraphViz readers
 void read_graphviz(const std::string& file, GraphvizDigraph& g);
@@ -27,7 +30,11 @@ void read_graphviz(FILE* file, GraphvizGraph& g);
 

The read_graphviz function interprets a graph described using the GraphViz DOT language and builds a BGL graph that captures that description. Using this function, you can initialize a graph using -data stored as text.

+data stored as text. To use the iterator version of read_graphviz, +you will need to define the macro BOOST_GRAPH_READ_GRAPHVIZ_ITERATORS +before including the header <boost/graph/graphviz.hpp>. Doing so +may greatly increase the amount of time required to compile the +GraphViz reader.

The DOT language can specify both directed and undirected graphs, and read_graphviz differentiates between the two. One must pass read_graphviz an undirected graph when reading an undirected graph; @@ -39,8 +46,7 @@ takes a read_graphviz stores node identifier names under the -property key "node_id". The deprecated reading functions do not -support properties.

+vertex property map named node_id.

Requirements:
    @@ -56,10 +62,11 @@ concept.
    @@ -113,28 +120,21 @@ type is passed to read_graph b graph is undirected, as indicated by the graph keyword in the DOT language.

    -
    -

    Using the Deprecated GraphViz Readers

    +
    +

    Building the GraphViz Readers

    +

    To use the GraphViz readers, you will need to build and link against +the "bgl-viz" library. The library can be built by following the +Boost Jam Build Instructions for the subdirectory libs/graph/build.

    +
    +
    +

    Deprecated Readers

    The deprecated readers do not provide exceptions on error (they abort), they require the use of one of the predefined graph types (GraphvizDigraph or GraphvizGraph), and they do not support arbitrary properties. They will be removed in a future Boost version.

    -

    To use the deprecated GraphViz readers, you will need to build and -link against the "bgl-viz" library. The library can be built in two -ways:

    -
    -
      -
    1. Follow the Boost Jam Build Instructions for the subdirectory -libs/graph/build.
    2. -
    3. In the directory libs/graph/src, use the provided Makefile -(for Unix-like systems).
    4. -
    -
    -

    Alternatively, you can just include the source files in -libs/graph/src in your project or makefile.

    -

    Notes

    +

    Notes

    • The read_graphviz function does not use any code from the @@ -166,11 +166,11 @@ that property map value types are default constructible.
    -

    Future Work

    +

    Future Work

    • Currently the parser relies upon lowercase language keywords @@ -186,7 +186,7 @@ identifier(so-called "ID" in the source) is required to support this.<
    diff --git a/doc/read_graphviz.rst b/doc/read_graphviz.rst index 172c4509..0f825f58 100644 --- a/doc/read_graphviz.rst +++ b/doc/read_graphviz.rst @@ -12,11 +12,14 @@ __ ../../../index.htm template bool read_graphviz(std::istream& in, MutableGraph& graph, - dynamic_properties& dp); + dynamic_properties& dp, + const std::string& node_id = "node_id"); + // Only available if BOOST_GRAPH_READ_GRAPHVIZ_ITERATORS is defined template bool read_graphviz(MultiPassIterator begin, MultiPassIterator end, - MutableGraph& graph, dynamic_properties& dp); + MutableGraph& graph, dynamic_properties& dp, + const std::string& node_id = "node_id"); // Deprecated GraphViz readers void read_graphviz(const std::string& file, GraphvizDigraph& g); @@ -28,7 +31,11 @@ __ ../../../index.htm The ``read_graphviz`` function interprets a graph described using the GraphViz_ DOT language and builds a BGL graph that captures that description. Using this function, you can initialize a graph using -data stored as text. +data stored as text. To use the iterator version of ``read_graphviz``, +you will need to define the macro BOOST_GRAPH_READ_GRAPHVIZ_ITERATORS +before including the header ````. Doing so +may greatly increase the amount of time required to compile the +GraphViz reader. The DOT language can specify both directed and undirected graphs, and ``read_graphviz`` differentiates between the two. One must pass @@ -42,8 +49,7 @@ takes a dynamic_properties_ object and operates on its collection of property maps. The reader passes all the properties encountered to this object, using the GraphViz string keys as the property keys. Furthermore, ``read_graphviz`` stores node identifier names under the -property key "node_id". The deprecated reading functions do not -support properties. +vertex property map named node_id. Requirements: - The type of the graph must model the `Mutable Graph`_ concept. @@ -112,27 +118,19 @@ graph is undirected, as indicated by the ``graph`` keyword in the DOT language. -Using the Deprecated GraphViz Readers -------------------------------------- +Building the GraphViz Readers +----------------------------- +To use the GraphViz readers, you will need to build and link against +the "bgl-viz" library. The library can be built by following the +`Boost Jam Build Instructions`_ for the subdirectory ``libs/graph/build``. +Deprecated Readers +------------------ The deprecated readers do not provide exceptions on error (they abort), they require the use of one of the predefined graph types (``GraphvizDigraph`` or ``GraphvizGraph``), and they do not support arbitrary properties. They will be removed in a future Boost version. -To use the deprecated GraphViz readers, you will need to build and -link against the "bgl-viz" library. The library can be built in two -ways: - - 1. Follow the `Boost Jam Build Instructions`_ for the subdirectory - ``libs/graph/build``. - - 2. In the directory ``libs/graph/src``, use the provided Makefile - (for Unix-like systems). - -Alternatively, you can just include the source files in -``libs/graph/src`` in your project or makefile. - Notes ----- diff --git a/include/boost/graph/detail/read_graphviz_spirit.hpp b/include/boost/graph/detail/read_graphviz_spirit.hpp index 45124eeb..d3b9d98a 100644 --- a/include/boost/graph/detail/read_graphviz_spirit.hpp +++ b/include/boost/graph/detail/read_graphviz_spirit.hpp @@ -51,7 +51,7 @@ #include #include #include - +#include namespace phoenix { // Workaround: std::map::operator[] uses a different return type than all @@ -66,53 +66,6 @@ struct binary_operator, T1> } // namespace phoenix namespace boost { - -///////////////////////////////////////////////////////////////////////////// -// Graph reader exceptions -///////////////////////////////////////////////////////////////////////////// - -struct graph_exception : public std::exception { - virtual ~graph_exception() throw() {} - virtual const char* what() const throw() = 0; -}; - -struct bad_parallel_edge : public graph_exception { - std::string from; - std::string to; - mutable std::string statement; - bad_parallel_edge(const std::string& i, const std::string& j) : - from(i), to(j) {} - - virtual ~bad_parallel_edge() throw() {} - const char* what() const throw() { - if(statement.empty()) - statement = - std::string("Failed to add parallel edge: (") - + from + "," + to + ")\n"; - - return statement.c_str(); - } -}; - -struct directed_graph_error : public graph_exception { - virtual ~directed_graph_error() throw() {} - virtual const char* what() const throw() { - return - "read_graphviz: " - "Tried to read a directed graph into an undirected graph."; - } -}; - -struct undirected_graph_error : public graph_exception { - virtual ~undirected_graph_error() throw() {} - virtual const char* what() const throw() { - return - "read_graphviz: " - "Tried to read an undirected graph into a directed graph."; - } -}; - - namespace detail { namespace graph { @@ -125,27 +78,6 @@ using namespace phoenix; // Application-specific type definitions ///////////////////////////////////////////////////////////////////////////// -typedef std::string id_t; -typedef id_t node_t; - -// edges are not uniquely determined by adjacent nodes -class edge_t { - int idx_; - explicit edge_t(int i) : idx_(i) {} -public: - static edge_t new_edge() { - static int idx = 0; - return edge_t(idx++); - }; - - bool operator==(const edge_t& rhs) const { - return idx_ == rhs.idx_; - } - bool operator<(const edge_t& rhs) const { - return idx_ < rhs.idx_; - } -}; - typedef std::set edges_t; typedef std::set nodes_t; typedef std::set ids_t; @@ -202,17 +134,9 @@ struct subgraph_closure : boost::spirit::closure -struct dot_grammar : public grammar< dot_grammar > { - - - MutableGraph& graph_; - dynamic_properties& dp_; - std::string node_id_prop_; - dot_grammar(MutableGraph& graph, dynamic_properties& dp, - std::string const& node_id_prop) : - graph_(graph), dp_(dp), node_id_prop_(node_id_prop) { } - +struct dot_grammar : public grammar { + mutate_graph& graph_; + explicit dot_grammar(mutate_graph& graph) : graph_(graph) { } template struct definition { @@ -362,16 +286,12 @@ struct dot_grammar : public grammar< dot_grammar > { // void check_undirected() { - if(!boost::is_convertible< - typename boost::graph_traits::directed_category, - boost::undirected_tag>::value) + if(self.graph_.is_directed()) throw boost::undirected_graph_error(); } void check_directed() { - if(!boost::is_convertible< - typename boost::graph_traits::directed_category, - boost::directed_tag>::value) + if(!self.graph_.is_directed()) throw boost::directed_graph_error(); } @@ -381,15 +301,10 @@ struct dot_grammar : public grammar< dot_grammar > { if(nodes.find(node) == nodes.end()) { nodes.insert(node); + self.graph_.add_vertex(node); + node_map.insert(std::make_pair(node,ids_t())); - // Add the node to the graph. - bgl_vertex_t v = add_vertex(self.graph_); - // Set up a mapping from name to BGL vertex. - bgl_nodes.insert(std::make_pair(node,v)); - - // node_id_prop_ allows the caller to see the real id names for nodes. - put(self.node_id_prop_,self.dp_,v,node); #ifdef BOOST_GRAPH_DEBUG std::cout << "Add new node " << node << std::endl; #endif // BOOST_GRAPH_DEBUG @@ -428,28 +343,22 @@ struct dot_grammar : public grammar< dot_grammar > { edge_stack.push_back(edge); edges.insert(edge); edge_map.insert(std::make_pair(edge,ids_t())); - // Add the real edge. - std::pair result = - add_edge(bgl_nodes[*i],bgl_nodes[*j],self.graph_); - if(!result.second) { - // In the case of no parallel edges allowed - throw bad_parallel_edge(*i,*j); - } else { - bgl_edges.insert(std::make_pair(edge,result.first)); - // Set the default properties for this edge - for(props_t::iterator k = edge_props.begin(); - k != edge_props.end(); ++k) { + // Add the real edge. + self.graph_.add_edge(edge, *i, *j); + + // Set the default properties for this edge + for(props_t::iterator k = edge_props.begin(); + k != edge_props.end(); ++k) { + set_edge_property(edge,k->first,k->second); + } + if(subgraph_depth > 0) { + subgraph.edges().insert(edge); + // Set the subgraph's default properties as well + props_t& props = subgraph_edge_props[subgraph.name()]; + for(props_t::iterator k = props.begin(); k != props.end(); ++k) { set_edge_property(edge,k->first,k->second); } - if(subgraph_depth > 0) { - subgraph.edges().insert(edge); - // Set the subgraph's default properties as well - props_t& props = subgraph_edge_props[subgraph.name()]; - for(props_t::iterator k = props.begin(); k != props.end(); ++k) { - set_edge_property(edge,k->first,k->second); - } - } } } } @@ -532,7 +441,7 @@ struct dot_grammar : public grammar< dot_grammar > { // Add the property key to the "set" table to avoid default overwrite node_map[node].insert(key); // Set the user's property map - put(key,self.dp_,bgl_nodes[node],value); + self.graph_.set_node_property(key, node, value); #ifdef BOOST_GRAPH_DEBUG // Tell the world std::cout << node << ": " << key << " = " << value << std::endl; @@ -545,7 +454,7 @@ struct dot_grammar : public grammar< dot_grammar > { // Add the property key to the "set" table to avoid default overwrite edge_map[edge].insert(key); // Set the user's property map - put(key,self.dp_,bgl_edges[edge],value); + self.graph_.set_edge_property(key, edge, value); #ifdef BOOST_GRAPH_DEBUG // Tell the world std::cout << "(" << edge.first << "," << edge.second << "): " @@ -602,14 +511,6 @@ struct dot_grammar : public grammar< dot_grammar > { props_t default_edge_props; // global default edge properties subgraph_props_t subgraph_node_props; // per-subgraph default node properties subgraph_props_t subgraph_edge_props; // per-subgraph default edge properties - - // BGL graph related tables - typedef typename - graph_traits < MutableGraph >::vertex_descriptor bgl_vertex_t; - typedef typename - graph_traits < MutableGraph >::edge_descriptor bgl_edge_t; - std::map bgl_nodes; - std::map bgl_edges; }; // struct definition }; // struct dot_grammar @@ -647,26 +548,6 @@ struct dot_skipper : public grammar } // namespace graph } // namespace detail - -// Parse the passed stream as a GraphViz dot file. -template -bool read_graphviz(std::istream& in, MutableGraph& graph, - dynamic_properties& dp, - std::string const& node_id = "node_id") { - using namespace boost::spirit; - - typedef std::istream_iterator is_t; - typedef multi_pass iterator_t; - - iterator_t first(make_multi_pass(is_t(in))); - iterator_t last(make_multi_pass(is_t())); - - // Turn off white space skipping on the stream - in.unsetf(std::ios::skipws); - - return read_graphviz(first, last, graph, dp, node_id); -} - template bool read_graphviz(MultiPassIterator begin, MultiPassIterator end, MutableGraph& graph, dynamic_properties& dp, @@ -680,7 +561,9 @@ bool read_graphviz(MultiPassIterator begin, MultiPassIterator end, typedef scanner_policies scanner_policies_t; typedef scanner scanner_t; - boost::detail::graph::dot_grammar p(graph,dp,node_id); + detail::graph::mutate_graph_impl m_graph(graph, dp, node_id); + + boost::detail::graph::dot_grammar p(m_graph); boost::detail::graph::dot_skipper skip_p; iter_policy_t iter_policy(skip_p); diff --git a/include/boost/graph/graphviz.hpp b/include/boost/graph/graphviz.hpp index 86846b02..a37b7b39 100644 --- a/include/boost/graph/graphviz.hpp +++ b/include/boost/graph/graphviz.hpp @@ -46,11 +46,6 @@ #include #include -// TBD: this should be a real macro at some point... -#ifndef BOOST_NO_SPIRIT -# include -#endif // BOOST_NO_SPIRIT - namespace boost { template @@ -608,6 +603,173 @@ namespace boost { /*graph_writer=*/default_writer(), id); } + +///////////////////////////////////////////////////////////////////////////// +// Graph reader exceptions +///////////////////////////////////////////////////////////////////////////// +struct graph_exception : public std::exception { + virtual ~graph_exception() throw() {} + virtual const char* what() const throw() = 0; +}; + +struct bad_parallel_edge : public graph_exception { + std::string from; + std::string to; + mutable std::string statement; + bad_parallel_edge(const std::string& i, const std::string& j) : + from(i), to(j) {} + + virtual ~bad_parallel_edge() throw() {} + const char* what() const throw() { + if(statement.empty()) + statement = + std::string("Failed to add parallel edge: (") + + from + "," + to + ")\n"; + + return statement.c_str(); + } +}; + +struct directed_graph_error : public graph_exception { + virtual ~directed_graph_error() throw() {} + virtual const char* what() const throw() { + return + "read_graphviz: " + "Tried to read a directed graph into an undirected graph."; + } +}; + +struct undirected_graph_error : public graph_exception { + virtual ~undirected_graph_error() throw() {} + virtual const char* what() const throw() { + return + "read_graphviz: " + "Tried to read an undirected graph into a directed graph."; + } +}; + +namespace detail { namespace graph { + +typedef std::string id_t; +typedef id_t node_t; + +// edges are not uniquely determined by adjacent nodes +class edge_t { + int idx_; + explicit edge_t(int i) : idx_(i) {} +public: + static edge_t new_edge() { + static int idx = 0; + return edge_t(idx++); + }; + + bool operator==(const edge_t& rhs) const { + return idx_ == rhs.idx_; + } + bool operator<(const edge_t& rhs) const { + return idx_ < rhs.idx_; + } +}; + +class mutate_graph +{ + public: + virtual ~mutate_graph() {} + virtual bool is_directed() const = 0; + virtual void add_vertex(const node_t& node) = 0; + + virtual void + add_edge(const edge_t& edge, const node_t& source, const node_t& target) = 0; + + virtual void + set_node_property(const id_t& key, const node_t& node, const id_t& value) = 0; + + virtual void + set_edge_property(const id_t& key, const edge_t& edge, const id_t& value) = 0; +}; + +template +class mutate_graph_impl : public mutate_graph +{ + typedef typename graph_traits::vertex_descriptor bgl_vertex_t; + typedef typename graph_traits::edge_descriptor bgl_edge_t; + + public: + mutate_graph_impl(MutableGraph& graph, dynamic_properties& dp, + std::string node_id_prop) + : graph_(graph), dp_(dp), node_id_prop_(node_id_prop) { } + + bool is_directed() const + { + return + boost::is_convertible< + typename boost::graph_traits::directed_category, + boost::directed_tag>::value; + } + + virtual void add_vertex(const node_t& node) + { + // Add the node to the graph. + bgl_vertex_t v = boost::add_vertex(graph_); + + // Set up a mapping from name to BGL vertex. + bgl_nodes.insert(std::make_pair(node, v)); + + // node_id_prop_ allows the caller to see the real id names for nodes. + put(node_id_prop_, dp_, v, node); + } + + void add_edge(const edge_t& edge, const node_t& source, const node_t& target) + { + std::pair result = + boost::add_edge(bgl_nodes[source], bgl_nodes[target], graph_); + + if(!result.second) { + // In the case of no parallel edges allowed + throw bad_parallel_edge(source, target); + } else { + bgl_edges.insert(std::make_pair(edge, result.first)); + } + } + + void + set_node_property(const id_t& key, const node_t& node, const id_t& value) + { + put(key, dp_, bgl_nodes[node], value); + } + + void + set_edge_property(const id_t& key, const edge_t& edge, const id_t& value) + { + put(key, dp_, bgl_edges[edge], value); + } + + protected: + MutableGraph& graph_; + dynamic_properties& dp_; + std::string node_id_prop_; + std::map bgl_nodes; + std::map bgl_edges; +}; + +bool read_graphviz(std::istream& in, mutate_graph& graph); + +} } // end namespace detail::graph + +// Parse the passed stream as a GraphViz dot file. +template +bool read_graphviz(std::istream& in, MutableGraph& graph, + dynamic_properties& dp, + std::string const& node_id = "node_id") +{ + detail::graph::mutate_graph_impl m_graph(graph, dp, node_id); + return detail::graph::read_graphviz(in, m_graph); +} + } // namespace boost +#ifdef BOOST_GRAPH_READ_GRAPHVIZ_ITERATORS +# include +#endif // BOOST_GRAPH_READ_GRAPHVIZ_ITERATORS + #endif // BOOST_GRAPHVIZ_HPP diff --git a/src/Makefile b/src/Makefile index d315b8a8..baa6e28a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -67,10 +67,17 @@ graphviz_digraph_lex.cpp: graphviz_lex.ll graphviz_graph_parser.cpp graphviz_graph_parser.hpp: graphviz_parser.yy $(YACC) -p bgl_undir_ -d -v -o graphviz_graph_parser.cpp graphviz_parser.yy + mv graphviz_graph_parser.cpp tmp_graphviz_graph_parser.cpp + echo "#define GRAPHVIZ_DIRECTED 0" > graphviz_graph_parser.cpp + cat tmp_graphviz_graph_parser.cpp >> graphviz_graph_parser.cpp + rm tmp_graphviz_graph_parser.cpp graphviz_digraph_parser.cpp graphviz_digraph_parser.hpp: graphviz_parser.yy $(YACC) -p bgl_dir_ -d -v -o graphviz_digraph_parser.cpp graphviz_parser.yy - + mv graphviz_digraph_parser.cpp tmp_graphviz_digraph_parser.cpp + echo "#define GRAPHVIZ_DIRECTED 1" > graphviz_digraph_parser.cpp + cat tmp_graphviz_digraph_parser.cpp >> graphviz_digraph_parser.cpp + rm tmp_graphviz_digraph_parser.cpp clean: /bin/rm -rf *.o *.a *.so* *.output graphviz_digraph_parser.cpp graphviz_digraph_parser.hpp graphviz_graph_parser.cpp graphviz_graph_parser.hpp graphviz_digraph_lex.cpp graphviz_graph_lex.cpp diff --git a/src/graphviz_digraph_lex.cpp b/src/graphviz_digraph_lex.cpp index c57dd550..4d043563 100644 --- a/src/graphviz_digraph_lex.cpp +++ b/src/graphviz_digraph_lex.cpp @@ -1,3 +1,4 @@ +#define GRAPHVIZ_DIRECTED 1 #line 2 "graphviz_digraph_lex.cpp" #line 4 "graphviz_digraph_lex.cpp" diff --git a/src/graphviz_digraph_parser.cpp b/src/graphviz_digraph_parser.cpp index 7e67c7ad..e421f75e 100644 --- a/src/graphviz_digraph_parser.cpp +++ b/src/graphviz_digraph_parser.cpp @@ -1,3 +1,4 @@ +#define GRAPHVIZ_DIRECTED 1 /* A Bison parser, made from graphviz_parser.yy by GNU Bison version 1.28 */ diff --git a/src/graphviz_graph_lex.cpp b/src/graphviz_graph_lex.cpp index daabc4f2..8abe6336 100644 --- a/src/graphviz_graph_lex.cpp +++ b/src/graphviz_graph_lex.cpp @@ -1,3 +1,4 @@ +#define GRAPHVIZ_DIRECTED 0 #line 2 "graphviz_graph_lex.cpp" #line 4 "graphviz_graph_lex.cpp" diff --git a/src/graphviz_graph_parser.cpp b/src/graphviz_graph_parser.cpp index 4aefb334..6878c662 100644 --- a/src/graphviz_graph_parser.cpp +++ b/src/graphviz_graph_parser.cpp @@ -1,3 +1,4 @@ +#define GRAPHVIZ_DIRECTED 0 /* A Bison parser, made from graphviz_parser.yy by GNU Bison version 1.28 */ diff --git a/test/Jamfile b/test/Jamfile index 898536e0..a2791a68 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -41,7 +41,7 @@ test-suite graph : [ compile graph_concepts.cpp : $(BOOST_ROOT) ] - [ run graphviz_test.cpp : : : $(BOOST_ROOT) ] + [ run graphviz_test.cpp ../build/bgl-viz : : : $(BOOST_ROOT) ] [ run gursoy_atun_layout_test.cpp : : : $(BOOST_ROOT) ] diff --git a/test/graphviz_test.cpp b/test/graphviz_test.cpp index 40c89506..769d2c0e 100644 --- a/test/graphviz_test.cpp +++ b/test/graphviz_test.cpp @@ -11,6 +11,8 @@ // Author: Ronald Garcia +//#define BOOST_GRAPH_READ_GRAPHVIZ_ITERATORS +#define BOOST_GRAPHVIZ_USE_ISTREAM #include #include #include @@ -27,7 +29,10 @@ using namespace std; using namespace boost; + +#ifndef BOOST_GRAPHVIZ_USE_ISTREAM using namespace boost::spirit; +#endif using namespace boost::assign; typedef std::string node_t;