mirror of
https://github.com/boostorg/graph.git
synced 2026-07-21 13:23:42 +00:00
Compare commits
17 Commits
master
...
boost-1.31.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 71ed466d80 | |||
| a0c451569a | |||
| dfa3f853b0 | |||
| 7e1854a3e8 | |||
| 34fd4f8853 | |||
| cf691e58b8 | |||
| e9f17367f5 | |||
| e65970e86a | |||
| 07e8ab962b | |||
| b2719dfd07 | |||
| 1537480fae | |||
| 4d8191e286 | |||
| 7a0890a753 | |||
| a57125cf8d | |||
| f03d5ae56a | |||
| 99f82ff7e8 | |||
| 45082c1c24 |
@@ -75,7 +75,7 @@ representation of an undirected graph.
|
||||
<TABLE>
|
||||
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 2:</STRONG> Adjacency List Representation of an Undirected Graph.</CAPTION>
|
||||
<TR><TD><IMG SRC="./figs/undir-adj-matrix-graph2.gif" width="260" height="240"></TD>
|
||||
<TD><IMG SRC="./figs/undir-adj-list2.gif" width="62" height="122"></TD></TR>
|
||||
<TD><IMG SRC="./figs/undir-adj-list.gif" width="62" height="122"></TD></TR>
|
||||
</TABLE>
|
||||
</DIV><P></P>
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ representation of a graph.
|
||||
<TABLE>
|
||||
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 1:</STRONG> Adjacency Matrix Representation of a Directed Graph.</CAPTION>
|
||||
<TR><TD><IMG SRC="./figs/adj-matrix-graph3.gif" width="386" height="284"></TD>
|
||||
<TD><IMG SRC="./figs/adj-matrix2.gif" width="135" height="136"></TD></TR>
|
||||
<TD><IMG SRC="./figs/adj-matrix.gif" width="135" height="136"></TD></TR>
|
||||
</TABLE>
|
||||
</DIV><P></P>
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace boost {
|
||||
{ }
|
||||
|
||||
void increment() {
|
||||
++this->base();
|
||||
++this->base_reference();
|
||||
++m_targ;
|
||||
}
|
||||
|
||||
@@ -212,12 +212,12 @@ namespace boost {
|
||||
{
|
||||
if (m_targ < m_src) // first half
|
||||
{
|
||||
++this->base();
|
||||
++this->base_reference();
|
||||
}
|
||||
else
|
||||
{ // second half
|
||||
++m_inc;
|
||||
this->base() += m_inc;
|
||||
this->base_reference() += m_inc;
|
||||
}
|
||||
++m_targ;
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include <boost/graph/named_function_params.hpp>
|
||||
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/implicit_cast.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
@@ -207,12 +208,12 @@ namespace boost {
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <class VertexListGraph, class DFSVisitor, class ColorMap,
|
||||
class Vertex>
|
||||
template <class VertexListGraph, class DFSVisitor, class ColorMap>
|
||||
void
|
||||
depth_first_search(const VertexListGraph& g, DFSVisitor vis, ColorMap color,
|
||||
Vertex start_vertex)
|
||||
typename graph_traits<VertexListGraph>::vertex_descriptor start_vertex)
|
||||
{
|
||||
typedef typename graph_traits<VertexListGraph>::vertex_descriptor Vertex;
|
||||
function_requires<DFSVisitorConcept<DFSVisitor, VertexListGraph> >();
|
||||
typedef typename property_traits<ColorMap>::value_type ColorValue;
|
||||
typedef color_traits<ColorValue> Color;
|
||||
@@ -222,7 +223,7 @@ namespace boost {
|
||||
put(color, *ui, Color::white()); vis.initialize_vertex(*ui, g);
|
||||
}
|
||||
|
||||
if (start_vertex != *vertices(g).first){ vis.start_vertex(start_vertex, g);
|
||||
if (start_vertex != implicit_cast<Vertex>(*vertices(g).first)){ vis.start_vertex(start_vertex, g);
|
||||
detail::depth_first_visit_impl(g, start_vertex, vis, color,
|
||||
detail::nontruth2());
|
||||
}
|
||||
|
||||
@@ -1019,31 +1019,9 @@ namespace boost {
|
||||
// Placement of these overloaded remove_edge() functions
|
||||
// inside the class avoids a VC++ bug.
|
||||
|
||||
// O(E/V)
|
||||
inline void
|
||||
remove_edge(typename Config::edge_descriptor e)
|
||||
{
|
||||
typedef typename Config::graph_type graph_type;
|
||||
graph_type& g = static_cast<graph_type&>(*this);
|
||||
void
|
||||
remove_edge(typename Config::edge_descriptor e);
|
||||
|
||||
typedef typename Config::OutEdgeList::value_type::property_type PType;
|
||||
|
||||
typename Config::OutEdgeList& out_el = g.out_edge_list(source(e, g));
|
||||
typename Config::OutEdgeList::iterator out_i = out_el.begin();
|
||||
for (; out_i != out_el.end(); ++out_i)
|
||||
if (&(*out_i).get_property() == (PType*)e.get_property()) {
|
||||
out_el.erase(out_i);
|
||||
break;
|
||||
}
|
||||
typename Config::InEdgeList& in_el = in_edge_list(g, target(e, g));
|
||||
typename Config::InEdgeList::iterator in_i = in_el.begin();
|
||||
for (; in_i != in_el.end(); ++in_i)
|
||||
if (&(*in_i).get_property() == (PType*)e.get_property()) {
|
||||
g.m_edges.erase((*in_i).get_iter());
|
||||
in_el.erase(in_i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
inline void
|
||||
remove_edge(typename Config::out_edge_iterator iter)
|
||||
{
|
||||
@@ -1065,7 +1043,17 @@ namespace boost {
|
||||
detail::remove_edge_and_property(g, g.out_edge_list(u), v, Cat());
|
||||
detail::erase_from_incidence_list(in_edge_list(g, v), u, Cat());
|
||||
}
|
||||
// O(E/V)
|
||||
|
||||
// O(E/V) or O(log(E/V))
|
||||
template <class Config>
|
||||
inline void
|
||||
bidirectional_graph_helper_with_property<Config>::remove_edge(typename Config::edge_descriptor e)
|
||||
{
|
||||
typedef typename Config::graph_type graph_type;
|
||||
graph_type& g = static_cast<graph_type&>(*this);
|
||||
boost::remove_edge(source(e, g), target(e, g), *this);
|
||||
}
|
||||
// O(E/V) or O(log(E/V))
|
||||
template <class EdgeOrIter, class Config>
|
||||
inline void
|
||||
remove_edge(EdgeOrIter e,
|
||||
@@ -1333,9 +1321,12 @@ namespace boost {
|
||||
boost::disallow_parallel_edge_tag) const
|
||||
{
|
||||
bool found;
|
||||
/* According to the standard, this should be iterator, not const_iterator,
|
||||
but the VC++ std::set::find() const returns const_iterator.
|
||||
And since iterator should be convertible to const_iterator, the
|
||||
following should work everywhere. -Jeremy */
|
||||
typename Config::OutEdgeList::const_iterator
|
||||
i = std::find(g.out_edge_list(u).begin(),
|
||||
g.out_edge_list(u).end(), StoredEdge(v)),
|
||||
i = g.out_edge_list(u).find(StoredEdge(v)),
|
||||
end = g.out_edge_list(u).end();
|
||||
found = (i != end);
|
||||
if (found)
|
||||
|
||||
+17
-45
@@ -3,8 +3,7 @@
|
||||
# declared in <boost/graph/graphviz.hpp>. There are both directed
|
||||
# and undirected graph versions of these functions. To use both, you
|
||||
# will need to compile the code generated from graphviz_parser.y twice,
|
||||
# once with -DGRAPHVIZ_GRAPH=boost::GraphvizDigraph and once with
|
||||
# -DGRAPHVIZ_GRAPH=boost::GraphvizGraph.
|
||||
# once with -DGRAPHVIZ_DIRECTED=0 and once with -DGRAPHVIZ_DIRECTED=1.
|
||||
#
|
||||
# This Makefile will most likely *not* work on your system.
|
||||
# We have not yet had time to create a portable Makefile.
|
||||
@@ -13,7 +12,7 @@
|
||||
|
||||
BOOST = ../../..
|
||||
|
||||
CXX = g++ -ftemplate-depth-30
|
||||
CXX = g++ -ftemplate-depth-50
|
||||
LEX = flex
|
||||
YACC = bison
|
||||
MV = /bin/mv
|
||||
@@ -33,8 +32,6 @@ AR = ar
|
||||
|
||||
default: libbgl-viz.a libbgl-viz.so
|
||||
|
||||
.SUFFIXES: .cpp .o .l .y .c
|
||||
|
||||
OBJS = graphviz_graph_lex.o graphviz_digraph_lex.o graphviz_digraph_parser.o graphviz_graph_parser.o
|
||||
|
||||
libbgl-viz.a: $(OBJS)
|
||||
@@ -47,8 +44,8 @@ libbgl-viz.so: $(OBJS)
|
||||
ln -s $@.$(GRAPH_SONAME_VERSION) $@
|
||||
|
||||
# this next part is a bit strange. We compile graphviz_parser.cpp twice.
|
||||
# Once with for undirected graphs with GRAPHVIZ_GRAPH=boost::GraphvizGraph
|
||||
# and once for directed graphs with GRAPHVIZ_GRAPH=boost::GraphvizDigraph.
|
||||
# Once with for undirected graphs with GRAPHVIZ_DIRECTED=0
|
||||
# and once for directed graphs with GRAPHVIZ_DIRECTED=1.
|
||||
|
||||
graphviz_graph_parser.o: graphviz_graph_parser.cpp
|
||||
$(CXX) -DGRAPHVIZ_DIRECTED=0 $(CXXFLAGS) -c graphviz_graph_parser.cpp -o graphviz_graph_parser.o
|
||||
@@ -56,49 +53,24 @@ graphviz_graph_parser.o: graphviz_graph_parser.cpp
|
||||
graphviz_digraph_parser.o: graphviz_digraph_parser.cpp
|
||||
$(CXX) -DGRAPHVIZ_DIRECTED=1 $(CXXFLAGS) -c graphviz_digraph_parser.cpp -o graphviz_digraph_parser.o
|
||||
|
||||
graphviz_graph_lex.o: graphviz_graph_lex.cpp graphviz_parser.h
|
||||
$(CXX) $(CXXFLAGS) -c graphviz_graph_lex.cpp
|
||||
graphviz_graph_lex.o: graphviz_graph_lex.cpp graphviz_graph_parser.hpp
|
||||
$(CXX) -DGRAPHVIZ_DIRECTED=0 $(CXXFLAGS) -c graphviz_graph_lex.cpp
|
||||
|
||||
graphviz_digraph_lex.o: graphviz_digraph_lex.cpp graphviz_parser.h
|
||||
$(CXX) $(CXXFLAGS) -c graphviz_digraph_lex.cpp
|
||||
graphviz_digraph_lex.o: graphviz_digraph_lex.cpp graphviz_digraph_parser.hpp
|
||||
$(CXX) -DGRAPHVIZ_DIRECTED=1 $(CXXFLAGS) -c graphviz_digraph_lex.cpp
|
||||
|
||||
graphviz_graph_lex.cpp: graphviz_lex.l
|
||||
$(LEX) graphviz_lex.l
|
||||
rm -rf graphviz_graph_lex.cpp
|
||||
sed -f ./sed-undir lex.yy.c > graphviz_graph_lex.cpp
|
||||
graphviz_graph_lex.cpp: graphviz_lex.ll
|
||||
$(LEX) -Pbgl_undir_ -ographviz_graph_lex.cpp graphviz_lex.ll
|
||||
|
||||
graphviz_digraph_lex.cpp: graphviz_lex.l
|
||||
$(LEX) graphviz_lex.l
|
||||
rm -rf graphviz_digraph_lex.cpp
|
||||
sed -f ./sed-dir lex.yy.c > graphviz_digraph_lex.cpp
|
||||
graphviz_digraph_lex.cpp: graphviz_lex.ll
|
||||
$(LEX) -Pbgl_dir_ -ographviz_digraph_lex.cpp graphviz_lex.ll
|
||||
|
||||
graphviz_graph_parser.cpp: graphviz_parser.y
|
||||
$(YACC) -p bgl_undir_ -d -v graphviz_parser.y
|
||||
sed -f ./sed-undir graphviz_parser.tab.c > graphviz_graph_parser.cpp
|
||||
graphviz_graph_parser.cpp graphviz_graph_parser.hpp: graphviz_parser.yy
|
||||
$(YACC) -p bgl_undir_ -d -v -o graphviz_graph_parser.cpp graphviz_parser.yy
|
||||
|
||||
graphviz_digraph_parser.cpp: graphviz_parser.y
|
||||
$(YACC) -p bgl_dir_ -d -v graphviz_parser.y
|
||||
sed -f ./sed-dir graphviz_parser.tab.c > graphviz_digraph_parser.cpp
|
||||
|
||||
graphviz_parser.h: graphviz_digraph_parser.cpp
|
||||
$(MV) graphviz_parser.tab.h graphviz_parser.h
|
||||
|
||||
dist:
|
||||
mkdir -p ./tmp/graphviz/boost/boost/graph
|
||||
cp boost/boost/graph/graphviz.hpp ./tmp/graphviz/boost/boost/graph
|
||||
cp graphviz.grammar ./tmp/graphviz
|
||||
cp graphviz_parser.cpp ./tmp/graphviz
|
||||
cp graphviz_lex.cpp ./tmp/graphviz
|
||||
cp graphviz_parser.h ./tmp/graphviz
|
||||
cp graphviz_graph_type.h ./tmp/graphviz
|
||||
cp graphviz_lex.l ./tmp/graphviz
|
||||
cp graphviz_parser.y ./tmp/graphviz
|
||||
cp graphviz.cpp ./tmp/graphviz
|
||||
cp *.dot ./tmp/graphviz
|
||||
cp Makefile ./tmp/graphviz
|
||||
cd ./tmp; tar cvfz graphviz.tgz graphviz; $(MV) graphviz.tgz ..; cd ..
|
||||
/bin/rm -rf ./tmp
|
||||
graphviz_digraph_parser.cpp graphviz_digraph_parser.hpp: graphviz_parser.yy
|
||||
$(YACC) -p bgl_dir_ -d -v -o graphviz_digraph_parser.cpp graphviz_parser.yy
|
||||
|
||||
|
||||
clean:
|
||||
/bin/rm -rf *.o *.a *.so* *.output graphviz_digraph_parser.cpp graphviz_graph_parser.cpp graphviz_lex.cpp graphviz_parser.h
|
||||
/bin/rm -rf *.o *.a *.so* *.output graphviz_digraph_parser.cpp graphviz_digraph_parser.hpp graphviz_graph_parser.cpp graphviz_graph_parser.hpp graphviz_digraph_lex.cpp graphviz_graph_lex.cpp
|
||||
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
s/yylex/bgl_dir_lex/g
|
||||
s/yyerror/bgl_dir_error/g
|
||||
s/yylval/bgl_dir_lval/g
|
||||
s/yychar/bgl_dir_char/g
|
||||
s/yydebug/bgl_dir_debug/g
|
||||
s/yynerrs/bgl_dir_nerrs/g
|
||||
s/yyin/bgl_dir_in/g
|
||||
s/yyout/bgl_dir_out/g
|
||||
s/yy_create_buffer/bgl_dir_create_buffer/g
|
||||
s/yy_load_buffer_state/bgl_dir_load_buffer_state/g
|
||||
s/yyrestart/bgl_dir_restart/g
|
||||
s/yy_init_buffer/bgl_dir_init_buffer/g
|
||||
s/yy_switch_to_buffer/bgl_dir_switch_to_buffer/g
|
||||
s/yy_delete_buffer/bgl_dir_delete_buffer/g
|
||||
s/yy_flush_buffer/bgl_dir_flush_buffer/g
|
||||
s/yy_scan_buffer/bgl_dir_scan_buffer/g
|
||||
s/yy_scan_string/bgl_dir_scan_string/g
|
||||
s/yy_scan_bytes/bgl_dir_scan_bytes/g
|
||||
s/yyleng/bgl_dir_leng/g
|
||||
s/yytext/bgl_dir_text/g
|
||||
@@ -1,20 +0,0 @@
|
||||
s/yylex/bgl_undir_lex/g
|
||||
s/yyerror/bgl_undir_error/g
|
||||
s/yylval/bgl_undir_lval/g
|
||||
s/yychar/bgl_undir_char/g
|
||||
s/yydebug/bgl_undir_debug/g
|
||||
s/yynerrs/bgl_undir_nerrs/g
|
||||
s/yyin/bgl_undir_in/g
|
||||
s/yyout/bgl_undir_out/g
|
||||
s/yy_create_buffer/bgl_undir_create_buffer/g
|
||||
s/yy_load_buffer_state/bgl_undir_load_buffer_state/g
|
||||
s/yyrestart/bgl_undir_restart/g
|
||||
s/yy_init_buffer/bgl_undir_init_buffer/g
|
||||
s/yy_switch_to_buffer/bgl_undir_switch_to_buffer/g
|
||||
s/yy_delete_buffer/bgl_undir_delete_buffer/g
|
||||
s/yy_flush_buffer/bgl_undir_flush_buffer/g
|
||||
s/yy_scan_buffer/bgl_undir_scan_buffer/g
|
||||
s/yy_scan_string/bgl_undir_scan_string/g
|
||||
s/yy_scan_bytes/bgl_undir_scan_bytes/g
|
||||
s/yyleng/bgl_undir_leng/g
|
||||
s/yytext/bgl_undir_text/g
|
||||
+7
-18
@@ -1,24 +1,15 @@
|
||||
//=======================================================================
|
||||
// Copyright 2002 Indiana University.
|
||||
// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
|
||||
//
|
||||
// This file is part of the Boost Graph Library
|
||||
// Copyright (c) 2003 Institute of Transport,
|
||||
// Railway Construction and Operation,
|
||||
// University of Hanover, Germany
|
||||
//
|
||||
// You should have received a copy of the License Agreement for the
|
||||
// Boost Graph Library along with the software; see the file LICENSE.
|
||||
// Author: Jürgen Hunold
|
||||
//
|
||||
// Permission to modify the code and to distribute modified code is
|
||||
// granted, provided the text of this NOTICE is retained, a notice that
|
||||
// the code was modified is included with the above COPYRIGHT NOTICE and
|
||||
// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE
|
||||
// file is distributed with the modified code.
|
||||
// Use, modification and distribution are 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)
|
||||
//
|
||||
// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
|
||||
// By way of example, but not limitation, Licensor MAKES NO
|
||||
// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY
|
||||
// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS
|
||||
// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS
|
||||
// OR OTHER RIGHTS.
|
||||
//=======================================================================
|
||||
|
||||
#include <boost/config.hpp>
|
||||
@@ -82,7 +73,6 @@ int main(int, char* [])
|
||||
for (std::size_t k = 0; k < N; ++k)
|
||||
add_vertex(current_vertex_id++, g);
|
||||
|
||||
// also need to test EdgeIterator graph constructor -JGS
|
||||
mt19937 gen;
|
||||
|
||||
for (j=0; j < 10; ++j) {
|
||||
@@ -111,7 +101,6 @@ int main(int, char* [])
|
||||
print_edges2(g, vertex_id_map, edge_id_map);
|
||||
print_graph(g, vertex_id_map);
|
||||
std::cout << "finished printing" << std::endl;
|
||||
// print_in_edges(g, vertex_id_map);
|
||||
#endif
|
||||
}
|
||||
++E;
|
||||
|
||||
Reference in New Issue
Block a user