From 9d0640b6143a4cb441b38ff9356e088cd1043b2e Mon Sep 17 00:00:00 2001 From: Jeremiah Willcock Date: Tue, 29 Dec 2009 03:50:53 +0000 Subject: [PATCH] Merged changes from trunk that are going into 1.42.0 [SVN r58554] --- build/Jamfile.v2 | 44 +-- doc/astar_search.html | 3 + doc/compressed_sparse_row.html | 163 ++------ doc/index.html | 39 +- doc/known_problems.html | 8 - doc/kolmogorov_max_flow.html | 4 +- doc/prim_minimum_spanning_tree.html | 5 +- doc/table_of_contents.html | 290 +++++++------- doc/transitive_closure.html | 5 +- example/labeled_graph.cpp | 2 - include/boost/graph/adjacency_list.hpp | 39 +- include/boost/graph/adjacency_list_io.hpp | 2 +- include/boost/graph/adjacency_matrix.hpp | 18 +- include/boost/graph/astar_search.hpp | 4 +- .../boost/graph/biconnected_components.hpp | 2 +- .../boost/graph/bron_kerbosch_all_cliques.hpp | 10 +- .../boost/graph/clustering_coefficient.hpp | 7 +- .../graph/compressed_sparse_row_graph.hpp | 170 +-------- include/boost/graph/core_numbers.hpp | 2 +- include/boost/graph/dag_shortest_paths.hpp | 2 +- include/boost/graph/depth_first_search.hpp | 10 +- include/boost/graph/detail/adjacency_list.hpp | 8 +- .../detail/compressed_sparse_row_struct.hpp | 24 +- include/boost/graph/detail/histogram_sort.hpp | 4 +- include/boost/graph/dll_import_export.hpp | 30 ++ include/boost/graph/dominator_tree.hpp | 2 +- include/boost/graph/filtered_graph.hpp | 18 +- .../boost/graph/floyd_warshall_shortest.hpp | 2 +- include/boost/graph/geodesic_distance.hpp | 2 +- include/boost/graph/graph_traits.hpp | 10 + include/boost/graph/graphml.hpp | 55 +-- include/boost/graph/graphviz.hpp | 15 +- include/boost/graph/grid_graph.hpp | 2 +- include/boost/graph/howard_cycle_ratio.hpp | 20 +- .../boost/graph/is_straight_line_drawing.hpp | 2 +- include/boost/graph/isomorphism.hpp | 2 +- include/boost/graph/kolmogorov_max_flow.hpp | 3 +- include/boost/graph/labeled_graph.hpp | 5 +- include/boost/graph/lookup_edge.hpp | 50 +++ .../boost/graph/max_cardinality_matching.hpp | 12 +- .../boost/graph/mcgregor_common_subgraphs.hpp | 4 +- include/boost/graph/metric_tsp_approx.hpp | 11 +- include/boost/graph/named_function_params.hpp | 6 +- .../planar_detail/boyer_myrvold_impl.hpp | 6 +- include/boost/graph/planar_face_traversal.hpp | 4 +- include/boost/graph/properties.hpp | 20 +- .../property_maps/constant_property_map.hpp | 2 +- include/boost/graph/r_c_shortest_paths.hpp | 14 +- include/boost/graph/reverse_graph.hpp | 36 +- include/boost/graph/subgraph.hpp | 8 +- include/boost/graph/two_bit_color_map.hpp | 7 +- include/boost/pending/property.hpp | 12 +- src/graphml.cpp | 361 +++++------------- src/read_graphviz_new.cpp | 11 +- test/Jamfile.v2 | 10 +- test/adj_list_loops.cpp | 4 - test/astar_search_test.cpp | 4 +- test/basic_planarity_test.cpp | 2 +- test/bron_kerbosch_all_cliques.cpp | 2 +- test/closeness_centrality.cpp | 4 +- test/clustering_coefficient.cpp | 4 +- test/core_numbers_test.cpp | 8 +- test/csr_graph_test.cpp | 63 +-- test/degree_centrality.cpp | 4 +- test/dfs.cpp | 8 +- test/dominator_tree_test.cpp | 2 +- test/eccentricity.cpp | 4 +- test/grid_graph_cc.cpp | 4 +- test/grid_graph_test.cpp | 6 +- test/is_straight_line_draw_test.cpp | 2 +- test/labeled_graph.cpp | 2 - test/layout_test.cpp | 4 +- test/make_bicon_planar_test.cpp | 2 +- test/make_maximal_planar_test.cpp | 2 +- test/matching_test.cpp | 4 +- test/mcgregor_subgraphs_test.cpp | 4 +- test/mean_geodesic.cpp | 4 +- test/metric_tsp_approx.cpp | 2 +- test/named_vertices_test.cpp | 2 +- test/r_c_shortest_paths_test.cpp | 2 +- test/serialize.cpp | 4 +- test/subgraph.cpp | 2 +- test/subgraph_bundled.cpp | 6 +- test/subgraph_props.cpp | 4 - test/test_construction.hpp | 2 +- test/test_destruction.hpp | 6 +- test/test_direction.hpp | 6 +- test/test_graphs.cpp | 2 - test/tiernan_all_cycles.cpp | 2 +- 89 files changed, 643 insertions(+), 1147 deletions(-) create mode 100644 include/boost/graph/dll_import_export.hpp create mode 100644 include/boost/graph/lookup_edge.hpp mode change 100755 => 100644 test/dominator_tree_test.cpp diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index eb4c4787..c05fdb31 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -11,53 +11,19 @@ project boost/graph : source-location ../src ; -local optional_sources ; -local optional_reqs ; - -if [ modules.peek : EXPAT_INCLUDE ] && [ modules.peek : EXPAT_LIBPATH ] -{ - local EXPAT_INCLUDE = [ modules.peek : EXPAT_INCLUDE ] ; - local EXPAT_LIBPATH = [ modules.peek : EXPAT_LIBPATH ] ; - - if --debug-configuration in [ modules.peek : ARGV ] - { - ECHO "Expat include directory: $(EXPAT_INCLUDE)" ; - ECHO "Expat library directory: $(EXPAT_LIBPATH)" ; - } - - alias graphml - : graphml.cpp - : # requirements - : # default built - : # usage requirements - $(EXPAT_INCLUDE) - $(EXPAT_LIBPATH) - expat - ; -} -else -{ - message graphml - : "warning: Graph library does not contain optional GraphML reader." - : "note: to enable GraphML support, set EXPAT_INCLUDE and EXPAT_LIBPATH to the" - : "note: directories containing the Expat headers and libraries, respectively." - ; -} -explicit graphml ; - lib boost_graph : read_graphviz_new.cpp - graphml + graphml.cpp : ../../regex/build//boost_regex - BOOST_GRAPH_NO_LIB=1 shared:BOOST_GRAPH_DYN_LINK=1 - # # Intel compiler ICEs if we turn optimization on - intel-vc71-win-9.1:off # Without these flags, MSVC 7.1 and 8.0 crash + # User reports that VC++ 8.0 does not fail anymore, so that is removed msvc-7.1:-GR- - msvc-8.0:-GR- + : + : + ../../regex/build//boost_regex ; boost-install boost_graph ; diff --git a/doc/astar_search.html b/doc/astar_search.html index d81680da..dbde1080 100644 --- a/doc/astar_search.html +++ b/doc/astar_search.html @@ -69,6 +69,9 @@ astar_search_no_init ColorMap color, VertexIndexMap index_map, CompareFunction compare, CombineFunction combine, CostInf inf, CostZero zero); + +Note that the index_map and color parameters are swapped in +astar_search_no_init relative to astar_search.

diff --git a/doc/compressed_sparse_row.html b/doc/compressed_sparse_row.html index 5086ac68..68a0ed9b 100644 --- a/doc/compressed_sparse_row.html +++ b/doc/compressed_sparse_row.html @@ -49,17 +49,6 @@ function address(host, user) { applications or for very large graphs that you do not need to change.

-

There are two interfaces to the compressed sparse row graph. The - old interface requires that all out edges from a single vertex are - sorted by target, and does not support construction of the graph from - unsorted arrays of sources and targets. The new interface has these - new constructors, but does not support incremental construction of the - graph or the edge_range() and edge() functions. The - old interface is the default, but will be removed in a later version of - Boost. To select the new interface, add #define - BOOST_GRAPH_USE_NEW_CSR_INTERFACE before including - <boost/graph/compressed_sparse_row_graph.hpp>.

-

The CSR format stores vertices and edges in separate arrays, with the indices into these arrays corresponding to the identifier for the vertex or edge, respectively. The edge array is sorted by @@ -79,8 +68,8 @@ function address(host, user) { the template parameters. The Directed template parameter controls whether one edge direction (the default) or both directions are stored. A directed CSR graph has - Directed = directedS and a bidirectional CSR graph (only - supported with the new interface and with a limited set of constructors) + Directed = directedS and a bidirectional CSR graph (with + a limited set of constructors) has Directed = bidirectionalS.

    @@ -121,7 +110,7 @@ public: // Graph constructors compressed_sparse_row_graph(); - // Unsorted edge list constructors (new interface only) + // Unsorted edge list constructors template<typename InputIterator> compressed_sparse_row_graph(edges_are_unsorted_t, InputIterator edge_begin, InputIterator edge_end, @@ -148,21 +137,7 @@ public: vertices_size_type numverts, const GraphProperty& prop = GraphProperty()); - // Old sorted edge list constructors (old interface only) - template<typename InputIterator> - compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, - vertices_size_type numverts, - edges_size_type numedges = 0, - const GraphProperty& prop = GraphProperty()); - - template<typename InputIterator, typename EdgePropertyIterator> - compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, - EdgePropertyIterator ep_iter, - vertices_size_type numverts, - edges_size_type numedges = 0, - const GraphProperty& prop = GraphProperty()); - - // New sorted edge list constructors (both interfaces, directed only) + // New sorted edge list constructors (directed only) template<typename InputIterator> compressed_sparse_row_graph(edges_are_sorted_t, InputIterator edge_begin, InputIterator edge_end, @@ -178,7 +153,7 @@ public: edges_size_type numedges = 0, const GraphProperty& prop = GraphProperty()); - // In-place unsorted edge list constructors (new interface and directed only) + // In-place unsorted edge list constructors (directed only) template<typename InputIterator> compressed_sparse_row_graph(construct_inplace_from_sources_and_targets_t, std::vector<vertex_descriptor>& sources, @@ -194,7 +169,7 @@ public: vertices_size_type numverts, const GraphProperty& prop = GraphProperty()); - // Miscellaneous constructors (both interfaces, directed only) + // Miscellaneous constructors (directed only) template<typename Graph, typename VertexIndexMap> compressed_sparse_row_graph(const Graph& g, const VertexIndexMap& vi, vertices_size_type numverts, @@ -206,7 +181,7 @@ public: template<typename Graph> explicit compressed_sparse_row_graph(const Graph& g); - // Graph mutators (both interfaces, directed only) + // Graph mutators (directed only) template<typename Graph, typename VertexIndexMap> void assign(const Graph& g, const VertexIndexMap& vi, vertices_size_type numverts, edges_size_type numedges); @@ -217,51 +192,46 @@ public: template<typename Graph> void assign(const Graph& g); - // Property Access (both interfaces) + // Property Access VertexProperty& operator[](vertex_descriptor v); const VertexProperty& operator[](vertex_descriptor v) const; EdgeProperty& operator[](edge_descriptor v); const EdgeProperty& operator[](edge_descriptor v) const; }; -// Incidence Graph requirements (both interfaces) +// Incidence Graph requirements vertex_descriptor source(edge_descriptor, const compressed_sparse_row_graph&); vertex_descriptor target(edge_descriptor, const compressed_sparse_row_graph&); std::pair<out_edge_iterator, out_edge_iterator> out_edges(vertex_descriptor, const compressed_sparse_row_graph&); degree_size_type out_degree(vertex_descriptor v, const compressed_sparse_row_graph&); -// Bidirectional Graph requirements (new interface and bidirectional only) +// Bidirectional Graph requirements (bidirectional only) std::pair<in_edge_iterator, in_edge_iterator> in_edges(vertex_descriptor, const compressed_sparse_row_graph&); degree_size_type in_degree(vertex_descriptor v, const compressed_sparse_row_graph&); -// Adjacency Graph requirements (both interfaces) +// Adjacency Graph requirements std::pair<adjacency_iterator, adjacency_iterator> adjacent_vertices(vertex_descriptor, const compressed_sparse_row_graph&); -// Vertex List Graph requirements (both interfaces) +// Vertex List Graph requirements std::pair<vertex_iterator, vertex_iterator> vertices(const compressed_sparse_row_graph&); vertices_size_type num_vertices(const compressed_sparse_row_graph&); -// Edge List Graph requirements (both interfaces) +// Edge List Graph requirements std::pair<edge_iterator, edge_iterator> edges(const compressed_sparse_row_graph&); edges_size_type num_edges(const compressed_sparse_row_graph&); -// Vertex access (both interfaces) +// Vertex access vertex_descriptor vertex(vertices_size_type i, const compressed_sparse_row_graph&); // Edge access -(old interface only) -std::pair<out_edge_iterator, out_edge_iterator> - edge_range(vertex_descriptor u, vertex_descriptor v, const compressed_sparse_row_graph&); -(both interfaces) std::pair<edge_descriptor, bool> edge(vertex_descriptor u, vertex_descriptor v, const compressed_sparse_row_graph&); -(both interfaces) edge_descriptor edge_from_index(edges_size_type i, const compressed_sparse_row_graph&); -// Property map accessors (both interfaces) +// Property map accessors template<typename PropertyTag> property_map<compressed_sparse_row_graph, PropertyTag>::type get(PropertyTag, compressed_sparse_row_graph& g) @@ -290,31 +260,19 @@ void set_property(const compressed_sparse_row_graph& const typename graph_property<compressed_sparse_row_graph, GraphPropertyTag>::type& value); // Incremental construction functions -(old interface only) -template<typename Graph> -vertex_descriptor add_vertex(compressed_sparse_row_graph& g); - -(old interface only) -template<typename Graph> -vertex_descriptor add_vertices(vertices_size_type count, compressed_sparse_row_graph& g); - -(old interface only) -template<typename Graph> -edge_descriptor add_edge(vertex_descriptor src, vertex_descriptor tgt, compressed_sparse_row_graph& g); - -(new interface and directed only) +(directed only) template<typename InputIterator, typename Graph> void add_edges(InputIterator first, InputIterator last, compressed_sparse_row_graph& g); -(new interface and directed only) +(directed only) template<typename InputIterator, typename EPIter, typename Graph> void add_edges(InputIterator first, InputIterator last, EPIter ep_first, EPIter ep_last, compressed_sparse_row_graph& g); -(new interface and directed only) +(directed only) template<typename BidirectionalIterator, typename Graph> void add_edges_sorted(BidirectionalIterator first, BidirectionalIterator last, compressed_sparse_row_graph& g); -(new interface and directed only) +(directed only) template<typename BidirectionalIterator, typename EPIter, typename Graph> void add_edges_sorted(BidirectionalIterator first, BidirectionalIterator last, EPIter ep_iter, compressed_sparse_row_graph& g); @@ -359,8 +317,9 @@ void add_edges_sorted(BidirectionalIterator
    A selector that determines whether the graph will be directed, bidirectional or undirected. At this time, the CSR graph type - only supports directed graphs, so this value must - be boost::directedS.
    + only supports directed and bidirectional graphs, so this value must + be either boost::directedS or + boost::bidirectionalS.
    Default: boost::directedS
    @@ -465,7 +424,6 @@ void add_edges_sorted(BidirectionalIterator edge_end) do not need to be sorted. This constructor uses extra memory to save the edge information before adding it to the graph, avoiding the requirement for the iterator to have multi-pass capability. - (This function is only provided by the new interface.)

    @@ -498,7 +456,6 @@ void add_edges_sorted(BidirectionalIterator edge_begin to edge_end. This constructor uses extra memory to save the edge information before adding it to the graph, avoiding the requirement for the iterator to have multi-pass capability. - (This function is only provided by the new interface.)


    @@ -523,7 +480,6 @@ void add_edges_sorted(BidirectionalIterator numverts). The edges in [edge_begin, edge_end) do not need to be sorted. Multiple passes will be made over the edge range. - (This function is only provided by the new interface.)

    @@ -555,7 +511,6 @@ void add_edges_sorted(BidirectionalIterator of the graph, where m is distance from edge_begin to edge_end. Multiple passes will be made over the edge and property ranges. - (This function is only provided by the new interface.)


    @@ -584,9 +539,7 @@ void add_edges_sorted(BidirectionalIterator numverts). The edges in [edge_begin, edge_end) must be sorted so that all edges originating from vertex i preceed any edges originating from all - vertices j where j > i. (The version of this - constructor without the edges_are_sorted tag is deprecated and - only provided by the old interface.) + vertices j where j > i.

    @@ -624,9 +577,7 @@ void add_edges_sorted(BidirectionalIterator EdgeProperty. The iterator range [ep_iter, ep_ter + m) will be used to initialize the properties on the edges of the graph, where m is distance from - edge_begin to edge_end. (The version of this - constructor without the edges_are_sorted tag is deprecated and - only provided by the old interface.) + edge_begin to edge_end.


    @@ -647,7 +598,6 @@ void add_edges_sorted(BidirectionalIterator share storage with the constructed graph (and so are safe to destroy). The parameter prop, if provided, is used to initialize the graph property. - (This function is only provided by the new interface.)


    @@ -670,7 +620,6 @@ void add_edges_sorted(BidirectionalIterator not share storage with the constructed graph (and so are safe to destroy). The parameter prop, if provided, is used to initialize the graph property. - (This function is only provided by the new interface.)


    @@ -774,20 +723,6 @@ void add_edges_sorted(BidirectionalIterator
    -

    Edge access

    -
    
    -  std::pair<out_edge_iterator, out_edge_iterator> 
    -    edge_range(vertex_descriptor u, vertex_descriptor v, const compressed_sparse_row_graph&);
    -    
    - -

    - Returns all edges from u to v. Requires time - logarithmic in the number of edges outgoing from u. - (This function is only provided by the old interface.) -

    - -
    -
    
       std::pair<edge_descriptor, bool> 
         edge(vertex_descriptor u, vertex_descriptor v, const compressed_sparse_row_graph&);
    @@ -799,9 +734,8 @@ void add_edges_sorted(BidirectionalIterator
           second value in the pair will be false. If multiple
           edges exist from u to v, the first edge will
           be returned; use edge_range
    -      to retrieve all edges.  This function requires time logarithmic in the
    -      number of edges outgoing from u for the old interface, and
    -      linear time for the new interface.
    +      to retrieve all edges.  This function requires linear time in the
    +      number of edges outgoing from u.
         


    @@ -898,47 +832,6 @@ void set_property(const compressed_sparse_row_graph& g, GraphPropertyTag,

    Incremental construction functions

    -
    
    -vertex_descriptor add_vertex(compressed_sparse_row_graph& g)
    -    
    - -

    - Add a new vertex to the end of the graph g, and return a - descriptor for that vertex. The new vertex will be greater than any of - the previous vertices in g. - (This function is only provided by the old interface.) -

    - -
    - -
    
    -vertex_descriptor add_vertices(vertices_size_type count, compressed_sparse_row_graph& g)
    -    
    - -

    - Add count new vertices to the end of the graph g, and - return a descriptor for the smallest new vertex. The new vertices will - be greater than any of the previous vertices in g. - (This function is only provided by the old interface.) -

    - -
    - -
    
    -edge_descriptor add_edge(vertex_descriptor src, vertex_descriptor tgt, compressed_sparse_row_graph& g)
    -    
    - -

    - Add a new edge from src to tgt in the graph g, - and return a descriptor for it. There must not be an edge in g - whose source vertex is greater than src. If the vertex - src has out edges before this operation is called, there must be - none whose target is larger than tgt. - (This function is only provided by the old interface.) -

    - -
    -
    
     template<typename InputIterator>
     void add_edges(InputIterator first, InputIterator last, compressed_sparse_row_graph& g)
    @@ -951,7 +844,6 @@ void add_edges(InputIterator first, InputIterator last, compressed_sparse_row_gr
           whose value_type is an std::pair of integer
           values. These integer values are the source and target vertices of the
           new edges.  The edges do not need to be sorted.
    -      (This function is only provided by the new interface.)
         


    @@ -972,7 +864,6 @@ void add_edges(InputIterator first, InputIterator last, EPIter ep_first, EPIter of EPIter must be the edge property type of the graph. The integer values produced by the InputIterator are the source and target vertices of the new edges. The edges do not need to be sorted. - (This function is only provided by the new interface.)


    @@ -990,7 +881,6 @@ void add_edges_sorted(BidirectionalIterator first, BidirectionalIterator last, c values. These integer values are the source and target vertices of the new edges. The edges must be sorted in increasing order by source vertex index. - (This function is only provided by the new interface.)


    @@ -1013,7 +903,6 @@ void add_edges_sorted(BidirectionalIterator first, BidirectionalIterator last, E property type of the graph. The edges must be sorted in increasing order by source vertex index. - (This function is only provided by the new interface.)


    diff --git a/doc/index.html b/doc/index.html index 19e313c8..37830da0 100644 --- a/doc/index.html +++ b/doc/index.html @@ -1,3 +1,5 @@ + + The Boost Graph Library - -C++ Boost - -
    + +C++ Boost

    The Boost Graph Library (BGL) -BGL Book +BGL Book

    @@ -28,12 +29,12 @@ standardized generic interface for traversing graphs is of utmost importance to encourage reuse of graph algorithms and data structures. Part of the Boost Graph Library is a generic interface that allows access to a graph's structure, but hides the details of the -implementation. This is an ``open'' interface in the sense that any +implementation. This is an “open” interface in the sense that any graph library that implements this interface will be interoperable with the BGL generic algorithms and with other algorithms that also use this interface. The BGL provides some general purpose graph classes that conform to this interface, but they are not meant to be the -``only'' graph classes; there certainly will be other graph classes +“only” graph classes; there certainly will be other graph classes that are better for certain situations. We believe that the main contribution of the The BGL is the formulation of this interface. @@ -49,7 +50,9 @@ programming in the context of graphs.

    Of course, if you are already familiar with generic programming, please dive right in! Here's the Table of Contents. +href="./table_of_contents.html">Table of Contents. For distributed-memory +parallelism, you can also look at the Parallel BGL.

    The source for the BGL is available as part of the Boost distribution, @@ -62,7 +65,7 @@ does not need to be built to be used. The only exception is the GraphViz input parser.

    When compiling programs that use the BGL, be sure to compile -with optimization. For instance, select "Release" mode with +with optimization. For instance, select “Release” mode with Microsoft Visual C++ or supply the flag -O2 or -O3 to GCC.

    @@ -108,14 +111,14 @@ handle the specifics of each problem domain.

    The third way that STL is generic is that its containers are parameterized on the element type. Though hugely important, this is -perhaps the least ``interesting'' way in which STL is generic. +perhaps the least “interesting” way in which STL is generic. Generic programming is often summarized by a brief description of parameterized lists such as std::list<T>. This hardly scratches the surface!

    -

    Genericity in the Boost Graph Library +

    Genericity in the Boost Graph Library

    @@ -169,7 +172,7 @@ BGL graph algorithms. Second, the graph algorithms of the BGL are extensible. The BGL introduces the notion of a visitor, which is just a function object with multiple methods. In graph algorithms, there are often several key -``event points'' at which it is useful to insert user-defined +“event points” at which it is useful to insert user-defined operations. The visitor object has a different method that is invoked at each event point. The particular event points and corresponding visitor methods depend on the particular algorithm. They often @@ -185,13 +188,13 @@ include methods like start_vertex(), The third way that the BGL is generic is analogous to the parameterization of the element-type in STL containers, though again the story is a bit more complicated for graphs. We need to associate values (called -"properties") with both the vertices and the edges of the graph. +“properties”) with both the vertices and the edges of the graph. In addition, it will often be necessary to associate multiple properties with each vertex and edge; this is what we mean by multi-parameterization. The STL std::list<T> class has a parameter T for its element type. Similarly, BGL graph classes have template -parameters for vertex and edge ``properties''. A +parameters for vertex and edge “properties”. A property specifies the parameterized type of the property and also assigns an identifying tag to the property. This tag is used to distinguish between the multiple properties which an edge or vertex may have. A @@ -265,8 +268,8 @@ The BGL currently provides two graph classes and an edge list adaptor:

-The adjacency_list class is the general purpose ``swiss army -knife'' of graph classes. It is highly parameterized so that it can be +The adjacency_list class is the general purpose “swiss army +knife” of graph classes. It is highly parameterized so that it can be optimized for different situations: the graph is directed or undirected, allow or disallow parallel edges, efficient access to just the out-edges or also to the in-edges, fast vertex insertion and diff --git a/doc/known_problems.html b/doc/known_problems.html index a7856623..dbf042a1 100644 --- a/doc/known_problems.html +++ b/doc/known_problems.html @@ -44,14 +44,6 @@ versions.

  • "using boost::tie;" may cause VC++ internal compiler error. -

    Workarounds

    -

    -Compiler Warnings on hash_set and hash_map. Versions of -GCC >= 4.3 deprecate these headers and data structures and will emit warnings when -compiling the BGL. To suppress these warnings and the hash-based storage selectors -define the BOOST_NO_HASH prior to including any Boost.Graph headers. -

    -

    diff --git a/doc/kolmogorov_max_flow.html b/doc/kolmogorov_max_flow.html index f57a5762..2cafd055 100644 --- a/doc/kolmogorov_max_flow.html +++ b/doc/kolmogorov_max_flow.html @@ -216,7 +216,9 @@ of Kolmogorov. Few changes were made for increasing performance:

    Vertex List Graph, Edge List Graph and Incidence Graph. For each edge (u,v) in the graph, the reverse edge (v,u) -must also be in the graph. +must also be in the graph. Performance of the algorithm will be slightly +improved if the graph type also models Adjacency +Matrix.

    IN: vertex_descriptor src

    diff --git a/doc/prim_minimum_spanning_tree.html b/doc/prim_minimum_spanning_tree.html index 5db9439c..371a7a70 100644 --- a/doc/prim_minimum_spanning_tree.html +++ b/doc/prim_minimum_spanning_tree.html @@ -55,6 +55,8 @@ simply a call to dijkstra_shortest_paths() with the appropriate choice of comparison and combine functors. The pseudo-code for Prim's algorithm is listed below. +The algorithm as implemented in Boost.Graph does not produce correct results on +graphs with parallel edges.

    @@ -131,7 +133,8 @@ IN: const Graph& g
    An undirected graph. The type Graph must be a model of Vertex List Graph - and Incidence Graph.
    + and Incidence Graph. It should not + contain parallel edges.
    Python: The parameter is named graph.
    diff --git a/doc/table_of_contents.html b/doc/table_of_contents.html index b277a077..8333941c 100644 --- a/doc/table_of_contents.html +++ b/doc/table_of_contents.html @@ -1,3 +1,5 @@ + +Table of Contents: Boost Graph LibraryC++ Boost -
    -

    Table of Contents: the Boost Graph Library BGL Book @@ -22,6 +23,7 @@
    1. Introduction to the BGL +
    2. Parallel BGL (distributed-memory parallel graph data structures and algorithms)
    3. History
    4. List of BGL Users
    5. Publications @@ -64,12 +66,12 @@
    6. Mutable Property Graph
  • The Property Map Library (technically not part of the graph library, but used a lot here) -
  • (Python)Python bindings
  • +
  • (Python)Python bindings
  • Visitor Concepts
    1. BFS Visitor
    2. DFS Visitor -
    3. Dijkstra Visitor +
    4. Dijkstra Visitor
    5. Bellman Ford Visitor
    6. A* Visitor
    7. Event Visitor @@ -114,144 +116,158 @@
      1. Multi-dimensional grid graph
      -
    8. Iterator Adaptors -
        -
      1. adjacency_iterator -
      2. inv_adjacency_iterator -
      -
    9. Traits classes -
        -
      1. graph_traits -
      2. adjacency_list_traits -
      3. property_map -
      -
    10. Algorithms -
        -
      1. bgl_named_params -
      2. Core Algorithm Patterns -
          -
        1. breadth_first_search -
        2. breadth_first_visit -
        3. depth_first_search -
        4. depth_first_visit -
        5. undirected_dfs -
        -
      3. Graph Algorithms -
          -
        1. Shortest Paths Algorithms -
            -
          1. dijkstra_shortest_paths -
          2. dijkstra_shortest_paths_no_color_map -
          3. bellman_ford_shortest_paths -
          4. dag_shortest_paths -
          5. johnson_all_pairs_shortest_paths -
          6. floyd_warshall_all_pairs_shortest_paths
          7. -
          8. r_c_shortest_paths - resource-constrained shortest paths
          9. -
          -
        2. Minimum Spanning Tree Algorithms -
            -
          1. kruskal_minimum_spanning_tree -
          2. prim_minimum_spanning_tree -
          -
        3. Connected Components Algorithms +
        +
      4. Iterator Adaptors
          -
        1. connected_components -
        2. strong_components - -
        3. biconnected_components -
        4. articulation_points -
        5. Incremental Connected Components +
        6. adjacency_iterator +
        7. inv_adjacency_iterator +
        +
      5. Traits classes +
          +
        1. graph_traits +
        2. adjacency_list_traits +
        3. property_map +
        +
      6. Algorithms +
          +
        1. Named parameters (used in many graph algorithms) +
        2. Basic Operations +
            +
          1. copy_graph +
          2. transpose_graph +
          +
        3. Core Searches
            +
          1. breadth_first_search +
          2. breadth_first_visit +
          3. depth_first_search +
          4. depth_first_visit +
          5. undirected_dfs +
          + +
        4. Other Core Algorithms +
            +
          1. topological_sort +
          2. transitive_closure +
          3. lengauer_tarjan_dominator_tree
          4. +
          + +
        5. Shortest Paths / Cost Minimization Algorithms +
            +
          1. dijkstra_shortest_paths +
          2. dijkstra_shortest_paths_no_color_map +
          3. bellman_ford_shortest_paths +
          4. dag_shortest_paths +
          5. johnson_all_pairs_shortest_paths +
          6. floyd_warshall_all_pairs_shortest_paths
          7. +
          8. r_c_shortest_paths - resource-constrained shortest paths
          9. +
          10. astar_search
          11. +
          +
        6. Minimum Spanning Tree Algorithms +
            +
          1. kruskal_minimum_spanning_tree +
          2. prim_minimum_spanning_tree +
          +
        7. Connected Components Algorithms +
            +
          1. connected_components +
          2. strong_components + +
          3. biconnected_components +
          4. articulation_points +
          5. Incremental Connected Components +
            1. initialize_incremental_components
            2. incremental_components
            3. same_component
            4. component_index -
            -
        8. -
        9. Maximum Flow and Matching Algorithms -
            -
          1. edmonds_karp_max_flow -
          2. push_relabel_max_flow -
          3. kolmogorov_max_flow
          4. -
          5. edmonds_maximum_cardinality_matching -
          +
        +
    11. +
    12. Maximum Flow and Matching Algorithms +
        +
      1. edmonds_karp_max_flow +
      2. push_relabel_max_flow +
      3. kolmogorov_max_flow
      4. +
      5. edmonds_maximum_cardinality_matching +
      -
    13. Sparse Matrix Ordering Algorithms -
        -
      1. cuthill_mckee_ordering -
      2. king_ordering
      3. -
      4. minimum_degree_ordering +
      5. Sparse Matrix Ordering Algorithms +
          +
        1. cuthill_mckee_ordering +
        2. king_ordering
        3. +
        4. minimum_degree_ordering +
        5. sloan_ordering
        6. +
        7. sloan_start_end_vertices
        8. +
        +
      6. +
      7. Graph Metrics +
          +
        1. ith_wavefront, max_wavefront, aver_wavefront, and rms_wavefront
        2. +
        3. bandwidth +
        4. ith_bandwidth +
        5. brandes_betweenness_centrality
        6. +
        7. minimum_cycle_ratio and maximum_cycle_ratio
        8. +
        +
      8. +
      9. Graph Structure Comparisons +
          +
        1. isomorphism +
        2. mcgregor_common_subgraphs
        3. +
        + +
      10. Layout Algorithms +
          +
        1. random_graph_layout
        2. +
        3. circle_layout
        4. +
        5. kamada_kawai_spring_layout
        6. +
        7. fruchterman_reingold_force_directed_layout
        8. +
        9. gursoy_atun_layout
        -
      11. -
      12. topological_sort -
      13. transitive_closure -
      14. copy_graph -
      15. transpose_graph -
      16. isomorphism - -
      17. Path and Tour Algorithms -
          -
        1. metric_tsp_approx
        2. -
        -
      18. - -
      19. sequential_vertex_coloring -
      20. sloan_ordering
      21. -
      22. sloan_start_end_vertices
      23. - -
      24. ith_wavefront, max_wavefront, aver_wavefront, and rms_wavefront
      25. -
      26. brandes_betweenness_centrality
      27. -
      28. Layout algorithms +
      29. +
      30. Clustering algorithms
          -
        1. random_graph_layout
        2. -
        3. circle_layout
        4. -
        5. kamada_kawai_spring_layout
        6. -
        7. fruchterman_reingold_force_directed_layout
        8. -
        9. gursoy_atun_layout
        10. -
        -
      31. -
      32. Clustering algorithms -
          -
        1. betweenness_centrality_clustering
        2. -
        -
      33. -
      34. astar_search
      35. -
      36. lengauer_tarjan_dominator_tree
      37. -
      38. minimum_cycle_ratio and maximum_cycle_ratio
      39. -
      40. Planar Graph Algorithms -
          -
        1. - boyer_myrvold_planarity_test -
        2. - planar_face_traversal -
        3. - planar_canonical_ordering -
        4. - chrobak_payne_straight_line_drawing -
        5. - is_straight_line_drawing -
        6. - is_kuratowski_subgraph -
        7. - make_connected -
        8. - make_biconnected_planar -
        9. - make_maximal_planar -
        -
      41. lengauer_tarjan_dominator_tree
      42. -
      43. mcgregor_common_subgraphs
      44. -
      -
    +
  • betweenness_centrality_clustering
  • + + +
  • Planar Graph Algorithms +
      +
    1. + boyer_myrvold_planarity_test +
    2. + planar_face_traversal +
    3. + planar_canonical_ordering +
    4. + chrobak_payne_straight_line_drawing +
    5. + is_straight_line_drawing +
    6. + is_kuratowski_subgraph +
    7. + make_connected +
    8. + make_biconnected_planar +
    9. + make_maximal_planar +
    + +
  • Miscellaneous Algorithms +
      +
    1. metric_tsp_approx
    2. +
    3. sequential_vertex_coloring +
    +
  • + +
  • Graph Input/Output
      @@ -268,18 +284,16 @@
    1. BasicMatrix
    2. incident
    3. opposite -
    4. bandwidth -
    5. ith_bandwidth
    6. Tools for random graphs
      1. random_vertex
      2. random_edge
      3. generate_random_graph
      4. randomize_property -
      5. erdos_renyi_iterator
      6. -
      7. sorted_erdos_renyi_iterator
      8. -
      9. plod_iterator
      10. -
      11. small_world_iterator
      12. +
      13. erdos_renyi_iterator
      14. +
      15. sorted_erdos_renyi_iterator
      16. +
      17. plod_iterator
      18. +
      19. small_world_iterator
  • Challenge and To-Do List diff --git a/doc/transitive_closure.html b/doc/transitive_closure.html index e8793304..58c33182 100644 --- a/doc/transitive_closure.html +++ b/doc/transitive_closure.html @@ -56,8 +56,9 @@ Thanks to Vladimir Prus for the implementation of this algorithm! IN: const Graph& g
    A directed graph, where the Graph type must model the - Vertex List Graph - and Adjacency Graph concepts.
    + Vertex List Graph, + Adjacency Graph, + and Adjacency Matrix concepts.
    Python: The parameter is named graph.
    diff --git a/example/labeled_graph.cpp b/example/labeled_graph.cpp index b1d8c243..fdcdd4b6 100644 --- a/example/labeled_graph.cpp +++ b/example/labeled_graph.cpp @@ -7,8 +7,6 @@ #include #include -#define BOOST_NO_HASH - #include #include diff --git a/include/boost/graph/adjacency_list.hpp b/include/boost/graph/adjacency_list.hpp index 6ba8f435..625ab24d 100644 --- a/include/boost/graph/adjacency_list.hpp +++ b/include/boost/graph/adjacency_list.hpp @@ -17,16 +17,7 @@ #include #include -// TODO: Deprecating this requires some cooperation from Boost.Config. It's not -// a good idea to just refuse the inclusion because it could break otherwise -// functioning code. -#if !defined BOOST_NO_HASH -# ifdef BOOST_HASH_SET_HEADER -# include BOOST_HASH_SET_HEADER -# else -# include -# endif -#endif +#include #if !defined BOOST_NO_SLIST # ifdef BOOST_SLIST_HEADER @@ -73,12 +64,10 @@ namespace boost { struct mapS { }; struct multisetS { }; struct multimapS { }; -#if !defined BOOST_NO_HASH struct hash_setS { }; struct hash_mapS { }; struct hash_multisetS { }; struct hash_multimapS { }; -#endif template struct container_gen { }; @@ -118,27 +107,25 @@ namespace boost { typedef std::multiset type; }; -#if !defined BOOST_NO_HASH template struct container_gen { - typedef BOOST_STD_EXTENSION_NAMESPACE::hash_set type; + typedef boost::unordered_set type; }; template struct container_gen { - typedef BOOST_STD_EXTENSION_NAMESPACE::hash_set type; + typedef boost::unordered_set type; }; template struct container_gen { - typedef BOOST_STD_EXTENSION_NAMESPACE::hash_multiset type; + typedef boost::unordered_multiset type; }; template struct container_gen { - typedef BOOST_STD_EXTENSION_NAMESPACE::hash_multiset type; + typedef boost::unordered_multiset type; }; -#endif #else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION @@ -180,27 +167,25 @@ namespace boost { struct bind_ { typedef std::multiset > type; }; }; -#if !defined BOOST_NO_HASH struct hash_setS { template - struct bind_ { typedef BOOST_STD_EXTENSION_NAMESPACE::hash_set > type; }; + struct bind_ { typedef boost::unordered_set type; }; }; struct hash_mapS { template - struct bind_ { typedef BOOST_STD_EXTENSION_NAMESPACE::hash_set > type; }; + struct bind_ { typedef boost::unordered_set type; }; }; struct hash_multisetS { template - struct bind_ { typedef BOOST_STD_EXTENSION_NAMESPACE::hash_multiset > type; }; + struct bind_ { typedef boost::unordered_multiset type; }; }; struct hash_multimapS { template - struct bind_ { typedef BOOST_STD_EXTENSION_NAMESPACE::hash_multiset > type; }; + struct bind_ { typedef boost::unordered_multiset type; }; }; -#endif template struct container_selector { typedef vecS type; @@ -216,9 +201,7 @@ namespace boost { BOOST_CONTAINER_SELECTOR(mapS); BOOST_CONTAINER_SELECTOR(setS); BOOST_CONTAINER_SELECTOR(multisetS); -#if !defined BOOST_NO_HASH BOOST_CONTAINER_SELECTOR(hash_mapS); -#endif #if !defined BOOST_NO_SLIST BOOST_CONTAINER_SELECTOR(slistS); #endif @@ -256,24 +239,20 @@ namespace boost { struct parallel_edge_traits { typedef allow_parallel_edge_tag type; }; -#if !defined BOOST_NO_HASH template <> struct parallel_edge_traits { typedef disallow_parallel_edge_tag type; }; -#endif // mapS is obsolete, replaced with setS template <> struct parallel_edge_traits { typedef disallow_parallel_edge_tag type; }; -#if !defined BOOST_NO_HASH template <> struct parallel_edge_traits { typedef disallow_parallel_edge_tag type; }; -#endif namespace detail { template struct is_random_access { diff --git a/include/boost/graph/adjacency_list_io.hpp b/include/boost/graph/adjacency_list_io.hpp index 326d490d..91b0b465 100644 --- a/include/boost/graph/adjacency_list_io.hpp +++ b/include/boost/graph/adjacency_list_io.hpp @@ -94,7 +94,7 @@ void getSubset } inline void getSubset -( no_property& p, const no_property& s ) +( no_property&, const no_property& ) { } diff --git a/include/boost/graph/adjacency_matrix.hpp b/include/boost/graph/adjacency_matrix.hpp index cf02a1d6..a3694dab 100644 --- a/include/boost/graph/adjacency_matrix.hpp +++ b/include/boost/graph/adjacency_matrix.hpp @@ -925,18 +925,19 @@ namespace boost { // Functions required by the MutableGraph concept // O(1) - template + template std::pair::edge_descriptor, bool> add_edge(typename adjacency_matrix::vertex_descriptor u, typename adjacency_matrix::vertex_descriptor v, - const EP& ep, + const EP2& ep, adjacency_matrix& g) { typedef typename adjacency_matrix::edge_descriptor edge_descriptor; if (detail::get_edge_exists(g.get_edge(u,v), 0) == false) { ++(g.m_num_edges); - detail::set_property(g.get_edge(u,v), ep, 0); + detail::set_property(g.get_edge(u,v), EP(ep), 0); detail::set_edge_exists(g.get_edge(u,v), true, 0); return std::make_pair (edge_descriptor(true, u, v, &detail::get_property(g.get_edge(u,v))), @@ -989,9 +990,10 @@ namespace boost { return *vertices(g).first; } - template + template inline typename adjacency_matrix::vertex_descriptor - add_vertex(const VP& vp, adjacency_matrix& g) { + add_vertex(const VP2& /*vp*/, adjacency_matrix& g) { // UNDER CONSTRUCTION assert(false); return *vertices(g).first; @@ -999,8 +1001,8 @@ namespace boost { template inline void - remove_vertex(typename adjacency_matrix::vertex_descriptor u, - adjacency_matrix& g) + remove_vertex(typename adjacency_matrix::vertex_descriptor /*u*/, + adjacency_matrix& /*g*/) { // UNDER CONSTRUCTION assert(false); @@ -1298,7 +1300,7 @@ namespace boost { template typename adjacency_matrix::vertex_descriptor vertex(typename adjacency_matrix::vertices_size_type n, - const adjacency_matrix& g) + const adjacency_matrix&) { return n; } diff --git a/include/boost/graph/astar_search.hpp b/include/boost/graph/astar_search.hpp index 25342e82..4f956329 100644 --- a/include/boost/graph/astar_search.hpp +++ b/include/boost/graph/astar_search.hpp @@ -238,9 +238,9 @@ namespace boost { AStarHeuristic h, AStarVisitor vis, PredecessorMap predecessor, CostMap cost, DistanceMap distance, WeightMap weight, - ColorMap color, VertexIndexMap index_map, + ColorMap color, VertexIndexMap /*index_map*/, CompareFunction compare, CombineFunction combine, - CostInf inf, CostZero zero) + CostInf /*inf*/, CostZero zero) { typedef typename graph_traits::vertex_descriptor Vertex; diff --git a/include/boost/graph/biconnected_components.hpp b/include/boost/graph/biconnected_components.hpp index ac220659..03459636 100644 --- a/include/boost/graph/biconnected_components.hpp +++ b/include/boost/graph/biconnected_components.hpp @@ -83,9 +83,9 @@ namespace boost put(lowpt, source(e, g), min BOOST_PREVENT_MACRO_SUBSTITUTION(get(lowpt, source(e, g)), get(dtm, target(e, g)))); + } vis.back_edge(e, g); } - } template void forward_or_cross_edge(const Edge& e, Graph& g) diff --git a/include/boost/graph/bron_kerbosch_all_cliques.hpp b/include/boost/graph/bron_kerbosch_all_cliques.hpp index bf7e3ff4..f6d253b1 100644 --- a/include/boost/graph/bron_kerbosch_all_cliques.hpp +++ b/include/boost/graph/bron_kerbosch_all_cliques.hpp @@ -12,6 +12,7 @@ #include #include +#include #include namespace boost { @@ -125,9 +126,7 @@ namespace detail typename graph_traits::vertex_descriptor v, typename graph_traits::undirected_category) { - function_requires< AdjacencyMatrixConcept >(); - - return edge(u, v, g).second; + return lookup_edge(u, v, g).second; } template @@ -137,13 +136,12 @@ namespace detail typename graph_traits::vertex_descriptor v, typename graph_traits::directed_category) { - function_requires< AdjacencyMatrixConcept >(); // Note that this could alternate between using an || to determine // full connectivity. I believe that this should produce strongly // connected components. Note that using && instead of || will // change the results to a fully connected subgraph (i.e., symmetric // edges between all vertices s.t., if a->b, then b->a. - return edge(u, v, g).second && edge(v, u, g).second; + return lookup_edge(u, v, g).second && lookup_edge(v, u, g).second; } template @@ -189,7 +187,7 @@ namespace detail for(ni = nots.begin(); ni != nend; ++ni) { for(ci = cands.begin(); ci != cend; ++ci) { // if we don't find an edge, then we're okay. - if(!edge(*ni, *ci, g).second) break; + if(!lookup_edge(*ni, *ci, g).second) break; } // if we iterated all the way to the end, then *ni // is connected to all *ci diff --git a/include/boost/graph/clustering_coefficient.hpp b/include/boost/graph/clustering_coefficient.hpp index c84c4802..e5f94d9f 100644 --- a/include/boost/graph/clustering_coefficient.hpp +++ b/include/boost/graph/clustering_coefficient.hpp @@ -10,6 +10,7 @@ #include #include #include +#include namespace boost { @@ -42,8 +43,8 @@ namespace detail { function_requires< AdjacencyMatrixConcept >(); - return (edge(u, v, g).second ? 1 : 0) + - (edge(v, u, g).second ? 1 : 0); + return (lookup_edge(u, v, g).second ? 1 : 0) + + (lookup_edge(v, u, g).second ? 1 : 0); } // This template matches undirectedS @@ -55,7 +56,7 @@ namespace detail undirected_tag) { function_requires< AdjacencyMatrixConcept >(); - return edge(u, v, g).second ? 1 : 0; + return lookup_edge(u, v, g).second ? 1 : 0; } } diff --git a/include/boost/graph/compressed_sparse_row_graph.hpp b/include/boost/graph/compressed_sparse_row_graph.hpp index b4f01352..7b62b3b2 100644 --- a/include/boost/graph/compressed_sparse_row_graph.hpp +++ b/include/boost/graph/compressed_sparse_row_graph.hpp @@ -47,17 +47,6 @@ # error You will need a compiler that conforms better to the C++ standard. #endif -#ifndef BOOST_GRAPH_USE_NEW_CSR_INTERFACE -#warning "Using deprecated BGL compressed sparse row graph interface --" -#warning "please see the documentation for the new interface and then" -#warning "#define BOOST_GRAPH_USE_NEW_CSR_INTERFACE before including" -#warning "" -#endif // BOOST_GRAPH_USE_NEW_CSR_INTERFACE - -#ifndef BOOST_GRAPH_USE_NEW_CSR_INTERFACE -#define BOOST_GRAPH_USE_OLD_CSR_INTERFACE -#endif - namespace boost { // A tag type indicating that the graph in question is a compressed @@ -69,7 +58,6 @@ struct csr_graph_tag; // vertex. enum edges_are_sorted_t {edges_are_sorted}; -#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE // A type (edges_are_sorted_global_t) and a value (edges_are_sorted_global) // used to indicate that the edge list passed into the CSR graph is already // sorted by source vertex. @@ -122,8 +110,6 @@ enum construct_inplace_from_sources_and_targets_global_t {construct_inplace_from // distributed CSR constructors. enum edges_are_unsorted_global_t {edges_are_unsorted_global}; -#endif // BOOST_GRAPH_USE_NEW_CSR_INTERFACE - /**************************************************************************** * Local helper macros to reduce typing and clutter later on. * ****************************************************************************/ @@ -146,7 +132,6 @@ enum edges_are_unsorted_global_t {edges_are_unsorted_global}; compressed_sparse_row_graph -#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE namespace detail { template struct default_construct_iterator: public boost::iterator_facade, T, boost::random_access_traversal_tag, const T&> { @@ -179,7 +164,6 @@ namespace detail { } }; } -#endif // BOOST_GRAPH_USE_NEW_CSR_INTERFACE /** Compressed sparse row graph. * @@ -271,7 +255,6 @@ class compressed_sparse_row_graph compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, @@ -327,38 +310,6 @@ class compressed_sparse_row_graph - compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, - vertices_size_type numverts, - edges_size_type numedges = 0, - const GraphProperty& prop = GraphProperty()) - : m_property(prop) - { - m_forward.assign_from_sorted_edges(edge_begin, edge_end, identity_property_map(), keep_all(), numverts, numedges); - inherited_vertex_properties::resize(numverts); - } - - // From number of vertices and sorted list of edges (deprecated - // interface) - template - compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, - EdgePropertyIterator ep_iter, - vertices_size_type numverts, - edges_size_type numedges = 0, - const GraphProperty& prop = GraphProperty()) - : m_property(prop) - { - m_forward.assign_from_sorted_edges(edge_begin, edge_end, ep_iter, identity_property_map(), keep_all(), numverts, numedges); - inherited_vertex_properties::resize(numverts); - } - -#endif // BOOST_GRAPH_USE_OLD_CSR_INTERFACE // From number of vertices and sorted list of edges (new interface) template @@ -387,7 +338,6 @@ class compressed_sparse_row_graph compressed_sparse_row_graph(edges_are_sorted_global_t, @@ -556,8 +506,6 @@ class compressed_sparse_row_graph @@ -635,7 +583,6 @@ class compressed_sparse_row_graphadd_edges_internal(first, last, ep_iter, ep_iter_end, identity_property_map()); } -#endif // BOOST_GRAPH_USE_NEW_CSR_INTERFACE using inherited_vertex_properties::operator[]; @@ -775,8 +721,6 @@ class compressed_sparse_row_graph @@ -1185,44 +1128,6 @@ add_vertices(typename BOOST_DIR_CSR_GRAPH_TYPE::vertices_size_type count, BOOST_ return old_num_verts_plus_one - 1; } -#ifdef BOOST_GRAPH_USE_OLD_CSR_INTERFACE -// This function requires that (src, tgt) be lexicographically at least as -// large as the largest edge in the graph so far -template -inline typename BOOST_DIR_CSR_GRAPH_TYPE::edge_descriptor -add_edge(Vertex src, Vertex tgt, BOOST_DIR_CSR_GRAPH_TYPE& g) { - assert ((g.m_last_source == 0 || src >= g.m_last_source - 1) && - src < num_vertices(g)); - EdgeIndex num_edges_orig = g.m_forward.m_column.size(); - for (; g.m_last_source <= src; ++g.m_last_source) - g.m_forward.m_rowstart[g.m_last_source] = num_edges_orig; - g.m_forward.m_rowstart[src + 1] = num_edges_orig + 1; - g.m_forward.m_column.push_back(tgt); - typedef typename BOOST_DIR_CSR_GRAPH_TYPE::edge_push_back_type push_back_type; - g.edge_properties().push_back(push_back_type()); - return typename BOOST_DIR_CSR_GRAPH_TYPE::edge_descriptor(src, num_edges_orig); -} - -// This function requires that src be at least as large as the largest source -// in the graph so far -template -inline typename BOOST_DIR_CSR_GRAPH_TYPE::edge_descriptor -add_edge(Vertex src, Vertex tgt, - typename BOOST_DIR_CSR_GRAPH_TYPE::edge_bundled const& p, - BOOST_DIR_CSR_GRAPH_TYPE& g) { - assert ((g.m_last_source == 0 || src >= g.m_last_source - 1) && - src < num_vertices(g)); - EdgeIndex num_edges_orig = g.m_forward.m_column.size(); - for (; g.m_last_source <= src; ++g.m_last_source) - g.m_forward.m_rowstart[g.m_last_source] = num_edges_orig; - g.m_forward.m_rowstart[src + 1] = num_edges_orig + 1; - g.m_forward.m_column.push_back(tgt); - g.edge_properties().push_back(p); - return typename BOOST_DIR_CSR_GRAPH_TYPE::edge_descriptor(src, num_edges_orig); -} -#endif // BOOST_GRAPH_USE_OLD_CSR_INTERFACE - -#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE // Add edges from a sorted (smallest sources first) range of pairs and edge // properties template @@ -1340,21 +1244,6 @@ target(typename BOOST_CSR_GRAPH_TYPE::edge_descriptor e, return g.m_forward.m_column[e.idx]; } -namespace detail { - template - inline EdgeIndex get_actual_row_start - (const BOOST_CSR_GRAPH_TYPE& g, - EdgeIndex rowstart_i_minus_1, EdgeIndex rowstart_i) - { -#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE - return rowstart_i; -#else - // Special case to allow incremental construction - return (std::max)(rowstart_i_minus_1, rowstart_i); -#endif - } -} - template inline std::pair @@ -1365,8 +1254,7 @@ out_edges(Vertex v, const BOOST_CSR_GRAPH_TYPE& g) EdgeIndex v_row_start = g.m_forward.m_rowstart[v]; EdgeIndex next_row_start = g.m_forward.m_rowstart[v + 1]; return std::make_pair(it(ed(v, v_row_start)), - it(ed(v, detail::get_actual_row_start - (g, v_row_start, next_row_start)))); + it(ed(v, next_row_start))); } template @@ -1375,11 +1263,9 @@ out_degree(Vertex v, const BOOST_CSR_GRAPH_TYPE& g) { EdgeIndex v_row_start = g.m_forward.m_rowstart[v]; EdgeIndex next_row_start = g.m_forward.m_rowstart[v + 1]; - return detail::get_actual_row_start(g, v_row_start, next_row_start) - v_row_start; + return next_row_start - v_row_start; } -#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE - template inline std::pair @@ -1402,8 +1288,6 @@ in_degree(Vertex v, const BOOST_BIDIR_CSR_GRAPH_TYPE& g) return next_row_start - v_row_start; } -#endif // BOOST_GRAPH_USE_NEW_CSR_INTERFACE - // From AdjacencyGraph template inline std::pair::vertex_descriptor i, return i; } -#ifdef BOOST_GRAPH_USE_OLD_CSR_INTERFACE -// These require that the out edges from a vertex are sorted, which is only -// guaranteed by the old interface - -// Unlike for an adjacency_matrix, edge_range and edge take lg(out_degree(i)) -// time -template -inline std::pair -edge_range(Vertex i, Vertex j, const BOOST_CSR_GRAPH_TYPE& g) -{ - typedef typename std::vector::const_iterator adj_iter; - typedef typename BOOST_CSR_GRAPH_TYPE::out_edge_iterator out_edge_iter; - typedef typename BOOST_CSR_GRAPH_TYPE::edge_descriptor edge_desc; - std::pair raw_adjacencies = adjacent_vertices(i, g); - std::pair adjacencies = - std::equal_range(raw_adjacencies.first, raw_adjacencies.second, j); - EdgeIndex idx_begin = adjacencies.first - g.m_forward.m_column.begin(); - EdgeIndex idx_end = adjacencies.second - g.m_forward.m_column.begin(); - return std::make_pair(out_edge_iter(edge_desc(i, idx_begin)), - out_edge_iter(edge_desc(i, idx_end))); -} - -template -inline std::pair -edge(Vertex i, Vertex j, const BOOST_CSR_GRAPH_TYPE& g) -{ - typedef typename BOOST_CSR_GRAPH_TYPE::out_edge_iterator out_edge_iter; - std::pair range = edge_range(i, j, g); - if (range.first == range.second) - return std::make_pair(typename BOOST_CSR_GRAPH_TYPE::edge_descriptor(), - false); - else - return std::make_pair(*range.first, true); -} - -#else // !BOOST_GRAPH_USE_OLD_CSR_INTERFACE // edge() can be provided in linear time for the new interface template @@ -1480,8 +1325,6 @@ edge(Vertex i, Vertex j, const BOOST_CSR_GRAPH_TYPE& g) false); } -#endif // !BOOST_GRAPH_USE_OLD_CSR_INTERFACE - // Find an edge given its index in the graph template inline typename BOOST_CSR_GRAPH_TYPE::edge_descriptor @@ -1491,14 +1334,7 @@ edge_from_index(EdgeIndex idx, const BOOST_CSR_GRAPH_TYPE& g) assert (idx < num_edges(g)); row_start_iter src_plus_1 = std::upper_bound(g.m_forward.m_rowstart.begin(), -#ifdef BOOST_GRAPH_USE_OLD_CSR_INTERFACE - // This handles the case where there are some vertices - // with rowstart 0 after the last provided vertex; this - // case does not happen with the new interface - g.m_forward.m_rowstart.begin() + g.m_last_source + 1, -#else // !BOOST_GRAPH_USE_OLD_CSR_INTERFACE g.m_forward.m_rowstart.end(), -#endif // BOOST_GRAPH_USE_OLD_CSR_INTERFACE idx); // Get last source whose rowstart is at most idx // upper_bound returns this position plus 1 diff --git a/include/boost/graph/core_numbers.hpp b/include/boost/graph/core_numbers.hpp index 743c81f9..da072bf1 100644 --- a/include/boost/graph/core_numbers.hpp +++ b/include/boost/graph/core_numbers.hpp @@ -86,7 +86,7 @@ namespace boost { template core_numbers_visitor make_core_numbers_visitor(Visitors vis) - { return core_numbers_visitor(vis); }; + { return core_numbers_visitor(vis); } typedef core_numbers_visitor<> default_core_numbers_visitor; diff --git a/include/boost/graph/dag_shortest_paths.hpp b/include/boost/graph/dag_shortest_paths.hpp index cc071de1..d8b47ac6 100644 --- a/include/boost/graph/dag_shortest_paths.hpp +++ b/include/boost/graph/dag_shortest_paths.hpp @@ -83,7 +83,7 @@ namespace boost { dag_sp_dispatch2 (const VertexListGraph& g, typename graph_traits::vertex_descriptor s, - DistanceMap distance, WeightMap weight, ColorMap color, IndexMap id, + DistanceMap distance, WeightMap weight, ColorMap color, IndexMap /*id*/, DijkstraVisitor vis, const Params& params) { typedef typename property_traits::value_type D; diff --git a/include/boost/graph/depth_first_search.hpp b/include/boost/graph/depth_first_search.hpp index 1bf06671..fcc61646 100644 --- a/include/boost/graph/depth_first_search.hpp +++ b/include/boost/graph/depth_first_search.hpp @@ -193,7 +193,8 @@ namespace boost { typename graph_traits::vertex_iterator ui, ui_end; for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) { - put(color, *ui, Color::white()); vis.initialize_vertex(*ui, g); + Vertex u = implicit_cast(*ui); + put(color, u, Color::white()); vis.initialize_vertex(u, g); } if (start_vertex != implicit_cast(*vertices(g).first)){ vis.start_vertex(start_vertex, g); @@ -202,9 +203,10 @@ namespace boost { } for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) { - ColorValue u_color = get(color, *ui); - if (u_color == Color::white()) { vis.start_vertex(*ui, g); - detail::depth_first_visit_impl(g, *ui, vis, color, detail::nontruth2()); + Vertex u = implicit_cast(*ui); + ColorValue u_color = get(color, u); + if (u_color == Color::white()) { vis.start_vertex(u, g); + detail::depth_first_visit_impl(g, u, vis, color, detail::nontruth2()); } } } diff --git a/include/boost/graph/detail/adjacency_list.hpp b/include/boost/graph/detail/adjacency_list.hpp index c02a310b..674942e1 100644 --- a/include/boost/graph/detail/adjacency_list.hpp +++ b/include/boost/graph/detail/adjacency_list.hpp @@ -1183,13 +1183,11 @@ namespace boost { multisetS*) { return edge_range(source(e, g), target(e, g), g); } -#if !defined BOOST_NO_HASH std::pair get_parallel_edge_sublist(typename Config::edge_descriptor e, const graph_type& g, hash_setS*) { return edge_range(source(e, g), target(e, g), g); } -#endif // Placement of these overloaded remove_edge() functions // inside the class avoids a VC++ bug. @@ -2297,7 +2295,7 @@ namespace boost { // VertexList and vertex_iterator typedef typename container_gen::type SeqVertexList; - typedef boost::integer_range RandVertexList; + typedef boost::integer_range RandVertexList; typedef typename mpl::if_::type VertexList; @@ -2785,8 +2783,8 @@ namespace boost { } // namespace boost -#if !defined(BOOST_NO_HASH) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) -namespace BOOST_STD_EXTENSION_NAMESPACE { +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +namespace boost { #if BOOST_WORKAROUND( _STLPORT_VERSION, >= 0x500 ) // STLport 5 already defines a hash specialization. diff --git a/include/boost/graph/detail/compressed_sparse_row_struct.hpp b/include/boost/graph/detail/compressed_sparse_row_struct.hpp index 1146c77d..6b4e3913 100644 --- a/include/boost/graph/detail/compressed_sparse_row_struct.hpp +++ b/include/boost/graph/detail/compressed_sparse_row_struct.hpp @@ -81,17 +81,9 @@ namespace detail { std::vector m_rowstart; std::vector m_column; -#ifdef BOOST_GRAPH_USE_OLD_CSR_INTERFACE - // This member is only needed to support add_edge(), which is not provided by - // the new interface - Vertex m_last_source; // Last source of added edge, plus one -#endif // BOOST_GRAPH_USE_OLD_CSR_INTERFACE compressed_sparse_row_structure(Vertex numverts = 0) : m_rowstart(numverts + 1, EdgeIndex(0)), m_column() -#ifdef BOOST_GRAPH_USE_OLD_CSR_INTERFACE - , m_last_source(numverts) -#endif {} // Rebuild graph from number of vertices and multi-pass unsorted list of @@ -251,7 +243,7 @@ namespace detail { (sources.begin(), sources.end(), m_rowstart.begin(), numverts, keep_all(), boost::make_property_map_function(global_to_local)); boost::graph::detail::histogram_sort_inplace - (sources.begin(), sources.end(), m_rowstart.begin(), numverts, + (sources.begin(), m_rowstart.begin(), numverts, targets.begin(), boost::make_property_map_function(global_to_local)); // Now targets is the correct vector (properly sorted by source) for // m_column @@ -277,7 +269,7 @@ namespace detail { (sources.begin(), sources.end(), m_rowstart.begin(), numverts, keep_all(), boost::make_property_map_function(global_to_local)); boost::graph::detail::histogram_sort_inplace - (sources.begin(), sources.end(), m_rowstart.begin(), numverts, + (sources.begin(), m_rowstart.begin(), numverts, targets.begin(), edge_props.begin(), boost::make_property_map_function(global_to_local)); // Now targets is the correct vector (properly sorted by source) for @@ -310,24 +302,12 @@ namespace detail { for (Vertex i = 0; i != numverts; ++i) { m_rowstart[i] = current_edge; g_vertex v = ordered_verts_of_g[i]; -#ifdef BOOST_GRAPH_USE_OLD_CSR_INTERFACE - // Out edges in a single vertex are only sorted for the old interface - EdgeIndex num_edges_before_this_vertex = current_edge; -#endif // BOOST_GRAPH_USE_OLD_CSR_INTERFACE g_out_edge_iter ei, ei_end; for (tie(ei, ei_end) = out_edges(v, g); ei != ei_end; ++ei) { m_column[current_edge++] = get(vi, target(*ei, g)); } -#ifdef BOOST_GRAPH_USE_OLD_CSR_INTERFACE - // Out edges in a single vertex are only sorted for the old interface - std::sort(m_column.begin() + num_edges_before_this_vertex, - m_column.begin() + current_edge); -#endif // BOOST_GRAPH_USE_OLD_CSR_INTERFACE } m_rowstart[numverts] = current_edge; -#ifdef BOOST_GRAPH_USE_OLD_CSR_INTERFACE - m_last_source = numverts; -#endif // BOOST_GRAPH_USE_OLD_CSR_INTERFACE } // Add edges from a sorted (smallest sources first) range of pairs and edge diff --git a/include/boost/graph/detail/histogram_sort.hpp b/include/boost/graph/detail/histogram_sort.hpp index 9706d254..742c6f96 100644 --- a/include/boost/graph/detail/histogram_sort.hpp +++ b/include/boost/graph/detail/histogram_sort.hpp @@ -148,7 +148,7 @@ template void -histogram_sort_inplace(KeyIterator key_begin, KeyIterator key_end, +histogram_sort_inplace(KeyIterator key_begin, RowstartIterator rowstart, // Must support numkeys + 1 elements and be precomputed NumKeys numkeys, Value1Iter values1, @@ -181,7 +181,7 @@ template void -histogram_sort_inplace(KeyIterator key_begin, KeyIterator key_end, +histogram_sort_inplace(KeyIterator key_begin, RowstartIterator rowstart, // Must support numkeys + 1 elements and be precomputed NumKeys numkeys, Value1Iter values1, diff --git a/include/boost/graph/dll_import_export.hpp b/include/boost/graph/dll_import_export.hpp new file mode 100644 index 00000000..cc369d1d --- /dev/null +++ b/include/boost/graph/dll_import_export.hpp @@ -0,0 +1,30 @@ +//======================================================================= +// Copyright 2001 University of Notre Dame. +// Copyright 2003 Jeremy Siek +// Authors: Lie-Quan Lee, Jeremy Siek, and Douglas Gregor +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +//======================================================================= + +#ifndef BOOST_GRAPH_DLL_IMPORT_EXPORT_HPP +#define BOOST_GRAPH_DLL_IMPORT_EXPORT_HPP + +#include + +#ifdef BOOST_HAS_DECLSPEC +# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_GRAPH_DYN_LINK) +# ifdef BOOST_GRAPH_SOURCE +# define BOOST_GRAPH_DECL __declspec(dllexport) +# else +# define BOOST_GRAPH_DECL __declspec(dllimport) +# endif // BOOST_GRAPH_SOURCE +# endif // DYN_LINK +#endif // BOOST_HAS_DECLSPEC + +#ifndef BOOST_GRAPH_DECL +# define BOOST_GRAPH_DECL +#endif + +#endif // BOOST_GRAPH_DLL_IMPORT_EXPORT_HPP diff --git a/include/boost/graph/dominator_tree.hpp b/include/boost/graph/dominator_tree.hpp index cf0d310e..0c19a407 100644 --- a/include/boost/graph/dominator_tree.hpp +++ b/include/boost/graph/dominator_tree.hpp @@ -236,7 +236,7 @@ namespace boost { lengauer_tarjan_dominator_tree_without_dfs (const Graph& g, const typename graph_traits::vertex_descriptor& entry, - const IndexMap& indexMap, + const IndexMap& /*indexMap*/, TimeMap dfnumMap, PredMap parentMap, VertexVector& verticesByDFNum, DomTreePredMap domTreePredMap) { diff --git a/include/boost/graph/filtered_graph.hpp b/include/boost/graph/filtered_graph.hpp index 94b634df..4c5f1783 100644 --- a/include/boost/graph/filtered_graph.hpp +++ b/include/boost/graph/filtered_graph.hpp @@ -192,8 +192,6 @@ namespace boost { > edge_iterator; typedef typename Traits::edges_size_type edges_size_type; - typedef typename ::boost::edge_property_type::type edge_property_type; - typedef typename ::boost::vertex_property_type::type vertex_property_type; typedef filtered_graph_tag graph_tag; #ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES @@ -219,6 +217,22 @@ namespace boost { VertexPredicate m_vertex_pred; }; + // Do not instantiate these unless needed + template + struct vertex_property_type > { + typedef typename vertex_property_type::type type; + }; + + template + struct edge_property_type > { + typedef typename edge_property_type::type type; + }; + + #ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES template struct vertex_bundle_type bool floyd_warshall_init_dispatch(const VertexListGraph& g, - DistanceMatrix& d, WeightMap w, + DistanceMatrix& d, WeightMap /*w*/, const bgl_named_params& params) { typedef typename property_traits::value_type WM; diff --git a/include/boost/graph/geodesic_distance.hpp b/include/boost/graph/geodesic_distance.hpp index 042d39e4..a4d70274 100644 --- a/include/boost/graph/geodesic_distance.hpp +++ b/include/boost/graph/geodesic_distance.hpp @@ -83,7 +83,7 @@ struct mean_graph_distance_measure template inline mean_graph_distance_measure::value_type> -measure_graph_mean_geodesic(const Graph& g, DistanceMap dist) +measure_graph_mean_geodesic(const Graph&, DistanceMap) { typedef typename property_traits::value_type T; return mean_graph_distance_measure(); diff --git a/include/boost/graph/graph_traits.hpp b/include/boost/graph/graph_traits.hpp index b86ef0a8..89687b5d 100644 --- a/include/boost/graph/graph_traits.hpp +++ b/include/boost/graph/graph_traits.hpp @@ -181,6 +181,16 @@ namespace boost { >::value > { }; + + template + struct is_adjacency_matrix + : mpl::bool_< + is_convertible< + typename graph_traits::traversal_category, + adjacency_matrix_tag + >::value + > + { }; //@} /** @name Directed Graph Traits diff --git a/include/boost/graph/graphml.hpp b/include/boost/graph/graphml.hpp index f6256a0f..2193b4ce 100644 --- a/include/boost/graph/graphml.hpp +++ b/include/boost/graph/graphml.hpp @@ -16,70 +16,20 @@ #include #include #include +#include #include // for exceptions #include #include #include #include #include -#if 0 // Change this back later #include -#endif #include #include namespace boost { - // FIXME: Remove this once property_tree is stable - namespace graph_detail_from_property_tree { - -// ---------------------------------------------------------------------------- -// Copyright (C) 2002-2006 Marcin Kalicinski -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see www.boost.org -// ---------------------------------------------------------------------------- - - // Naively convert narrow string to another character type - template - std::basic_string widen(const char *text) - { - std::basic_string result; - while (*text) - { - result += Ch(*text); - ++text; - } - return result; - } - - template - std::basic_string encode_char_entities(const std::basic_string &s) - { - typedef typename std::basic_string Str; - Str r; - typename Str::const_iterator end = s.end(); - for (typename Str::const_iterator it = s.begin(); it != end; ++it) - { - switch (*it) - { - case Ch('<'): r += boost::graph_detail_from_property_tree::widen("<"); break; - case Ch('>'): r += boost::graph_detail_from_property_tree::widen(">"); break; - case Ch('&'): r += boost::graph_detail_from_property_tree::widen("&"); break; - case Ch('"'): r += boost::graph_detail_from_property_tree::widen("""); break; - case Ch('\''): r += boost::graph_detail_from_property_tree::widen("'"); break; - default: r += *it; break; - } - } - return r; - } - - } - ///////////////////////////////////////////////////////////////////////////// // Graph reader exceptions ///////////////////////////////////////////////////////////////////////////// @@ -279,8 +229,7 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index, typedef typename graph_traits::edge_descriptor edge_descriptor; typedef typename graph_traits::vertex_descriptor vertex_descriptor; - // using boost::property_tree::xml_parser::encode_char_entities; - using boost::graph_detail_from_property_tree::encode_char_entities; + using boost::property_tree::xml_parser::encode_char_entities; BOOST_STATIC_CONSTANT(bool, graph_is_directed = diff --git a/include/boost/graph/graphviz.hpp b/include/boost/graph/graphviz.hpp index c1f87375..52f3468a 100644 --- a/include/boost/graph/graphviz.hpp +++ b/include/boost/graph/graphviz.hpp @@ -24,20 +24,7 @@ #include #include #include - -#ifdef BOOST_HAS_DECLSPEC -# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_GRAPH_DYN_LINK) -# ifdef BOOST_GRAPH_SOURCE -# define BOOST_GRAPH_DECL __declspec(dllexport) -# else -# define BOOST_GRAPH_DECL __declspec(dllimport) -# endif // BOOST_GRAPH_SOURCE -# endif // DYN_LINK -#endif // BOOST_HAS_DECLSPEC - -#ifndef BOOST_GRAPH_DECL -# define BOOST_GRAPH_DECL -#endif +#include namespace boost { diff --git a/include/boost/graph/grid_graph.hpp b/include/boost/graph/grid_graph.hpp index 27cc256b..bda68d51 100644 --- a/include/boost/graph/grid_graph.hpp +++ b/include/boost/graph/grid_graph.hpp @@ -208,7 +208,7 @@ namespace boost { const Graph* m_graph; }; - }; // namespace detail + } // namespace detail //=========== // Grid Graph diff --git a/include/boost/graph/howard_cycle_ratio.hpp b/include/boost/graph/howard_cycle_ratio.hpp index 709499ff..119499a3 100644 --- a/include/boost/graph/howard_cycle_ratio.hpp +++ b/include/boost/graph/howard_cycle_ratio.hpp @@ -173,8 +173,8 @@ namespace boost { virtual ~mcr_howard() {} protected: - virtual void store_critical_edge(edge_t ed, critical_cycle_t &cc) {} - virtual void store_critical_cycle(critical_cycle_t &cc) {} + virtual void store_critical_edge(edge_t, critical_cycle_t &) {} + virtual void store_critical_cycle(critical_cycle_t &) {} private: /*! @@ -216,10 +216,10 @@ namespace boost { tie(oei, oeie) = out_edges(*vi, m_g); typename graph_traits::out_edge_iterator mei = std::max_element(oei, oeie, - bind(m_cmp, - bind(&EdgeWeight1::operator[], m_ew1m, _1), - bind(&EdgeWeight1::operator[], m_ew1m, _2) - ) + boost::bind(m_cmp, + boost::bind(&EdgeWeight1::operator[], m_ew1m, _1), + boost::bind(&EdgeWeight1::operator[], m_ew1m, _2) + ) ); if (mei == oeie) { @@ -334,10 +334,10 @@ namespace boost { tie(uv_itr, vie) = vertices(m_g); float_t mcr = m_bound; while ( (uv_itr = std::find_if(uv_itr, vie, - bind(std::equal_to(), - my_white, - bind(&color_map_t::operator[], vcm_, _1) - ) + boost::bind(std::equal_to(), + my_white, + boost::bind(&color_map_t::operator[], vcm_, _1) + ) ) ) != vie ) ///While there are undiscovered vertices diff --git a/include/boost/graph/is_straight_line_drawing.hpp b/include/boost/graph/is_straight_line_drawing.hpp index 1377e3e9..6b7c3905 100644 --- a/include/boost/graph/is_straight_line_drawing.hpp +++ b/include/boost/graph/is_straight_line_drawing.hpp @@ -100,7 +100,7 @@ namespace boost > bool is_straight_line_drawing(const Graph& g, GridPositionMap drawing, - VertexIndexMap vm + VertexIndexMap ) { diff --git a/include/boost/graph/isomorphism.hpp b/include/boost/graph/isomorphism.hpp index 29f6ef2c..9461dc31 100644 --- a/include/boost/graph/isomorphism.hpp +++ b/include/boost/graph/isomorphism.hpp @@ -90,7 +90,7 @@ namespace boost { void discover_vertex(vertex1_t v, const Graph1&) const { vertices.push_back(v); } - void examine_edge(edge1_t e, const Graph1& G1) const { + void examine_edge(edge1_t e, const Graph1&) const { edges.push_back(e); } std::vector& vertices; diff --git a/include/boost/graph/kolmogorov_max_flow.hpp b/include/boost/graph/kolmogorov_max_flow.hpp index 328bd303..f98a5721 100644 --- a/include/boost/graph/kolmogorov_max_flow.hpp +++ b/include/boost/graph/kolmogorov_max_flow.hpp @@ -46,6 +46,7 @@ #include #include #include +#include namespace boost { namespace detail { @@ -161,7 +162,7 @@ namespace boost { } edge_descriptor to_sink; bool is_there; - tie(to_sink, is_there) = edge(current_node, m_sink, m_g); + tie(to_sink, is_there) = lookup_edge(current_node, m_sink, m_g); if(is_there){ tEdgeVal cap_from_source = m_res_cap_map[from_source]; tEdgeVal cap_to_sink = m_res_cap_map[to_sink]; diff --git a/include/boost/graph/labeled_graph.hpp b/include/boost/graph/labeled_graph.hpp index c7f40260..d91c5983 100644 --- a/include/boost/graph/labeled_graph.hpp +++ b/include/boost/graph/labeled_graph.hpp @@ -72,7 +72,6 @@ namespace graph_detail { struct generate_label_map { typedef std::multimap type; }; -#if !defined BOOST_NO_HASH template struct generate_label_map { typedef boost::unordered_map type; }; @@ -80,7 +79,7 @@ namespace graph_detail { template struct generate_label_map { typedef boost::unordered_multimap type; }; -#endif + template struct choose_custom_map { typedef typename generate_label_map::type type; @@ -141,7 +140,7 @@ namespace graph_detail { // Tag dispatch on unique associative containers (i.e. maps). template std::pair::vertex_descriptor, bool> - insert_labeled_vertex(Container& c, Graph& g, Label const& l, Prop const& p, + insert_labeled_vertex(Container& c, Graph& g, Label const& l, Prop const&, unique_associative_container_tag) { // Here, we actually have to try the insertion first, and only add diff --git a/include/boost/graph/lookup_edge.hpp b/include/boost/graph/lookup_edge.hpp new file mode 100644 index 00000000..f8ea89e2 --- /dev/null +++ b/include/boost/graph/lookup_edge.hpp @@ -0,0 +1,50 @@ +//======================================================================= +// Copyright 2009 Trustees of Indiana University +// Author: Jeremiah Willcock +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +//======================================================================= + +#ifndef BOOST_GRAPH_LOOKUP_EDGE_HPP +#define BOOST_GRAPH_LOOKUP_EDGE_HPP + +#include +#include +#include +#include + +// lookup_edge: a function that acts like edge() but falls back to out_edges() +// and a search when edge() is not provided. + +namespace boost { + + template + std::pair::edge_descriptor, bool> + lookup_edge(typename boost::graph_traits::vertex_descriptor src, + typename boost::graph_traits::vertex_descriptor tgt, + const Graph& g, + typename boost::enable_if, int>::type = 0) { + return edge(src, tgt, g); + } + + template + std::pair::edge_descriptor, bool> + lookup_edge(typename boost::graph_traits::vertex_descriptor src, + typename boost::graph_traits::vertex_descriptor tgt, + const Graph& g, + typename boost::disable_if, int>::type = 0) { + typedef typename boost::graph_traits::out_edge_iterator it; + typedef typename boost::graph_traits::edge_descriptor edesc; + std::pair oe = out_edges(src, g); + for (; oe.first != oe.second; ++oe.first) { + edesc e = *oe.first; + if (target(e, g) == tgt) return std::make_pair(e, true); + } + return std::make_pair(edesc(), false); + } + +} + +#endif // BOOST_GRAPH_LOOKUP_EDGE_HPP diff --git a/include/boost/graph/max_cardinality_matching.hpp b/include/boost/graph/max_cardinality_matching.hpp index ef9ed9e4..1f0f6de2 100644 --- a/include/boost/graph/max_cardinality_matching.hpp +++ b/include/boost/graph/max_cardinality_matching.hpp @@ -67,7 +67,7 @@ namespace boost template - bool is_a_matching(const Graph& g, MateMap mate, VertexIndexMap vm) + bool is_a_matching(const Graph& g, MateMap mate, VertexIndexMap) { typedef typename graph_traits::vertex_descriptor vertex_descriptor_t; @@ -106,13 +106,13 @@ namespace boost typename VertexIndexMap = dummy_property_map> struct no_augmenting_path_finder { - no_augmenting_path_finder(const Graph& g, MateMap mate, VertexIndexMap vm) + no_augmenting_path_finder(const Graph&, MateMap, VertexIndexMap) { } inline bool augment_matching() { return false; } template - void get_current_matching(PropertyMap p) {} + void get_current_matching(PropertyMap) {} }; @@ -673,13 +673,13 @@ namespace boost } template - void start_vertex(Vertex v, Graph&) + void start_vertex(Vertex, Graph&) { m_parity = false; } template - void discover_vertex(Vertex u, Graph&) + void discover_vertex(Vertex, Graph&) { m_parity = !m_parity; m_parity ? ++m_count : --m_count; @@ -703,7 +703,7 @@ namespace boost struct no_matching_verifier { inline static bool - verify_matching(const Graph& g, MateMap mate, VertexIndexMap vm) + verify_matching(const Graph&, MateMap, VertexIndexMap) { return true;} }; diff --git a/include/boost/graph/mcgregor_common_subgraphs.hpp b/include/boost/graph/mcgregor_common_subgraphs.hpp index 25db09ca..51eea889 100644 --- a/include/boost/graph/mcgregor_common_subgraphs.hpp +++ b/include/boost/graph/mcgregor_common_subgraphs.hpp @@ -89,7 +89,7 @@ namespace boost { template - bool operator()(const ItemFirst& item1, const ItemSecond& item2) { + bool operator()(const ItemFirst&, const ItemSecond&) { return (true); } }; @@ -113,7 +113,7 @@ namespace boost { (const GraphFirst& graph1, const GraphSecond& graph2, CorrespondenceMapFirstToSecond correspondence_map_1_to_2, - CorrespondenceMapSecondToFirst correspondence_map_2_to_1, + CorrespondenceMapSecondToFirst /*correspondence_map_2_to_1*/, typename graph_traits::vertices_size_type subgraph_size, typename graph_traits::vertex_descriptor new_vertex1, typename graph_traits::vertex_descriptor new_vertex2, diff --git a/include/boost/graph/metric_tsp_approx.hpp b/include/boost/graph/metric_tsp_approx.hpp index ff257ab7..7c18b8e0 100644 --- a/include/boost/graph/metric_tsp_approx.hpp +++ b/include/boost/graph/metric_tsp_approx.hpp @@ -34,6 +34,7 @@ #include #include #include +#include namespace boost @@ -68,11 +69,11 @@ namespace boost PreorderTraverser(std::vector& p) : path_(p) {} - void preorder(Node n, const Tree& t) + void preorder(Node n, const Tree&) { path_.push_back(n); } - void inorder(Node n, const Tree& t) const {} - void postorder(Node, const Tree& t) const {} + void inorder(Node, const Tree&) const {} + void postorder(Node, const Tree&) const {} const_iterator begin() const { return path_.begin(); } const_iterator end() const { return path_.end(); } @@ -241,7 +242,7 @@ namespace boost { } template - void visit_vertex(Vertex v, const Graph& g) + void visit_vertex(Vertex v, const Graph&) { BOOST_CONCEPT_ASSERT((OutputIterator)); *itr_++ = v; @@ -284,7 +285,7 @@ namespace boost // would require revisiting the core algorithm. Edge e; bool found; - tie(e, found) = edge(previous_, v, g); + tie(e, found) = lookup_edge(previous_, v, g); if(!found) { throw not_complete(); } diff --git a/include/boost/graph/named_function_params.hpp b/include/boost/graph/named_function_params.hpp index 1e2647c6..42c5ef87 100644 --- a/include/boost/graph/named_function_params.hpp +++ b/include/boost/graph/named_function_params.hpp @@ -383,13 +383,13 @@ BOOST_BGL_DECLARE_NAMED_PARAMS template struct override_const_property_t { typedef ArgType result_type; - result_type operator()(const Graph& g, const typename boost::add_reference::type a) const {return a;} + result_type operator()(const Graph&, const typename boost::add_reference::type a) const {return a;} }; template struct override_const_property_t { typedef typename boost::property_map::const_type result_type; - result_type operator()(const Graph& g, const ArgType& a) const {return get(Prop(), g);} + result_type operator()(const Graph& g, const ArgType&) const {return get(Prop(), g);} }; template @@ -399,7 +399,7 @@ BOOST_BGL_DECLARE_NAMED_PARAMS Graph, boost::detail::parameter_exists::value >::result_type - override_const_property(const ArgPack& ap, const boost::parameter::keyword& t, const Graph& g, Prop prop) { + override_const_property(const ArgPack& ap, const boost::parameter::keyword& t, const Graph& g, Prop) { return override_const_property_t< typename boost::parameter::value_type::type, Prop, diff --git a/include/boost/graph/planar_detail/boyer_myrvold_impl.hpp b/include/boost/graph/planar_detail/boyer_myrvold_impl.hpp index 041a5500..ee31c85e 100644 --- a/include/boost/graph/planar_detail/boyer_myrvold_impl.hpp +++ b/include/boost/graph/planar_detail/boyer_myrvold_impl.hpp @@ -104,7 +104,7 @@ namespace boost } template - void finish_vertex(const Vertex& u, Graph& g) + void finish_vertex(const Vertex& u, Graph&) { typedef typename graph_traits::vertices_size_type v_size_t; @@ -889,7 +889,7 @@ namespace boost } - void add_to_merge_points(vertex_t v, graph::detail::no_old_handles) {} + void add_to_merge_points(vertex_t, graph::detail::no_old_handles) {} void add_to_merge_points(vertex_t v, graph::detail::store_old_handles) { @@ -897,7 +897,7 @@ namespace boost } - void add_to_embedded_edges(edge_t e, graph::detail::no_old_handles) {} + void add_to_embedded_edges(edge_t, graph::detail::no_old_handles) {} void add_to_embedded_edges(edge_t e, graph::detail::store_old_handles) { diff --git a/include/boost/graph/planar_face_traversal.hpp b/include/boost/graph/planar_face_traversal.hpp index 6f392c49..2f8a2ee3 100644 --- a/include/boost/graph/planar_face_traversal.hpp +++ b/include/boost/graph/planar_face_traversal.hpp @@ -29,11 +29,11 @@ namespace boost {} template - void next_edge(Edge e) + void next_edge(Edge) {} template - void next_vertex(Vertex v) + void next_vertex(Vertex) {} void end_face() diff --git a/include/boost/graph/properties.hpp b/include/boost/graph/properties.hpp index 3a313b17..32459624 100644 --- a/include/boost/graph/properties.hpp +++ b/include/boost/graph/properties.hpp @@ -175,10 +175,22 @@ namespace boost { namespace detail { + template struct return_void {typedef void type;}; + + template + struct graph_tag_or_void { + typedef void type; + }; + + template + struct graph_tag_or_void::type> { + typedef typename Graph::graph_tag type; + }; + template struct edge_property_map { - typedef typename Graph::edge_property_type Property; - typedef typename Graph::graph_tag graph_tag; + typedef typename edge_property_type::type Property; + typedef typename graph_tag_or_void::type graph_tag; typedef typename edge_property_selector::type Selector; typedef typename Selector::template bind_ Bind; @@ -187,8 +199,8 @@ namespace boost { }; template class vertex_property_map { - typedef typename Graph::vertex_property_type Property; - typedef typename Graph::graph_tag graph_tag; + typedef typename vertex_property_type::type Property; + typedef typename graph_tag_or_void::type graph_tag; typedef typename vertex_property_selector::type Selector; typedef typename Selector::template bind_ Bind; diff --git a/include/boost/graph/property_maps/constant_property_map.hpp b/include/boost/graph/property_maps/constant_property_map.hpp index 9f7f0394..dd2461e7 100644 --- a/include/boost/graph/property_maps/constant_property_map.hpp +++ b/include/boost/graph/property_maps/constant_property_map.hpp @@ -43,7 +43,7 @@ struct constant_property_map : m_value(copy.m_value) { } - inline reference operator [](const key_type& v) const + inline reference operator [](const key_type&) const { return m_value; } value_type m_value; diff --git a/include/boost/graph/r_c_shortest_paths.hpp b/include/boost/graph/r_c_shortest_paths.hpp index 22cdad85..b1bd7574 100644 --- a/include/boost/graph/r_c_shortest_paths.hpp +++ b/include/boost/graph/r_c_shortest_paths.hpp @@ -162,7 +162,7 @@ template::vertex_descriptor s, typename graph_traits::vertex_descriptor t, // each inner vector corresponds to a pareto-optimal path @@ -179,7 +179,7 @@ void r_c_shortest_paths_dispatch Resource_Extension_Function& ref, Dominance_Function& dominance, // to specify the memory management strategy for the labels - Label_Allocator la, + Label_Allocator /*la*/, Visitor vis ) { pareto_optimal_resource_containers.clear(); @@ -449,15 +449,15 @@ void r_c_shortest_paths_dispatch struct default_r_c_shortest_paths_visitor { template - void on_label_popped( const Label& l, const Graph& g ) {} + void on_label_popped( const Label&, const Graph& ) {} template - void on_label_feasible( const Label& l, const Graph& g ) {} + void on_label_feasible( const Label&, const Graph& ) {} template - void on_label_not_feasible( const Label& l, const Graph& g ) {} + void on_label_not_feasible( const Label&, const Graph& ) {} template - void on_label_dominated( const Label& l, const Graph& g ) {} + void on_label_dominated( const Label&, const Graph& ) {} template - void on_label_not_dominated( const Label& l, const Graph& g ) {} + void on_label_not_dominated( const Label&, const Graph& ) {} }; // default_r_c_shortest_paths_visitor diff --git a/include/boost/graph/reverse_graph.hpp b/include/boost/graph/reverse_graph.hpp index 8fbd6364..3a81c294 100644 --- a/include/boost/graph/reverse_graph.hpp +++ b/include/boost/graph/reverse_graph.hpp @@ -9,6 +9,8 @@ #include #include #include +#include +#include #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // Stay out of the way of the concept checking class @@ -75,11 +77,6 @@ class reverse_graph { typedef typename Traits::vertices_size_type vertices_size_type; typedef typename Traits::edges_size_type edges_size_type; - // More typedefs used by detail::edge_property_map, vertex_property_map - typedef typename boost::edge_property_type::type - edge_property_type; - typedef typename boost::vertex_property_type::type - vertex_property_type; typedef reverse_graph_tag graph_tag; #ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES @@ -105,6 +102,18 @@ class reverse_graph { GraphRef m_g; }; + +// These are separate so they are not instantiated unless used (see bug 1021) +template +struct vertex_property_type > { + typedef typename boost::vertex_property_type::type type; +}; + +template +struct edge_property_type > { + typedef typename boost::edge_property_type::type type; +}; + #ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES template struct vertex_bundle_type > @@ -176,6 +185,14 @@ out_degree(const typename graph_traits::vertex_descriptor u, return in_degree(u, g.m_g); } +template +inline typename graph_traits::vertex_descriptor +vertex(const typename graph_traits::vertices_size_type v, + const reverse_graph& g) +{ + return vertex(v, g.m_g); +} + template inline std::pair::edge_descriptor, bool> @@ -267,14 +284,14 @@ struct edge_property_selector { }; template -typename property_map::type +typename property_map, Property>::type get(Property p, reverse_graph& g) { return get(p, g.m_g); } template -typename property_map::const_type +typename property_map, Property>::const_type get(Property p, const reverse_graph& g) { const BidirGraph& gref = g.m_g; // in case GRef is non-const @@ -309,7 +326,10 @@ set_property(const reverse_graph& g, Tag tag, template inline -typename graph_property::type +typename boost::mpl::if_< + boost::is_const::type>, + const typename graph_property::type&, + typename graph_property::type& >::type get_property(const reverse_graph& g, Tag tag) { return get_property(g.m_g, tag); diff --git a/include/boost/graph/subgraph.hpp b/include/boost/graph/subgraph.hpp index ba2405f1..15cdace5 100644 --- a/include/boost/graph/subgraph.hpp +++ b/include/boost/graph/subgraph.hpp @@ -175,25 +175,27 @@ typedef typename Traits::traversal_category traversal_category; // local <-> global descriptor conversion functions vertex_descriptor local_to_global(vertex_descriptor u_local) const - { return m_global_vertex[u_local]; } + { return is_root() ? u_local : m_global_vertex[u_local]; } vertex_descriptor global_to_local(vertex_descriptor u_global) const { vertex_descriptor u_local; bool in_subgraph; + if (is_root()) return u_global; tie(u_local, in_subgraph) = this->find_vertex(u_global); assert(in_subgraph == true); return u_local; } edge_descriptor local_to_global(edge_descriptor e_local) const - { return m_global_edge[get(get(edge_index, m_graph), e_local)]; } + { return is_root() ? e_local : m_global_edge[get(get(edge_index, m_graph), e_local)]; } edge_descriptor global_to_local(edge_descriptor e_global) const - { return (*m_local_edge.find(get(get(edge_index, root().m_graph), e_global))).second; } + { return is_root() ? e_global : (*m_local_edge.find(get(get(edge_index, root().m_graph), e_global))).second; } // Is vertex u (of the root graph) contained in this subgraph? // If so, return the matching local vertex. std::pair find_vertex(vertex_descriptor u_global) const { + if (is_root()) return std::make_pair(u_global, true); typename std::map::const_iterator i = m_local_vertex.find(u_global); bool valid = i != m_local_vertex.end(); diff --git a/include/boost/graph/two_bit_color_map.hpp b/include/boost/graph/two_bit_color_map.hpp index 3dbcdcef..1a3336bd 100644 --- a/include/boost/graph/two_bit_color_map.hpp +++ b/include/boost/graph/two_bit_color_map.hpp @@ -14,6 +14,7 @@ #define BOOST_TWO_BIT_COLOR_MAP_HPP #include +#include #include #include @@ -77,8 +78,10 @@ put(const two_bit_color_map& pm, assert (value >= 0 && value < 4); std::size_t byte_num = i / 4; std::size_t bit_position = ((i % 4) * 2); - pm.data.get()[byte_num] = (pm.data.get()[byte_num] & ~(3 << bit_position)) - | (value << bit_position); + pm.data.get()[byte_num] = + (unsigned char) + ((pm.data.get()[byte_num] & ~(3 << bit_position)) + | (value << bit_position)); } template diff --git a/include/boost/pending/property.hpp b/include/boost/pending/property.hpp index 448a7191..07cea5f0 100644 --- a/include/boost/pending/property.hpp +++ b/include/boost/pending/property.hpp @@ -6,7 +6,7 @@ #ifndef BOOST_PROPERTY_HPP #define BOOST_PROPERTY_HPP -#include +#include namespace boost { @@ -47,15 +47,9 @@ namespace boost { }; template - struct has_property { - BOOST_STATIC_CONSTANT(bool, value = true); - typedef true_type type; - }; + struct has_property : boost::mpl::true_ {}; template <> - struct has_property { - BOOST_STATIC_CONSTANT(bool, value = false); - typedef false_type type; - }; + struct has_property : boost::mpl::false_ {}; } // namespace boost diff --git a/src/graphml.cpp b/src/graphml.cpp index df1ec16b..300b65fa 100644 --- a/src/graphml.cpp +++ b/src/graphml.cpp @@ -1,18 +1,22 @@ // Copyright (C) 2006 Tiago de Paula Peixoto -// Copyright (C) 2004 The Trustees of Indiana University. +// Copyright (C) 2004,2009 The Trustees of Indiana University. // // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // Authors: Douglas Gregor +// Jeremiah Willcock // Andrew Lumsdaine // Tiago de Paula Peixoto -#include -#include +#define BOOST_GRAPH_SOURCE +#include +#include #include -#include +#include +#include +#include using namespace boost; @@ -20,34 +24,91 @@ class graphml_reader { public: graphml_reader(mutate_graph& g) - : m_g(g), m_canonical_vertices(false) { } + : m_g(g) { } + + static boost::property_tree::ptree::path_type path(const std::string& str) { + return boost::property_tree::ptree::path_type(str, '/'); + } + + static void get_graphs(const boost::property_tree::ptree& top, + std::vector& result) { + using boost::property_tree::ptree; + BOOST_FOREACH(const ptree::value_type& n, top) { + if (n.first == "graph") { + result.push_back(&n.second); + get_graphs(n.second, result); + } + } + } void run(std::istream& in) { - const int buffer_size = 4096; - m_parser = XML_ParserCreateNS(0,'|'); - XML_SetElementHandler(m_parser, &on_start_element, &on_end_element); - XML_SetCharacterDataHandler(m_parser, &on_character_data); - XML_SetUserData(m_parser, this); - char buffer[buffer_size]; - - bool okay = true; - do - { - in.read(buffer, buffer_size); - okay = XML_Parse(m_parser, buffer, in.gcount(), in.gcount() == 0); - } - while (okay && in.good()); - - if (!okay) - { - std::stringstream s; - s << "on line " << XML_GetCurrentLineNumber(m_parser) - <<", column " << XML_GetCurrentColumnNumber(m_parser) - << ": " << XML_ErrorString(XML_GetErrorCode(m_parser)); - throw parse_error(s.str()); + using boost::property_tree::ptree; + ptree pt; + read_xml(in, pt, boost::property_tree::xml_parser::no_comments | boost::property_tree::xml_parser::trim_whitespace); + ptree gml = pt.get_child(path("graphml")); + // Search for attributes + BOOST_FOREACH(const ptree::value_type& child, gml) { + if (child.first != "key") continue; + std::string id = child.second.get(path("/id"), ""); + std::string for_ = child.second.get(path("/for"), ""); + std::string name = child.second.get(path("/attr.name"), ""); + std::string type = child.second.get(path("/attr.type"), ""); + key_kind kind = all_key; + if (for_ == "graph") kind = graph_key; + else if (for_ == "node") kind = node_key; + else if (for_ == "edge") kind = edge_key; + else if (for_ == "hyperedge") kind = hyperedge_key; + else if (for_ == "port") kind = port_key; + else if (for_ == "endpoint") kind = endpoint_key; + else if (for_ == "all") kind = all_key; + else throw parse_error("Attribute for is not valid: " + for_); + m_keys[id] = kind; + m_key_name[id] = name; + m_key_type[id] = type; + boost::optional default_ = child.second.get_optional(path("default")); + if (default_) m_key_default[id] = default_.get(); + } + // Search for graphs + std::vector graphs; + get_graphs(gml, graphs); + BOOST_FOREACH(const ptree* gr, graphs) { + // Search for nodes + BOOST_FOREACH(const ptree::value_type& node, *gr) { + if (node.first != "node") continue; + std::string id = node.second.get(path("/id")); + handle_vertex(id); + BOOST_FOREACH(const ptree::value_type& attr, node.second) { + if (attr.first != "data") continue; + std::string key = attr.second.get(path("/key")); + std::string value = attr.second.get_value(""); + handle_node_property(key, id, value); + } } - XML_ParserFree(m_parser); + } + BOOST_FOREACH(const ptree* gr, graphs) { + bool default_directed = gr->get(path("/edgedefault")) == "directed"; + // Search for edges + BOOST_FOREACH(const ptree::value_type& edge, *gr) { + if (edge.first != "edge") continue; + std::string id = edge.second.get(path("/id")); + std::string source = edge.second.get(path("/source")); + std::string target = edge.second.get(path("/target")); + std::string local_directed = edge.second.get(path("/directed"), ""); + bool is_directed = (local_directed == "" ? default_directed : local_directed == "true"); + if (is_directed != m_g.is_directed()) { + if (is_directed) throw directed_graph_error(); else throw undirected_graph_error(); + } + size_t old_edges_size = m_edge.size(); + handle_edge(source, target); + BOOST_FOREACH(const ptree::value_type& attr, edge.second) { + if (attr.first != "data") continue; + std::string key = attr.second.get(path("/key")); + std::string value = attr.second.get_value(""); + handle_edge_property(key, old_edges_size, value); + } + } + } } private: @@ -62,199 +123,15 @@ private: all_key }; - static void - on_start_element(void* user_data, const XML_Char *c_name, - const XML_Char **atts) - { - graphml_reader* self = static_cast(user_data); - - std::string name(c_name); - replace_first(name, "http://graphml.graphdrawing.org/xmlns|", ""); - - if (name == "edge") - { - std::string id; - std::string source, target; - while (*atts) - { - std::string name = *atts++; - std::string value = *atts++; - - if (name == "id") id = value; - else if (name == "source") source = value; - else if (name == "target") target = value; - else if (name == "directed") - { - bool edge_is_directed = (value == "directed"); - if (edge_is_directed != self->m_g.is_directed()) - { - if (edge_is_directed) - throw directed_graph_error(); - else - throw undirected_graph_error(); - } - } - } - - self->m_active_descriptor = self->m_edge.size(); - self->handle_edge(source, target); - } - else if (name == "node") - { - std::string id; - - while (*atts) - { - std::string name = *atts++; - std::string value = *atts++; - - if (name == "id") id = value; - } - - self->handle_vertex(id); - self->m_active_descriptor = id; - } - else if (name == "data") - { - while (*atts) - { - std::string name = *atts++; - std::string value = *atts++; - - if (name == "key") self->m_active_key = value; - } - } - else if (name == "key") - { - std::string id; - std::string key_name; - std::string key_type; - key_kind kind = all_key; - - while (*atts) - { - std::string name = *atts++; - std::string value = *atts++; - - if (name == "id") id = value; - else if (name == "attr.name") key_name = value; - else if (name == "attr.type") key_type = value; - else if (name == "for") - { - if (value == "graph") kind = graph_key; - else if (value == "node") kind = node_key; - else if (value == "edge") kind = edge_key; - else if (value == "hyperedge") kind = hyperedge_key; - else if (value == "port") kind = port_key; - else if (value == "endpoint") kind = endpoint_key; - else if (value == "all") kind = all_key; - else - { - std::stringstream s; - s << "on line " << XML_GetCurrentLineNumber(self->m_parser) - << ", column " << XML_GetCurrentColumnNumber(self->m_parser) - << ": unrecognized key kind '" << value << "'"; - throw parse_error(s.str()); - } - } - } - - self->m_keys[id] = kind; - self->m_key_name[id] = key_name; - self->m_key_type[id] = key_type; - self->m_active_key = id; - } - else if (name == "graph") - { - while (*atts) - { - std::string name = *atts++; - std::string value = *atts++; - - if (name == "edgedefault") - { - bool edge_is_directed = (value == "directed"); - if (edge_is_directed != self->m_g.is_directed()) - { - if (edge_is_directed) - throw directed_graph_error(); - else - throw undirected_graph_error(); - } - } - else if (name == "parse.nodeids") - { - self->m_canonical_vertices = (value == "canonical"); - } - } - self->m_active_descriptor = ""; - } - - self->m_character_data.clear(); - } - - static void - on_end_element(void* user_data, const XML_Char *c_name) - { - graphml_reader* self = static_cast(user_data); - - std::string name(c_name); - replace_first(name, "http://graphml.graphdrawing.org/xmlns|", ""); - - if (name == "data") - { - self->handle_property(self->m_active_key, self->m_active_descriptor, - self->m_character_data); - } - else if (name == "default") - { - self->m_key_default[self->m_active_key] = self->m_character_data; - } - } - - static void - on_character_data(void* user_data, const XML_Char* s, int len) - { - graphml_reader* self = static_cast(user_data); - self->m_character_data.append(s, len); - } - void handle_vertex(const std::string& v) { bool is_new = false; - if (m_canonical_vertices) + if (m_vertex.find(v) == m_vertex.end()) { - size_t id; - - //strip leading "n" from name - try - { - id = lexical_cast(std::string(v,1)); - } - catch (bad_lexical_cast) - { - std::stringstream s; - s << "on line " << XML_GetCurrentLineNumber(m_parser) - << ", column " << XML_GetCurrentColumnNumber(m_parser) - << ": invalid vertex: " << v; - throw parse_error(s.str()); - } - - while(id >= m_canonical_vertex.size()) - { - m_canonical_vertex.push_back(m_g.do_add_vertex()); - is_new = true; - } - } - else - { - if (m_vertex.find(v) == m_vertex.end()) - { - m_vertex[v] = m_g.do_add_vertex(); - is_new = true; - } + m_vertex[v] = m_g.do_add_vertex(); + is_new = true; } if (is_new) @@ -263,7 +140,7 @@ private: for (iter = m_key_default.begin(); iter != m_key_default.end(); ++iter) { if (m_keys[iter->first] == node_key) - handle_property(iter->first, v, iter->second); + handle_node_property(iter->first, v, iter->second); } } } @@ -271,16 +148,7 @@ private: any get_vertex_descriptor(const std::string& v) { - if (m_canonical_vertices) - { - //strip leading "n" from name - size_t id = lexical_cast(std::string(v,1)); - return m_canonical_vertex[id]; - } - else - { - return m_vertex[v]; - } + return m_vertex[v]; } void @@ -306,40 +174,18 @@ private: for (iter = m_key_default.begin(); iter != m_key_default.end(); ++iter) { if (m_keys[iter->first] == edge_key) - handle_property(iter->first, e, iter->second); + handle_edge_property(iter->first, e, iter->second); } } - void handle_property(const std::string& key_id, const variant& descriptor, const std::string& value) + void handle_node_property(const std::string& key_id, const std::string& descriptor, const std::string& value) { - try - { - if (get(&descriptor)) - { - if (get(descriptor) == "") - m_g.set_graph_property(m_key_name[key_id], value, m_key_type[key_id]); - else - m_g.set_vertex_property(m_key_name[key_id], get_vertex_descriptor(get(descriptor)), value, m_key_type[key_id]); - } - else - { - m_g.set_edge_property(m_key_name[key_id], get_edge_descriptor(get(descriptor)), value, m_key_type[key_id]); - } - } - catch (parse_error &e) - { - std::stringstream s; - s << "on line " << XML_GetCurrentLineNumber(m_parser) - << ", column " << XML_GetCurrentColumnNumber(m_parser) - << ": " << e.error; - throw parse_error(s.str()); - } + m_g.set_vertex_property(m_key_name[key_id], m_vertex[descriptor], value, m_key_type[key_id]); } - any - get_edge_descriptor(size_t e) + void handle_edge_property(const std::string& key_id, size_t descriptor, const std::string& value) { - return m_edge[e]; + m_g.set_edge_property(m_key_name[key_id], m_edge[descriptor], value, m_key_type[key_id]); } mutate_graph& m_g; @@ -348,19 +194,12 @@ private: std::map m_key_type; std::map m_key_default; std::map m_vertex; - std::vector m_canonical_vertex; std::vector m_edge; - variant m_active_descriptor; - std::string m_active_key; - std::string m_character_data; - bool m_canonical_vertices; - bool m_canonical_edges; - XML_Parser m_parser; }; namespace boost { -void +void BOOST_GRAPH_DECL read_graphml(std::istream& in, mutate_graph& g) { graphml_reader reader(g); diff --git a/src/read_graphviz_new.cpp b/src/read_graphviz_new.cpp index 9d434386..5cf3cead 100644 --- a/src/read_graphviz_new.cpp +++ b/src/read_graphviz_new.cpp @@ -25,6 +25,7 @@ // Ronald Garcia // +#define BOOST_GRAPH_SOURCE #include #include #include @@ -44,6 +45,7 @@ #include #include #include +#include #include namespace boost { @@ -75,7 +77,8 @@ namespace read_graphviz_detail { quoted_string, // Only used internally in tokenizer eof, invalid - } type; + }; + token_type type; std::string normalized_value; // May have double-quotes removed and/or some escapes replaced token(token_type type, const std::string& normalized_value) : type(type), normalized_value(normalized_value) {} @@ -227,7 +230,7 @@ namespace read_graphviz_detail { default: assert (!"Definition of punctuation_token does not match switch statement"); } } - default: assert (!"Definition of punctuation_token does not match switch statement"); std::abort(); + default: assert (!"Definition of punctuation_token does not match switch statement"); } } found = boost::regex_search(begin, end, results, number_token); @@ -497,7 +500,7 @@ namespace read_graphviz_detail { case token::kw_graph: parse_attr_list(current_graph_props()); break; case token::kw_node: parse_attr_list(current().def_node_props); break; case token::kw_edge: parse_attr_list(current().def_edge_props); break; - default: assert (!"Bad attr_stmt case"); std::abort(); + default: assert (!"Bad attr_stmt case"); } } @@ -790,7 +793,7 @@ namespace read_graphviz_detail { namespace detail { namespace graph { - bool read_graphviz(const std::string& str, boost::detail::graph::mutate_graph* mg) { + BOOST_GRAPH_DECL bool read_graphviz(const std::string& str, boost::detail::graph::mutate_graph* mg) { read_graphviz_detail::parser_result parsed_file; read_graphviz_detail::parse_graphviz_from_string(str, parsed_file, mg->is_directed()); read_graphviz_detail::translate_results_to_graph(parsed_file, mg); diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 422bed35..1aa5bc8d 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -9,19 +9,12 @@ import modules ; -local optional_tests ; - path-constant PLANAR_INPUT_FILES : ./planar_input_graphs ; path-constant CYCLE_RATIO_INPUT_FILE : ./cycle_ratio_s382.90.dot ; path-constant METIS_INPUT_FILE : ./weighted_graph.gr ; -if [ modules.peek : EXPAT_INCLUDE ] && [ modules.peek : EXPAT_LIBPATH ] -{ - optional_tests += [ run graphml_test.cpp ../build//boost_graph : : "graphml_test.xml" ] ; -} - test-suite graph_test : # test_graphs will eventually defined a framework for testing the structure # and implementation of graph data structures and adaptors. @@ -122,8 +115,7 @@ test-suite graph_test : [ compile grid_graph_cc.cpp ] [ run grid_graph_test.cpp ] [ run incremental_components_test.cpp ] - - $(optional_tests) + [ run graphml_test.cpp ../build//boost_graph : : "graphml_test.xml" ] ; # Run SDB tests only when -sSDB= is set. diff --git a/test/adj_list_loops.cpp b/test/adj_list_loops.cpp index 52ecd2e2..205f3730 100644 --- a/test/adj_list_loops.cpp +++ b/test/adj_list_loops.cpp @@ -4,10 +4,6 @@ // Boost Software License, Version 1.0 (See accompanying file // LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) -#if __GNUC__ == 4 && __GNUC_MINOR__ >= 3 -# define BOOST_NO_HASH -#endif - #include #include diff --git a/test/astar_search_test.cpp b/test/astar_search_test.cpp index 18dfeb58..42143812 100644 --- a/test/astar_search_test.cpp +++ b/test/astar_search_test.cpp @@ -98,7 +98,7 @@ class astar_goal_visitor : public boost::default_astar_visitor public: astar_goal_visitor(Vertex goal) : m_goal(goal) {} template - void examine_vertex(Vertex u, Graph& g) { + void examine_vertex(Vertex u, Graph&) { if(u == m_goal) throw found_goal(); } @@ -107,7 +107,7 @@ private: }; -int main(int argc, char **argv) +int main(int, char **) { // specify some types diff --git a/test/basic_planarity_test.cpp b/test/basic_planarity_test.cpp index cd79591f..3c956d7e 100644 --- a/test/basic_planarity_test.cpp +++ b/test/basic_planarity_test.cpp @@ -32,7 +32,7 @@ struct VertexIndexUpdater struct NoVertexIndexUpdater { - template void reset(Graph& g) {} + template void reset(Graph&) {} }; diff --git a/test/bron_kerbosch_all_cliques.cpp b/test/bron_kerbosch_all_cliques.cpp index aa940b90..d3b6bbb9 100644 --- a/test/bron_kerbosch_all_cliques.cpp +++ b/test/bron_kerbosch_all_cliques.cpp @@ -65,7 +65,7 @@ void test() } int -main(int argc, char *argv[]) +main(int, char *[]) { typedef undirected_graph<> Graph; typedef directed_graph<> DiGraph; diff --git a/test/closeness_centrality.cpp b/test/closeness_centrality.cpp index 846b5c1f..5fd16b9c 100644 --- a/test/closeness_centrality.cpp +++ b/test/closeness_centrality.cpp @@ -44,7 +44,7 @@ void build_graph(Graph& g, add_edge(v[2], v[0], g); add_edge(v[3], v[4], g); add_edge(v[4], v[0], g); -}; +} template @@ -124,7 +124,7 @@ void test_directed() } int -main(int argc, char *argv[]) +main(int, char *[]) { typedef undirected_graph<> Graph; typedef directed_graph<> Digraph; diff --git a/test/clustering_coefficient.cpp b/test/clustering_coefficient.cpp index 736062e5..21eee890 100644 --- a/test/clustering_coefficient.cpp +++ b/test/clustering_coefficient.cpp @@ -40,7 +40,7 @@ void build_graph(Graph& g, typename vertex_vector::type& v) add_edge(v[2], v[0], g); add_edge(v[3], v[4], g); add_edge(v[4], v[0], g); -}; +} template void test_undirected() @@ -95,7 +95,7 @@ void test_undirected() } int -main(int argc, char *argv[]) +main(int, char *[]) { typedef undirected_graph<> Graph; typedef directed_graph<> Digraph; diff --git a/test/core_numbers_test.cpp b/test/core_numbers_test.cpp index ff9bacf4..733bf4a6 100644 --- a/test/core_numbers_test.cpp +++ b/test/core_numbers_test.cpp @@ -54,7 +54,7 @@ int test_1() { make_iterator_property_map(core_nums.begin(), get(vertex_index,G))); for (size_t i=0; i #include @@ -119,29 +116,15 @@ void assert_graphs_equal(const G1& g1, const VI1& vi1, template void check_consistency_one(const Structure& g) { // Do a bunch of tests on the graph internal data -#ifndef BOOST_GRAPH_USE_NEW_CSR_INTERFACE - // Check that m_last_source is valid - BOOST_CHECK(g.m_last_source <= g.m_rowstart.size() - 1); -#endif // !BOOST_GRAPH_USE_NEW_CSR_INTERFACE // Check that m_rowstart entries are valid, and that entries after // m_last_source + 1 are all zero BOOST_CHECK(g.m_rowstart[0] == 0); for (size_t i = 0; -#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE i < g.m_rowstart.size() - 1; -#else // !BOOST_GRAPH_USE_NEW_CSR_INTERFACE - i < g.m_last_source; -#endif // BOOST_GRAPH_USE_NEW_CSR_INTERFACE ++i) { BOOST_CHECK(g.m_rowstart[i + 1] >= g.m_rowstart[i]); BOOST_CHECK(g.m_rowstart[i + 1] <= g.m_rowstart.back()); } -#ifndef BOOST_GRAPH_USE_NEW_CSR_INTERFACE - for (size_t i = g.m_last_source + 1; - i < g.m_rowstart.size(); ++i) { - BOOST_CHECK(g.m_forward.m_rowstart[i] == 0); - } -#endif // !BOOST_GRAPH_USE_NEW_CSR_INTERFACE // Check that m_column entries are within range for (size_t i = 0; i < g.m_rowstart.back(); ++i) { BOOST_CHECK(g.m_column[i] < g.m_rowstart.size() - 1); @@ -217,7 +200,6 @@ void graph_test(const OrigGraph& g) g3, boost::identity_property_map(), boost::identity_property_map()); -#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE // Check constructing a graph using in-place modification of vectors { std::vector sources(num_edges(g2)); @@ -287,32 +269,9 @@ void graph_test(const OrigGraph& g) g3a, boost::identity_property_map(), boost::identity_property_map()); } -#endif // BOOST_GRAPH_USE_NEW_CSR_INTERFACE CSRGraphT::edge_iterator ei, ei_end; -#ifndef BOOST_GRAPH_USE_NEW_CSR_INTERFACE - // Check constructing a graph using add_edge and add_vertices - CSRGraphT g4; - BOOST_CHECK(num_vertices(g4) == 0); - std::size_t first_vert = add_vertices(num_vertices(g3), g4); - BGL_FORALL_VERTICES(v, g4, CSRGraphT) - g4[v].index = v; - - BOOST_CHECK(first_vert == 0); - BOOST_CHECK(num_vertices(g4) == num_vertices(g3)); - int i; - for (boost::tie(ei, ei_end) = edges(g3), i = 0; ei != ei_end; ++ei, ++i) { - CSRGraphT::edge_descriptor e = add_edge(source(*ei, g3), target(*ei, g3), g4); - BOOST_CHECK(source(e, g4) == source(*ei, g3)); - BOOST_CHECK(target(e, g4) == target(*ei, g3)); - if (i % 13 == 0) check_consistency(g4); - } - assert_graphs_equal(g3, boost::identity_property_map(), - g4, boost::identity_property_map(), - boost::identity_property_map()); -#endif // !BOOST_GRAPH_USE_NEW_CSR_INTERFACE - // Check edge_from_index (and implicitly the edge_index property map) for // each edge in g2 std::size_t last_src = 0, last_tgt = 0; @@ -442,7 +401,7 @@ void test_vertex_and_edge_properties() int test_main(int argc, char* argv[]) { // Optionally accept a seed value - int seed = std::time(0); + int seed = int(std::time(0)); if (argc > 1) seed = boost::lexical_cast(argv[1]); std::cout << "Seed = " << seed << std::endl; @@ -456,29 +415,10 @@ int test_main(int argc, char* argv[]) // graph_test(1000, 0.1, seed); graph_test(1000, 0.001, seed); graph_test(1000, 0.0005, seed); -#ifndef BOOST_GRAPH_USE_NEW_CSR_INTERFACE - { - std::cout << "Testing partially constructed CSR graph" << std::endl; - CSRGraphT g; - add_vertices(std::size_t(5), g); - add_edge(std::size_t(1), std::size_t(2), g); - check_consistency(g); - add_edge(std::size_t(2), std::size_t(3), g); - check_consistency(g); - add_edge(std::size_t(2), std::size_t(4), g); - check_consistency(g); - CSRGraphT::edge_iterator ei, ei_end; - for (boost::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { - BOOST_CHECK(edge_from_index(get(boost::edge_index, g, *ei), g) == *ei); - } - graph_test(g); - } -#endif // !BOOST_GRAPH_USE_NEW_CSR_INTERFACE test_graph_properties(); test_vertex_and_edge_properties(); -#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE { std::cout << "Testing CSR graph built from unsorted edges" << std::endl; std::pair unsorted_edges[] = {std::make_pair(5, 0), std::make_pair(3, 2), std::make_pair(4, 1), std::make_pair(4, 0), std::make_pair(0, 2), std::make_pair(5, 2)}; @@ -506,7 +446,6 @@ int test_main(int argc, char* argv[]) g3, boost::identity_property_map(), boost::identity_property_map()); } -#endif // BOOST_GRAPH_USE_NEW_CSR_INTERFACE return 0; } diff --git a/test/degree_centrality.cpp b/test/degree_centrality.cpp index eb13c491..bb6e6b39 100644 --- a/test/degree_centrality.cpp +++ b/test/degree_centrality.cpp @@ -35,7 +35,7 @@ void build_graph(Graph& g, add_edge(v[2], v[0], g); add_edge(v[3], v[4], g); add_edge(v[4], v[0], g); -}; +} template void test_undirected() @@ -112,7 +112,7 @@ void test_prestige() } int -main(int argc, char *argv[]) +main(int, char *[]) { typedef undirected_graph<> Graph; typedef directed_graph<> Digraph; diff --git a/test/dfs.cpp b/test/dfs.cpp index 4750b1af..fdffd4ef 100644 --- a/test/dfs.cpp +++ b/test/dfs.cpp @@ -31,15 +31,15 @@ public: m_discover_time(d), m_finish_time(f), m_time(0) { } template - void initialize_vertex(Vertex u, Graph& g) { + void initialize_vertex(Vertex u, Graph&) { BOOST_CHECK( boost::get(m_color, u) == Color::white() ); } template - void start_vertex(Vertex u, Graph& g) { + void start_vertex(Vertex u, Graph&) { BOOST_CHECK( boost::get(m_color, u) == Color::white() ); } template - void discover_vertex(Vertex u, Graph& g) { + void discover_vertex(Vertex u, Graph&) { using namespace boost; BOOST_CHECK( get(m_color, u) == Color::gray() ); BOOST_CHECK( get(m_color, get(m_parent, u)) == Color::gray() ); @@ -69,7 +69,7 @@ public: BOOST_CHECK( get(m_color, target(e, g)) == Color::black() ); } template - void finish_vertex(Vertex u, Graph& g) { + void finish_vertex(Vertex u, Graph&) { using namespace boost; BOOST_CHECK( get(m_color, u) == Color::black() ); diff --git a/test/dominator_tree_test.cpp b/test/dominator_tree_test.cpp old mode 100755 new mode 100644 index 85bdd4dc..604796a6 --- a/test/dominator_tree_test.cpp +++ b/test/dominator_tree_test.cpp @@ -294,4 +294,4 @@ int test_main(int, char*[]) } return 0; -}; +} diff --git a/test/eccentricity.cpp b/test/eccentricity.cpp index 8ce0fbfd..596f38ef 100644 --- a/test/eccentricity.cpp +++ b/test/eccentricity.cpp @@ -44,7 +44,7 @@ void build_graph(Graph& g, add_edge(v[2], v[0], g); add_edge(v[3], v[4], g); add_edge(v[4], v[0], g); -}; +} template @@ -134,7 +134,7 @@ void test_directed() int -main(int argc, char *argv[]) +main(int, char *[]) { typedef undirected_graph<> Graph; typedef directed_graph<> Digraph; diff --git a/test/grid_graph_cc.cpp b/test/grid_graph_cc.cpp index eef0a301..6c7d76a3 100644 --- a/test/grid_graph_cc.cpp +++ b/test/grid_graph_cc.cpp @@ -14,7 +14,7 @@ #define DIMENSIONS 3 using namespace boost; -int main (int argc, char* argv[]) { +int main (int, char*[]) { typedef grid_graph Graph; typedef graph_traits::vertex_descriptor Vertex; @@ -30,4 +30,4 @@ int main (int argc, char* argv[]) { function_requires >(); return (0); -}; +} diff --git a/test/grid_graph_test.cpp b/test/grid_graph_test.cpp index a1e5a8a6..3cd665bd 100644 --- a/test/grid_graph_test.cpp +++ b/test/grid_graph_test.cpp @@ -110,7 +110,7 @@ int test_main(int argc, char* argv[]) { for (int dimension_index = 0; dimension_index < DIMENSIONS; ++dimension_index) { - BOOST_REQUIRE((current_vertex[dimension_index] >= 0) && + BOOST_REQUIRE(/*(current_vertex[dimension_index] >= 0) && */ // Always true (current_vertex[dimension_index] < lengths[dimension_index])); } @@ -194,8 +194,8 @@ int test_main(int argc, char* argv[]) { get(boost::vertex_index, graph, target(current_edge, graph)); BOOST_REQUIRE(source_index != target_index); - BOOST_REQUIRE((source_index >= 0) && (source_index < num_vertices(graph))); - BOOST_REQUIRE((target_index >= 0) && (target_index < num_vertices(graph))); + BOOST_REQUIRE(/* (source_index >= 0) : always true && */ (source_index < num_vertices(graph))); + BOOST_REQUIRE(/* (target_index >= 0) : always true && */ (target_index < num_vertices(graph))); // Verify that the edge is listed as existing in both directions BOOST_REQUIRE(edge(source(current_edge, graph), target(current_edge, graph), graph).second); diff --git a/test/is_straight_line_draw_test.cpp b/test/is_straight_line_draw_test.cpp index 397ded53..edac4b2f 100644 --- a/test/is_straight_line_draw_test.cpp +++ b/test/is_straight_line_draw_test.cpp @@ -24,7 +24,7 @@ struct coord_t }; -int test_main(int argc, char* argv []) +int test_main(int, char*[]) { typedef adjacency_list< vecS, vecS, undirectedS, property diff --git a/test/labeled_graph.cpp b/test/labeled_graph.cpp index 2a4cb705..455675d5 100644 --- a/test/labeled_graph.cpp +++ b/test/labeled_graph.cpp @@ -8,8 +8,6 @@ #include #include -#define BOOST_NO_HASH - #include #include diff --git a/test/layout_test.cpp b/test/layout_test.cpp index da79126a..19f8c992 100644 --- a/test/layout_test.cpp +++ b/test/layout_test.cpp @@ -108,8 +108,8 @@ struct kamada_kawai_done template bool operator()(double delta_p, - typename boost::graph_traits::vertex_descriptor p, - const Graph& g, + typename boost::graph_traits::vertex_descriptor /*p*/, + const Graph& /*g*/, bool global) { if (global) { diff --git a/test/make_bicon_planar_test.cpp b/test/make_bicon_planar_test.cpp index 55e013a2..1eacf0a0 100644 --- a/test/make_bicon_planar_test.cpp +++ b/test/make_bicon_planar_test.cpp @@ -62,7 +62,7 @@ struct UpdateVertexIndex struct NoVertexIndexUpdater { - template void update(Graph& g) {} + template void update(Graph&) {} }; diff --git a/test/make_maximal_planar_test.cpp b/test/make_maximal_planar_test.cpp index 341c105e..7d5c6a57 100644 --- a/test/make_maximal_planar_test.cpp +++ b/test/make_maximal_planar_test.cpp @@ -64,7 +64,7 @@ struct UpdateVertexIndex struct NoVertexIndexUpdater { - template void update(Graph& g) {} + template void update(Graph&) {} }; diff --git a/test/matching_test.cpp b/test/matching_test.cpp index 33ab683b..81dd566e 100644 --- a/test/matching_test.cpp +++ b/test/matching_test.cpp @@ -37,7 +37,7 @@ typedef adjacency_matrix struct vertex_index_installer { - static void install(Graph& g) {} + static void install(Graph&) {} }; @@ -346,7 +346,7 @@ void matching_test(std::size_t num_v, const std::string& graph_name) -int test_main(int argc, char* argv[]) +int test_main(int, char*[]) { matching_test(10, "adjacency_list (using vectors)"); diff --git a/test/mcgregor_subgraphs_test.cpp b/test/mcgregor_subgraphs_test.cpp index 33546bf0..b7474311 100644 --- a/test/mcgregor_subgraphs_test.cpp +++ b/test/mcgregor_subgraphs_test.cpp @@ -192,8 +192,8 @@ struct simple_callback { template bool operator()(CorrespondenceMapFirstToSecond correspondence_map_1_to_2, - CorrespondenceMapSecondToFirst correspondence_map_2_to_1, - typename graph_traits::vertices_size_type subgraph_size) { + CorrespondenceMapSecondToFirst /*correspondence_map_2_to_1*/, + typename graph_traits::vertices_size_type /*subgraph_size*/) { typedef typename graph_traits::vertex_descriptor Vertex; diff --git a/test/mean_geodesic.cpp b/test/mean_geodesic.cpp index 7c2f9cca..c5b0f91f 100644 --- a/test/mean_geodesic.cpp +++ b/test/mean_geodesic.cpp @@ -44,7 +44,7 @@ void build_graph(Graph& g, typename vertex_vector::type& v) add_edge(v[2], v[0], g); add_edge(v[3], v[4], g); add_edge(v[4], v[0], g); -}; +} template @@ -132,7 +132,7 @@ void test_directed() int -main(int argc, char *argv[]) +main(int, char *[]) { typedef undirected_graph<> Graph; typedef directed_graph<> Digraph; diff --git a/test/metric_tsp_approx.cpp b/test/metric_tsp_approx.cpp index ed4365d1..14e52794 100644 --- a/test/metric_tsp_approx.cpp +++ b/test/metric_tsp_approx.cpp @@ -42,7 +42,7 @@ void connectAllEuclidean(VertexListGraph& g, const PointContainer& points, WeightMap wmap, // Property maps passed by value VertexIndexMap vmap, // Property maps passed by value - int sz) + int /*sz*/) { using namespace boost; using namespace std; diff --git a/test/named_vertices_test.cpp b/test/named_vertices_test.cpp index 9586f9d9..0f8ba0fa 100644 --- a/test/named_vertices_test.cpp +++ b/test/named_vertices_test.cpp @@ -58,7 +58,7 @@ struct internal_vertex_constructor typedef adjacency_list RoadMap; typedef graph_traits::vertex_descriptor Vertex; -int test_main(int argc, char* argv[]) +int test_main(int, char*[]) { RoadMap map; diff --git a/test/r_c_shortest_paths_test.cpp b/test/r_c_shortest_paths_test.cpp index 8459eb0a..cf6d57e1 100644 --- a/test/r_c_shortest_paths_test.cpp +++ b/test/r_c_shortest_paths_test.cpp @@ -199,7 +199,7 @@ public: }; // end data structures for shortest path problem with time windows (spptw) -int test_main(int argc, char* argv[]) +int test_main(int, char*[]) { SPPRC_Example_Graph g; add_vertex( SPPRC_Example_Graph_Vert_Prop( 0, 0, 1000000000 ), g ); diff --git a/test/serialize.cpp b/test/serialize.cpp index dfa9ed2d..5f5a6712 100644 --- a/test/serialize.cpp +++ b/test/serialize.cpp @@ -21,7 +21,7 @@ struct vertex_properties { std::string name; template - void serialize(Archive & ar, const unsigned int version) { + void serialize(Archive & ar, const unsigned int /*version*/) { ar & BOOST_SERIALIZATION_NVP(name); } }; @@ -30,7 +30,7 @@ struct edge_properties { std::string name; template - void serialize(Archive & ar, const unsigned int version) { + void serialize(Archive & ar, const unsigned int /*version*/) { ar & BOOST_SERIALIZATION_NVP(name); } }; diff --git a/test/subgraph.cpp b/test/subgraph.cpp index 4f538d8e..bb6011d6 100644 --- a/test/subgraph.cpp +++ b/test/subgraph.cpp @@ -18,7 +18,7 @@ // UNDER CONSTRUCTION -int test_main(int argc, char* argv[]) +int test_main(int, char*[]) { using namespace boost; typedef adjacency_list -#if !defined(BOOST_NO_HASH) -# define BOOST_NO_HASH -#endif - #include #include #include @@ -42,7 +38,7 @@ typedef graph_traits::edge_descriptor Edge; typedef graph_traits::vertex_iterator VertexIter; typedef graph_traits::edge_iterator EdgeIter; -int test_main(int argc, char* argv[]) +int test_main(int, char*[]) { mt19937 gen; for (int t = 0; t < 100; t += 5) { diff --git a/test/subgraph_props.cpp b/test/subgraph_props.cpp index 83fc1932..bdee6534 100644 --- a/test/subgraph_props.cpp +++ b/test/subgraph_props.cpp @@ -5,10 +5,6 @@ #include -#if !defined(BOOST_NO_HASH) -# define BOOST_NO_HASH -#endif - #include #include #include "typestr.hpp" diff --git a/test/test_construction.hpp b/test/test_construction.hpp index 213ef037..4a5a4bbf 100644 --- a/test/test_construction.hpp +++ b/test/test_construction.hpp @@ -62,7 +62,7 @@ void build_property_graph(Graph const& g, Add, Label) { } template -void build_property_graph(Graph const& g, boost::mpl::true_, boost::mpl::false_) { +void build_property_graph(Graph const&, boost::mpl::true_, boost::mpl::false_) { using namespace boost; BOOST_CONCEPT_ASSERT((VertexMutablePropertyGraphConcept)); typedef typename vertex_property::type VertexProp; diff --git a/test/test_destruction.hpp b/test/test_destruction.hpp index 96df5866..f6d8b14c 100644 --- a/test/test_destruction.hpp +++ b/test/test_destruction.hpp @@ -15,7 +15,7 @@ //@{ // This will basically catch adjacency matrices, which don't get torn down. template -void destroy_graph(Graph& g, VertexSet const& verts, Remove, Label) +void destroy_graph(Graph&, VertexSet const&, Remove, Label) { } // This matches MutableGraph, so just remove a vertex and then clear. @@ -33,7 +33,7 @@ void destroy_graph(Graph& g, VertexSet const& verts, boost::mpl::true_, boost::m // This will match labeled graphs. template -void destroy_graph(Graph& g, VertexSet const& verts, boost::mpl::false_, boost::mpl::true_) { +void destroy_graph(Graph& g, VertexSet const&, boost::mpl::false_, boost::mpl::true_) { using namespace boost; BOOST_CONCEPT_ASSERT((VertexListGraphConcept)); // function_requires< VeretexMutableGraphConcept >(); @@ -84,7 +84,7 @@ void disconnect_graph(Graph& g, VertexSet const& verts, boost::mpl::false_) { } template -void disconnect_graph(Graph& g, VertexSet const& verts, boost::mpl::true_) { +void disconnect_graph(Graph& g, VertexSet const&, boost::mpl::true_) { using namespace boost; BOOST_CONCEPT_ASSERT((EdgeListGraphConcept)); // BOOST_CONCEPT_ASSERT((EdgeMutableGraphConcept)); diff --git a/test/test_direction.hpp b/test/test_direction.hpp index fb84b90a..b2774b1a 100644 --- a/test/test_direction.hpp +++ b/test/test_direction.hpp @@ -49,7 +49,7 @@ void test_outdirected_graph(Graph const& g, VertexSet const& verts, boost::mpl:: } template -void test_outdirected_graph(Graph const& g, VertexSet const& verts, boost::mpl::false_) +void test_outdirected_graph(Graph const&, VertexSet const&, boost::mpl::false_) { } //@} @@ -88,7 +88,7 @@ void test_indirected_graph(Graph const& g, VertexSet const& verts, boost::mpl::t } template -void test_indirected_graph(Graph const& g, VertexSet const& verts, boost::mpl::false_) +void test_indirected_graph(Graph const&, VertexSet const&, boost::mpl::false_) { } //@} @@ -122,7 +122,7 @@ void test_undirected_graph(Graph const& g, VertexSet const& verts, boost::mpl::t } template -void test_undirected_graph(Graph const& g, VertexSet const& verts, boost::mpl::false_) +void test_undirected_graph(Graph const&, VertexSet const&, boost::mpl::false_) { } //@} diff --git a/test/test_graphs.cpp b/test/test_graphs.cpp index 47b9cdbc..9133470a 100644 --- a/test/test_graphs.cpp +++ b/test/test_graphs.cpp @@ -6,8 +6,6 @@ #include -#define BOOST_NO_HASH - #include "typestr.hpp" #include diff --git a/test/tiernan_all_cycles.cpp b/test/tiernan_all_cycles.cpp index c51ae295..39f8af84 100644 --- a/test/tiernan_all_cycles.cpp +++ b/test/tiernan_all_cycles.cpp @@ -66,7 +66,7 @@ void test() } int -main(int argc, char *argv[]) +main(int, char *[]) { typedef undirected_graph<> Graph; typedef directed_graph<> DiGraph;