2
0
mirror of https://github.com/boostorg/graph.git synced 2026-01-19 04:12:11 +00:00

examples: C++11: Use using instead of typedef

This commit is contained in:
Murray Cumming
2016-05-04 12:40:48 +02:00
committed by Murray Cumming
parent 1cfeb9ad6b
commit 35f6a2dc27
171 changed files with 912 additions and 1011 deletions

View File

@@ -35,25 +35,25 @@ BOOST_INSTALL_PROPERTY(vertex, compile_cost);
using namespace boost;
typedef adjacency_list< listS, // Store out-edges of each vertex in a std::list
listS, // Store vertex set in a std::list
directedS, // The file dependency graph is directed
// vertex properties
property< vertex_name_t, std::string,
property< vertex_compile_cost_t, float,
property< vertex_distance_t, float,
property< vertex_color_t, default_color_type > > > >,
// an edge property
property< edge_weight_t, float > >
file_dep_graph2;
using file_dep_graph2
= adjacency_list< listS, // Store out-edges of each vertex in a std::list
listS, // Store vertex set in a std::list
directedS, // The file dependency graph is directed
// vertex properties
property< vertex_name_t, std::string,
property< vertex_compile_cost_t, float,
property< vertex_distance_t, float,
property< vertex_color_t, default_color_type > > > >,
// an edge property
property< edge_weight_t, float > >;
typedef graph_traits< file_dep_graph2 >::vertex_descriptor vertex_t;
typedef graph_traits< file_dep_graph2 >::edge_descriptor edge_t;
using vertex_t = graph_traits< file_dep_graph2 >::vertex_descriptor;
using edge_t = graph_traits< file_dep_graph2 >::edge_descriptor;
int main(int argc, const char** argv)
{
std::ifstream file_in(argc >= 2 ? argv[1] : "makefile-dependencies.dat");
typedef graph_traits< file_dep_graph2 >::vertices_size_type size_type;
using size_type = graph_traits< file_dep_graph2 >::vertices_size_type;
size_type n_vertices;
file_in >> n_vertices; // read in number of vertices
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300

View File

@@ -34,11 +34,10 @@ struct Actor
int id;
};
typedef adjacency_list< vecS, vecS, undirectedS, Actor,
property< edge_centrality_t, double > >
ActorGraph;
typedef graph_traits< ActorGraph >::vertex_descriptor Vertex;
typedef graph_traits< ActorGraph >::edge_descriptor Edge;
using ActorGraph = adjacency_list< vecS, vecS, undirectedS, Actor,
property< edge_centrality_t, double > >;
using Vertex = graph_traits< ActorGraph >::vertex_descriptor;
using Edge = graph_traits< ActorGraph >::edge_descriptor;
void load_actor_graph(std::istream& in, ActorGraph& g)
{
@@ -50,7 +49,7 @@ void load_actor_graph(std::istream& in, ActorGraph& g)
std::vector< Vertex > actors_in_movie;
// Map from the actor numbers on this line to the actor vertices
typedef tokenizer< char_separator< char > > Tok;
using Tok = tokenizer< char_separator< char > >;
Tok tok(line, char_separator< char >(" "));
for (auto const & id : tok)
{
@@ -101,7 +100,7 @@ std::ostream& write_pajek_graph(std::ostream& out, const Graph& g,
class actor_clustering_threshold : public bc_clustering_threshold< double >
{
typedef bc_clustering_threshold< double > inherited;
using inherited = bc_clustering_threshold< double >;
public:
actor_clustering_threshold(

View File

@@ -14,12 +14,11 @@
int main()
{
using namespace boost;
typedef adjacency_list< vecS, vecS, bidirectionalS, no_property,
property< int, edge_weight_t >, no_property, vecS >
Graph;
using Graph = adjacency_list< vecS, vecS, bidirectionalS, no_property,
property< int, edge_weight_t >, no_property, vecS >;
const std::size_t n = 3;
typedef std::pair< std::size_t, std::size_t > E;
using E = std::pair< std::size_t, std::size_t >;
E edge_array[] = { E(0, 1), E(0, 2), E(0, 1) };
const std::size_t m = sizeof(edge_array) / sizeof(E);
Graph g(edge_array, edge_array + m, n);

View File

@@ -54,9 +54,8 @@ int main(int, char*[])
using namespace boost;
using namespace std;
typedef adjacency_list< vecS, listS, undirectedS, VertexProperties,
EdgeProperties >
Graph;
using Graph = adjacency_list< vecS, listS, undirectedS, VertexProperties,
EdgeProperties >;
const int V = 5;
Graph g(V);

View File

@@ -37,7 +37,8 @@ struct n1_t
{
num = 23063
};
typedef vertex_property_tag kind;
using kind = vertex_property_tag;
};
struct n2_t
{
@@ -45,7 +46,8 @@ struct n2_t
{
num = 23062
};
typedef vertex_property_tag kind;
using kind = vertex_property_tag;
};
struct n3_t
{
@@ -53,11 +55,11 @@ struct n3_t
{
num = 23061
};
typedef vertex_property_tag kind;
using kind = vertex_property_tag;
};
typedef property< n1_t, int,
property< n2_t, double, property< n3_t, MyStruct > > >
VertexProperty;
using VertexProperty = property< n1_t, int,
property< n2_t, double, property< n3_t, MyStruct > > >;
//====== edge properties
struct e1_t
@@ -66,18 +68,18 @@ struct e1_t
{
num = 23064
};
typedef edge_property_tag kind;
using kind = edge_property_tag;
};
typedef property< e1_t, double > EdgeProperty;
using EdgeProperty = property< e1_t, double >;
//===== graph types
typedef adjacency_list< vecS, listS, directedS, no_property, no_property >
Graph1;
using Graph1
= adjacency_list< vecS, listS, directedS, no_property, no_property >;
typedef adjacency_list< setS, setS, bidirectionalS, VertexProperty,
EdgeProperty >
Graph2;
using Graph2 = adjacency_list< setS, setS, bidirectionalS, VertexProperty,
EdgeProperty >;
int main()
{
@@ -103,7 +105,7 @@ int main()
// read Graph2, incomplete data in a different order. Write it diffently.
Graph2 g31;
std::ifstream readFile31("data3.txt");
typedef property< n3_t, MyStruct, property< n1_t, int > > readNodeProp;
using readNodeProp = property< n3_t, MyStruct, property< n1_t, int > >;
readFile31 >> read(g31, readNodeProp(), EdgeProperty());
std::cout << "graph g31 from file data3.txt:\n"
<< write(g31, property< n3_t, MyStruct >(), EdgeProperty())

View File

@@ -28,7 +28,7 @@ int main()
// A directed graph
typedef adjacency_matrix< directedS > Graph;
using Graph = adjacency_matrix< directedS >;
Graph g(N);
add_edge(B, C, g);
add_edge(B, F, g);
@@ -52,7 +52,7 @@ int main()
// An undirected graph
typedef adjacency_matrix< undirectedS > UGraph;
using UGraph = adjacency_matrix< undirectedS >;
UGraph ug(N);
add_edge(B, C, ug);
add_edge(B, F, ug);

View File

@@ -30,7 +30,7 @@ struct location
{
float y, x; // lat, long
};
typedef float cost;
using cost = float;
template < class Name, class LocMap > class city_writer
{
@@ -82,7 +82,7 @@ template < class Graph, class CostType, class LocMap >
class distance_heuristic : public astar_heuristic< Graph, CostType >
{
public:
typedef typename graph_traits< Graph >::vertex_descriptor Vertex;
using Vertex = typename graph_traits< Graph >::vertex_descriptor;
distance_heuristic(LocMap l, Vertex goal) : m_location(l), m_goal(goal) {}
CostType operator()(Vertex u)
{
@@ -120,13 +120,12 @@ int main(int argc, char** argv)
{
// specify some types
typedef adjacency_list< listS, vecS, undirectedS, no_property,
property< edge_weight_t, cost > >
mygraph_t;
typedef property_map< mygraph_t, edge_weight_t >::type WeightMap;
typedef mygraph_t::vertex_descriptor vertex;
typedef mygraph_t::edge_descriptor edge_descriptor;
typedef std::pair< int, int > edge;
using mygraph_t = adjacency_list< listS, vecS, undirectedS, no_property,
property< edge_weight_t, cost > >;
using WeightMap = property_map< mygraph_t, edge_weight_t >::type;
using vertex = mygraph_t::vertex_descriptor;
using edge_descriptor = mygraph_t::edge_descriptor;
using edge = std::pair< int, int >;
// specify data
enum nodes

View File

@@ -45,18 +45,18 @@
boost::mt19937 random_generator;
// Distance traveled in the maze
typedef double distance;
using distance = double;
#define GRID_RANK 2
typedef boost::grid_graph< GRID_RANK > grid;
typedef boost::graph_traits< grid >::vertex_descriptor vertex_descriptor;
typedef boost::graph_traits< grid >::vertices_size_type vertices_size_type;
using grid = boost::grid_graph< GRID_RANK >;
using vertex_descriptor = boost::graph_traits< grid >::vertex_descriptor;
using vertices_size_type = boost::graph_traits< grid >::vertices_size_type;
// A hash function for vertices.
struct vertex_hash
{
typedef vertex_descriptor argument_type;
typedef std::size_t result_type;
using argument_type = vertex_descriptor;
using result_type = std::size_t;
std::size_t operator()(vertex_descriptor const& u) const
{
std::size_t seed = 0;
@@ -66,9 +66,9 @@ struct vertex_hash
}
};
typedef boost::unordered_set< vertex_descriptor, vertex_hash > vertex_set;
typedef boost::vertex_subset_complement_filter< grid, vertex_set >::type
filtered_grid;
using vertex_set = boost::unordered_set< vertex_descriptor, vertex_hash >;
using filtered_grid
= boost::vertex_subset_complement_filter< grid, vertex_set >::type;
// A searchable maze
//
@@ -190,14 +190,13 @@ bool maze::solve()
{
boost::static_property_map< distance > weight(1);
// The predecessor map is a vertex-to-vertex mapping.
typedef boost::unordered_map< vertex_descriptor, vertex_descriptor,
vertex_hash >
pred_map;
using pred_map = boost::unordered_map< vertex_descriptor, vertex_descriptor,
vertex_hash >;
pred_map predecessor;
boost::associative_property_map< pred_map > pred_pmap(predecessor);
// The distance map is a vertex-to-distance mapping.
typedef boost::unordered_map< vertex_descriptor, distance, vertex_hash >
dist_map;
using dist_map
= boost::unordered_map< vertex_descriptor, distance, vertex_hash >;
dist_map distance;
boost::associative_property_map< dist_map > dist_pmap(distance);

View File

@@ -56,14 +56,14 @@ int main()
N
};
char name[] = { 'u', 'v', 'x', 'y', 'z' };
typedef std::pair< int, int > E;
using E = std::pair< int, int >;
const int n_edges = 10;
E edge_array[] = { E(u, y), E(u, x), E(u, v), E(v, u), E(x, y), E(x, v),
E(y, v), E(y, z), E(z, u), E(z, x) };
int weight[n_edges] = { -4, 8, 5, -2, 9, -3, 7, 2, 6, 7 };
typedef adjacency_list< vecS, vecS, directedS, no_property, EdgeProperties >
Graph;
using Graph
= adjacency_list< vecS, vecS, directedS, no_property, EdgeProperties >;
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
// VC++ can't handle the iterator constructor
Graph g(N);

View File

@@ -25,7 +25,7 @@ int main()
H,
n_vertices
};
typedef std::pair< int, int > Edge;
using Edge = std::pair< int, int >;
// The list of connections between routers stored in an array.
Edge edges[] = { Edge(A, B), Edge(A, C), Edge(B, D), Edge(B, E),
@@ -33,9 +33,8 @@ int main()
Edge(G, H) };
// Specify the graph type and declare a graph object
typedef edge_list< Edge*, Edge, std::ptrdiff_t,
std::random_access_iterator_tag >
Graph;
using Graph = edge_list< Edge*, Edge, std::ptrdiff_t,
std::random_access_iterator_tag >;
Graph g(std::begin(edges), std::end(edges));
// The transmission delay values for each edge.

View File

@@ -16,7 +16,7 @@ using namespace boost;
template < typename TimeMap >
class bfs_time_visitor : public default_bfs_visitor
{
typedef typename property_traits< TimeMap >::value_type T;
using T = typename property_traits< TimeMap >::value_type;
public:
bfs_time_visitor(TimeMap tmap, T& t) : m_timemap(tmap), m_time(t) {}
@@ -33,7 +33,7 @@ int main()
{
using namespace boost;
// Select the graph type we wish to use
typedef adjacency_list< vecS, vecS, undirectedS > graph_t;
using graph_t = adjacency_list< vecS, vecS, undirectedS >;
// Set up the vertex IDs and names
enum
{
@@ -49,7 +49,7 @@ int main()
};
const char* name = "rstuvwxy";
// Specify the edges in the graph
typedef std::pair< int, int > E;
using E = std::pair< int, int >;
E edge_array[] = { E(r, s), E(r, v), E(s, w), E(w, r), E(w, t), E(w, x),
E(x, t), E(t, u), E(x, y), E(u, y) };
// Create the graph object
@@ -60,18 +60,17 @@ int main()
for (std::size_t j = 0; j < n_edges; ++j)
add_edge(edge_array[j].first, edge_array[j].second, g);
#else
typedef graph_traits< graph_t >::vertices_size_type v_size_t;
using v_size_t = graph_traits< graph_t >::vertices_size_type;
graph_t g(edge_array, edge_array + n_edges, v_size_t(N));
#endif
// Typedefs
typedef graph_traits< graph_t >::vertices_size_type Size;
using Size = graph_traits< graph_t >::vertices_size_type;
// a vector to hold the discover time property for each vertex
std::vector< Size > dtime(num_vertices(g));
typedef iterator_property_map< std::vector< Size >::iterator,
property_map< graph_t, vertex_index_t >::const_type >
dtime_pm_type;
using dtime_pm_type = iterator_property_map< std::vector< Size >::iterator,
property_map< graph_t, vertex_index_t >::const_type >;
dtime_pm_type dtime_pm(dtime.begin(), get(vertex_index, g));
Size time = 0;

View File

@@ -17,7 +17,7 @@ using namespace boost;
template < typename TimeMap >
class bfs_time_visitor : public default_bfs_visitor
{
typedef typename property_traits< TimeMap >::value_type T;
using T = typename property_traits< TimeMap >::value_type;
public:
bfs_time_visitor(TimeMap tmap, T& t) : m_timemap(tmap), m_time(t) {}
@@ -41,7 +41,7 @@ int main()
{
using namespace boost;
// Select the graph type we wish to use
typedef adjacency_list< listS, listS, undirectedS, VertexProps > graph_t;
using graph_t = adjacency_list< listS, listS, undirectedS, VertexProps >;
// Set up the vertex IDs and names
enum
{
@@ -57,7 +57,7 @@ int main()
};
const char* name = "rstuvwxy";
// Specify the edges in the graph
typedef std::pair< int, int > E;
using E = std::pair< int, int >;
E edge_array[] = { E(r, s), E(r, v), E(s, w), E(w, r), E(w, t), E(w, x),
E(x, t), E(t, u), E(x, y), E(u, y) };
// Create the graph object
@@ -71,16 +71,16 @@ int main()
for (std::size_t j = 0; j < n_edges; ++j)
add_edge(verts[edge_array[j].first], verts[edge_array[j].second], g);
#else
typedef graph_traits< graph_t >::vertices_size_type v_size_t;
using v_size_t = graph_traits< graph_t >::vertices_size_type;
graph_t g(edge_array, edge_array + n_edges, v_size_t(N));
#endif
// Typedefs
typedef graph_traits< graph_t >::vertices_size_type Size;
using Size = graph_traits< graph_t >::vertices_size_type;
Size time = 0;
typedef property_map< graph_t, std::size_t VertexProps::* >::type
dtime_map_t;
using dtime_map_t
= property_map< graph_t, std::size_t VertexProps::* >::type;
auto dtime_map = get(&VertexProps::discover_time, g);
bfs_time_visitor< dtime_map_t > vis(dtime_map, time);
breadth_first_search(
@@ -88,9 +88,8 @@ int main()
// a vector to hold the discover time property for each vertex
std::vector< Size > dtime(num_vertices(g));
typedef iterator_property_map< std::vector< Size >::iterator,
property_map< graph_t, unsigned int VertexProps::* >::type >
dtime_pm_type;
using dtime_pm_type = iterator_property_map< std::vector< Size >::iterator,
property_map< graph_t, unsigned int VertexProps::* >::type >;
graph_traits< graph_t >::vertex_iterator vi, vi_end;
std::size_t c = 0;
for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi, ++c)

View File

@@ -74,7 +74,7 @@ struct EP
int main()
{
typedef adjacency_list< listS, vecS, directedS, VP, EP > graph_t;
using graph_t = adjacency_list< listS, vecS, directedS, VP, EP >;
graph_t g;
auto name_map = get(&VP::name, g);
@@ -82,7 +82,7 @@ int main()
build_router_network(g, name_map, delay_map);
typedef property_map< graph_t, char VP::* >::type VertexNameMap;
using VertexNameMap = property_map< graph_t, char VP::* >::type;
auto a = *vertices(g).first;
bfs_name_printer< VertexNameMap > vis(name_map);
std::cout << "BFS vertex discover order: ";

View File

@@ -70,7 +70,7 @@ template < class NewGraph, class Tag >
struct graph_copier
: public boost::base_visitor< graph_copier< NewGraph, Tag > >
{
typedef Tag event_filter;
using event_filter = Tag;
graph_copier(NewGraph& graph) : new_g(graph) {}
@@ -91,13 +91,12 @@ inline graph_copier< NewGraph, Tag > copy_graph(NewGraph& g, Tag)
int main(int, char*[])
{
typedef boost::adjacency_list< boost::mapS, boost::vecS,
using Graph = boost::adjacency_list< boost::mapS, boost::vecS,
boost::bidirectionalS,
boost::property< boost::vertex_color_t, boost::default_color_type,
boost::property< boost::vertex_degree_t, int,
boost::property< boost::vertex_in_degree_t, int,
boost::property< boost::vertex_out_degree_t, int > > > > >
Graph;
boost::property< boost::vertex_out_degree_t, int > > > > >;
Graph G(5);
boost::add_edge(0, 2, G);
@@ -112,7 +111,7 @@ int main(int, char*[])
boost::add_edge(4, 0, G);
boost::add_edge(4, 1, G);
typedef Graph::vertex_descriptor Vertex;
using Vertex = Graph::vertex_descriptor;
Graph G_copy(5);
// Array to store predecessor (parent) of each vertex. This will be
@@ -120,7 +119,7 @@ int main(int, char*[])
std::vector< Vertex > p(boost::num_vertices(G));
// VC++ version of std::vector has no ::pointer, so
// I use ::value_type* instead.
typedef std::vector< Vertex >::value_type* Piter;
using Piter = std::vector< Vertex >::value_type*;
// Array to store distances from the source to each vertex . We use
// a built-in array here just for variety. This will also be used as

View File

@@ -65,7 +65,7 @@ template < class NewGraph, class Tag >
struct graph_copier
: public boost::base_visitor< graph_copier< NewGraph, Tag > >
{
typedef Tag event_filter;
using event_filter = Tag;
graph_copier(NewGraph& graph) : new_g(graph) {}
@@ -86,13 +86,12 @@ inline graph_copier< NewGraph, Tag > copy_graph(NewGraph& g, Tag)
int main(int, char*[])
{
typedef boost::adjacency_list< boost::mapS, boost::vecS,
using Graph = boost::adjacency_list< boost::mapS, boost::vecS,
boost::bidirectionalS,
boost::property< boost::vertex_color_t, boost::default_color_type,
boost::property< boost::vertex_degree_t, int,
boost::property< boost::vertex_in_degree_t, int,
boost::property< boost::vertex_out_degree_t, int > > > > >
Graph;
boost::property< boost::vertex_out_degree_t, int > > > > >;
Graph G(5);
boost::add_edge(0, 2, G);
@@ -107,14 +106,14 @@ int main(int, char*[])
boost::add_edge(4, 0, G);
boost::add_edge(4, 1, G);
typedef Graph::vertex_descriptor Vertex;
using Vertex = Graph::vertex_descriptor;
// Array to store predecessor (parent) of each vertex. This will be
// used as a Decorator (actually, its iterator will be).
std::vector< Vertex > p(boost::num_vertices(G));
// VC++ version of std::vector has no ::pointer, so
// I use ::value_type* instead.
typedef std::vector< Vertex >::value_type* Piter;
using Piter = std::vector< Vertex >::value_type*;
// Array to store distances from the source to each vertex . We use
// a built-in array here just for variety. This will also be used as

View File

@@ -21,17 +21,16 @@ struct edge_component_t
{
num = 555
};
typedef edge_property_tag kind;
using kind = edge_property_tag;
} edge_component;
}
int main()
{
using namespace boost;
typedef adjacency_list< vecS, vecS, undirectedS, no_property,
property< edge_component_t, std::size_t > >
graph_t;
typedef graph_traits< graph_t >::vertex_descriptor vertex_t;
using graph_t = adjacency_list< vecS, vecS, undirectedS, no_property,
property< edge_component_t, std::size_t > >;
using vertex_t = graph_traits< graph_t >::vertex_descriptor;
graph_t g(9);
add_edge(0, 5, g);
add_edge(0, 1, g);

View File

@@ -20,7 +20,7 @@ using namespace boost;
template < typename Graph > void print_bipartite(const Graph& g)
{
typedef graph_traits< Graph > traits;
using traits = graph_traits< Graph >;
typename traits::vertex_iterator vertex_iter, vertex_end;
/// Most simple interface just tests for bipartiteness.
@@ -29,11 +29,11 @@ template < typename Graph > void print_bipartite(const Graph& g)
if (bipartite)
{
typedef std::vector< default_color_type > partition_t;
typedef
typename property_map< Graph, vertex_index_t >::type index_map_t;
typedef iterator_property_map< partition_t::iterator, index_map_t >
partition_map_t;
using partition_t = std::vector< default_color_type >;
using index_map_t =
typename property_map< Graph, vertex_index_t >::type;
using partition_map_t
= iterator_property_map< partition_t::iterator, index_map_t >;
partition_t partition(num_vertices(g));
partition_map_t partition_map(partition.begin(), get(vertex_index, g));
@@ -57,8 +57,8 @@ template < typename Graph > void print_bipartite(const Graph& g)
}
else
{
typedef std::vector< typename traits::vertex_descriptor >
vertex_vector_t;
using vertex_vector_t
= std::vector< typename traits::vertex_descriptor >;
vertex_vector_t odd_cycle;
/// A third interface yields an odd-cycle if the graph is not bipartite.
@@ -76,8 +76,8 @@ template < typename Graph > void print_bipartite(const Graph& g)
int main(int argc, char** argv)
{
typedef adjacency_list< vecS, vecS, undirectedS > vector_graph_t;
typedef std::pair< int, int > E;
using vector_graph_t = adjacency_list< vecS, vecS, undirectedS >;
using E = std::pair< int, int >;
/**
* Create the graph drawn below.

View File

@@ -47,7 +47,7 @@ public:
void discover_vertex(
typename boost::graph_traits< Graph >::vertex_descriptor v, Graph&)
{
typedef typename boost::property_traits< DistanceMap >::value_type Dist;
using Dist = typename boost::property_traits< DistanceMap >::value_type;
// indentation based on depth
for (Dist i = 0; i < distance[v]; ++i)
std::cout << " ";
@@ -80,17 +80,16 @@ int main(int argc, const char** argv)
//===========================================================================
// Declare the graph type and object, and some property maps.
typedef adjacency_list< vecS, vecS, directedS,
using Graph = adjacency_list< vecS, vecS, directedS,
property< vertex_name_t, std::string,
property< vertex_color_t, default_color_type > >,
property< edge_name_t, std::string, property< edge_weight_t, int > > >
Graph;
property< edge_name_t, std::string, property< edge_weight_t, int > > >;
typedef graph_traits< Graph > Traits;
typedef Traits::vertex_descriptor Vertex;
typedef Traits::edge_descriptor Edge;
using Traits = graph_traits< Graph >;
using Vertex = Traits::vertex_descriptor;
using Edge = Traits::edge_descriptor;
typedef std::map< std::string, Vertex > NameVertexMap;
using NameVertexMap = std::map< std::string, Vertex >;
NameVertexMap name2vertex;
Graph g;
@@ -149,8 +148,8 @@ int main(int argc, const char** argv)
//===========================================================================
// Calculate the diameter of the graph.
typedef Traits::vertices_size_type size_type;
typedef std::vector< size_type > IntVector;
using size_type = Traits::vertices_size_type;
using IntVector = std::vector< size_type >;
// Create N x N matrix for storing the shortest distances
// between each vertex. Initialize all distances to zero.
std::vector< IntVector > d_matrix(

View File

@@ -70,19 +70,17 @@ int main()
{
using namespace boost;
typedef adjacency_list_traits< vecS, vecS, directedS > Traits;
typedef adjacency_list< vecS, vecS, directedS,
using Traits = adjacency_list_traits< vecS, vecS, directedS >;
using Graph = adjacency_list< vecS, vecS, directedS,
property< vertex_name_t, std::string,
property< vertex_index_t, long,
property< vertex_color_t, boost::default_color_type,
property< vertex_distance_t, long,
property< vertex_predecessor_t,
Traits::edge_descriptor > > > > >,
property< edge_capacity_t, long,
property< edge_residual_capacity_t, long,
property< edge_reverse_t, Traits::edge_descriptor > > > >
Graph;
property< edge_reverse_t, Traits::edge_descriptor > > > >;
Graph g;
auto capacity = get(edge_capacity, g);

View File

@@ -18,9 +18,9 @@ using namespace std;
using namespace boost;
// Declare the graph type and its vertex and edge types.
typedef undirected_graph<> Graph;
typedef graph_traits< Graph >::vertex_descriptor Vertex;
typedef graph_traits< Graph >::edge_descriptor Edge;
using Graph = undirected_graph<>;
using Vertex = graph_traits< Graph >::vertex_descriptor;
using Edge = graph_traits< Graph >::edge_descriptor;
int main(int argc, char* argv[])
{

View File

@@ -42,13 +42,13 @@ struct Actor
};
// Declare the graph type and its vertex and edge types.
typedef undirected_graph< Actor > Graph;
typedef graph_traits< Graph >::vertex_descriptor Vertex;
typedef graph_traits< Graph >::edge_descriptor Edge;
using Graph = undirected_graph< Actor >;
using Vertex = graph_traits< Graph >::vertex_descriptor;
using Edge = graph_traits< Graph >::edge_descriptor;
// The name map provides an abstract accessor for the names of
// each vertex. This is used during graph creation.
typedef property_map< Graph, string Actor::* >::type NameMap;
using NameMap = property_map< Graph, string Actor::* >::type;
int main(int argc, char* argv[])
{

View File

@@ -29,10 +29,9 @@ int main()
cout << "Number " << i << " is in bucket " << bucket[i] << endl;
}
typedef boost::identity_property_map ID;
typedef bucket_sorter< std::size_t, int, vector< std::size_t >::iterator,
ID >
BS;
using ID = boost::identity_property_map;
using BS = bucket_sorter< std::size_t, int, vector< std::size_t >::iterator,
ID >;
BS my_bucket_sorter(N, N, bucket.begin());
for (std::size_t ii = 0; ii < N; ii++)

View File

@@ -21,9 +21,8 @@ using namespace boost;
int main(int argc, char** argv)
{
typedef adjacency_list< vecS, vecS, undirectedS,
property< vertex_index_t, int >, property< edge_index_t, int > >
graph;
using graph = adjacency_list< vecS, vecS, undirectedS,
property< vertex_index_t, int >, property< edge_index_t, int > >;
// Create a maximal planar graph on 6 vertices
graph g(6);
@@ -52,7 +51,7 @@ int main(int argc, char** argv)
// Test for planarity - we know it is planar, we just want to
// compute the planar embedding as a side-effect
typedef std::vector< graph_traits< graph >::edge_descriptor > vec_t;
using vec_t = std::vector< graph_traits< graph >::edge_descriptor >;
std::vector< vec_t > embedding(num_vertices(g));
if (boyer_myrvold_planarity_test(boyer_myrvold_params::graph = g,
boyer_myrvold_params::embedding = make_iterator_property_map(
@@ -61,8 +60,8 @@ int main(int argc, char** argv)
else
std::cout << "Input graph is not planar" << std::endl;
typedef std::vector< graph_traits< graph >::vertex_descriptor >
ordering_storage_t;
using ordering_storage_t
= std::vector< graph_traits< graph >::vertex_descriptor >;
ordering_storage_t ordering;
planar_canonical_ordering(g,

View File

@@ -56,7 +56,7 @@ using namespace boost;
struct city_arrival : public base_visitor< city_arrival >
{
city_arrival(string* n) : names(n) {}
typedef on_discover_vertex event_filter;
using event_filter = on_discover_vertex;
template < class Vertex, class Graph >
inline void operator()(Vertex u, Graph&)
{
@@ -70,7 +70,7 @@ struct city_arrival : public base_visitor< city_arrival >
struct neighbor_cities : public base_visitor< neighbor_cities >
{
neighbor_cities(string* n) : names(n) {}
typedef on_examine_edge event_filter;
using event_filter = on_examine_edge;
template < class Edge, class Graph >
inline void operator()(Edge e, Graph& g)
{
@@ -82,7 +82,7 @@ struct neighbor_cities : public base_visitor< neighbor_cities >
struct finish_city : public base_visitor< finish_city >
{
finish_city(string* n) : names(n) {}
typedef on_finish_vertex event_filter;
using event_filter = on_finish_vertex;
template < class Vertex, class Graph >
inline void operator()(Vertex u, Graph&)
{
@@ -113,14 +113,14 @@ int main(int, char*[])
= { "San Jose", "San Francisco", "Los Angeles", "San Diego", "Fresno",
"Las Vegas", "Reno", "Sacramento", "Salt Lake City", "Phoenix" };
typedef std::pair< int, int > E;
using E = std::pair< int, int >;
E edge_array[]
= { E(Sacramento, Reno), E(Sacramento, SanFran), E(Reno, SaltLake),
E(SanFran, SanJose), E(SanJose, Fresno), E(SanJose, LA),
E(LA, LasVegas), E(LA, SanDiego), E(LasVegas, Phoenix) };
/* Create the graph type we want. */
typedef adjacency_list< vecS, vecS, undirectedS > Graph;
using Graph = adjacency_list< vecS, vecS, undirectedS >;
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
// VC++ has trouble with the edge iterator constructor
Graph G(N);

View File

@@ -25,29 +25,29 @@ struct Actor
};
// Declare the graph type and its vertex and edge types.
typedef undirected_graph< Actor > Graph;
typedef graph_traits< Graph >::vertex_descriptor Vertex;
typedef graph_traits< Graph >::edge_descriptor Edge;
using Graph = undirected_graph< Actor >;
using Vertex = graph_traits< Graph >::vertex_descriptor;
using Edge = graph_traits< Graph >::edge_descriptor;
// The name map provides an abstract accessor for the names of
// each vertex. This is used during graph creation.
typedef property_map< Graph, string Actor::* >::type NameMap;
using NameMap = property_map< Graph, string Actor::* >::type;
// Declare a matrix type and its corresponding property map that
// will contain the distances between each pair of vertices.
typedef exterior_vertex_property< Graph, int > DistanceProperty;
typedef DistanceProperty::matrix_type DistanceMatrix;
typedef DistanceProperty::matrix_map_type DistanceMatrixMap;
using DistanceProperty = exterior_vertex_property< Graph, int >;
using DistanceMatrix = DistanceProperty::matrix_type;
using DistanceMatrixMap = DistanceProperty::matrix_map_type;
// Declare the weight map so that each edge returns the same value.
typedef constant_property_map< Edge, int > WeightMap;
using WeightMap = constant_property_map< Edge, int >;
// Declare a container and its corresponding property map that
// will contain the resulting closeness centralities of each
// vertex in the graph.
typedef boost::exterior_vertex_property< Graph, float > ClosenessProperty;
typedef ClosenessProperty::container_type ClosenessContainer;
typedef ClosenessProperty::map_type ClosenessMap;
using ClosenessProperty = boost::exterior_vertex_property< Graph, float >;
using ClosenessContainer = ClosenessProperty::container_type;
using ClosenessMap = ClosenessProperty::map_type;
int main(int argc, char* argv[])
{

View File

@@ -23,19 +23,19 @@ struct Actor
};
// Declare the graph type and its vertex and edge types.
typedef undirected_graph< Actor > Graph;
typedef graph_traits< Graph >::vertex_descriptor Vertex;
typedef graph_traits< Graph >::edge_descriptor Edge;
using Graph = undirected_graph< Actor >;
using Vertex = graph_traits< Graph >::vertex_descriptor;
using Edge = graph_traits< Graph >::edge_descriptor;
// The name map provides an abstract accessor for the names of
// each vertex. This is used during graph creation.
typedef property_map< Graph, string Actor::* >::type NameMap;
using NameMap = property_map< Graph, string Actor::* >::type;
// The clustering property, container, and map define the containment
// and abstract accessor for the clustering coefficients of vertices.
typedef exterior_vertex_property< Graph, float > ClusteringProperty;
typedef ClusteringProperty::container_type ClusteringContainer;
typedef ClusteringProperty::map_type ClusteringMap;
using ClusteringProperty = exterior_vertex_property< Graph, float >;
using ClusteringContainer = ClusteringProperty::container_type;
using ClusteringMap = ClusteringProperty::map_type;
int main(int argc, char* argv[])
{

View File

@@ -54,8 +54,8 @@ using boost::tie;
int main(int, char*[])
{
using namespace boost;
typedef int Index; // ID of a Vertex
typedef pair< Index, Index > Edge;
using Index = int; // ID of a Vertex
using Edge = pair< Index, Index >;
const int N = 6;
const int E = 4;
Edge edgelist[] = { Edge(0, 1), Edge(1, 4), Edge(4, 0), Edge(2, 5) };

View File

@@ -14,7 +14,7 @@
int main()
{
using namespace boost;
typedef adjacency_list< vecS, vecS, undirectedS > Graph;
using Graph = adjacency_list< vecS, vecS, undirectedS >;
const int N = 6;
Graph G(N);

View File

@@ -40,7 +40,7 @@ int main(int, char*[])
{
using namespace boost;
{
typedef adjacency_list< vecS, vecS, undirectedS > Graph;
using Graph = adjacency_list< vecS, vecS, undirectedS >;
Graph G;
add_edge(0, 1, G);

View File

@@ -21,24 +21,24 @@ template < class Alloc, class ValueType >
struct container_gen< list_with_allocatorS< Alloc >, ValueType >
{
#ifdef BOOST_NO_CXX11_ALLOCATOR
typedef typename Alloc::template rebind< ValueType >::other Allocator;
using Allocator = typename Alloc::template rebind< ValueType >::other;
#else
typedef typename std::allocator_traits<Alloc>::template rebind_alloc<ValueType> Allocator;
using Allocator = typename std::allocator_traits<
Alloc >::template rebind_alloc< ValueType >;
#endif
typedef std::list< ValueType, Allocator > type;
using type = std::list< ValueType, Allocator >;
};
template < class Alloc >
struct parallel_edge_traits< list_with_allocatorS< Alloc > >
{
typedef allow_parallel_edge_tag type;
using type = allow_parallel_edge_tag;
};
}
// now you can define a graph using std::list and a specific allocator
typedef boost::adjacency_list< list_with_allocatorS< std::allocator< int > >,
boost::vecS, boost::directedS >
MyGraph;
using MyGraph
= boost::adjacency_list< list_with_allocatorS< std::allocator< int > >,
boost::vecS, boost::directedS >;
int main(int, char*[])
{

View File

@@ -14,9 +14,8 @@
int main()
{
using namespace boost;
typedef adjacency_list< vecS, vecS, directedS,
property< vertex_name_t, char > >
graph_t;
using graph_t = adjacency_list< vecS, vecS, directedS,
property< vertex_name_t, char > >;
enum
{
@@ -36,7 +35,7 @@ int main()
for (boost::tie(v, v_end) = vertices(G); v != v_end; ++v, ++name)
name_map[*v] = name;
typedef std::pair< int, int > E;
using E = std::pair< int, int >;
E edges[] = { E(a, c), E(a, d), E(b, a), E(b, d), E(c, f), E(d, c), E(d, e),
E(d, f), E(e, b), E(e, g), E(f, e), E(f, g) };
for (int i = 0; i < 12; ++i)

View File

@@ -24,7 +24,7 @@ public:
int main()
{
typedef std::pair< int, int > E;
using E = std::pair< int, int >;
const char* urls[6] = {
"http://www.boost.org/libs/graph/doc/index.html",
"http://www.boost.org/libs/graph/doc/table_of_contents.html",
@@ -37,7 +37,7 @@ int main()
E the_edges[] = { E(0, 1), E(0, 2), E(0, 3), E(1, 0), E(1, 3), E(1, 5),
E(2, 0), E(2, 5), E(3, 1), E(3, 4), E(4, 1), E(5, 0), E(5, 2) };
typedef compressed_sparse_row_graph< directedS, WebPage > WebGraph;
using WebGraph = compressed_sparse_row_graph< directedS, WebPage >;
WebGraph g(boost::edges_are_sorted, &the_edges[0],
&the_edges[0] + sizeof(the_edges) / sizeof(E), 6);

View File

@@ -33,14 +33,13 @@ int main(int, char*[])
{
using namespace boost;
using namespace std;
typedef adjacency_list< vecS, vecS, undirectedS,
using Graph = adjacency_list< vecS, vecS, undirectedS,
property< vertex_color_t, default_color_type,
property< vertex_degree_t, int > > >
Graph;
typedef graph_traits< Graph >::vertex_descriptor Vertex;
typedef graph_traits< Graph >::vertices_size_type size_type;
property< vertex_degree_t, int > > >;
using Vertex = graph_traits< Graph >::vertex_descriptor;
using size_type = graph_traits< Graph >::vertices_size_type;
typedef std::pair< std::size_t, std::size_t > Pair;
using Pair = std::pair< std::size_t, std::size_t >;
Pair edges[14] = { Pair(0, 3), // a-d
Pair(0, 5), // a-f
Pair(1, 2), // b-c

View File

@@ -24,14 +24,14 @@ std::istream& operator>>(std::istream& in, std::pair< T, T >& p)
}
}
typedef adjacency_list< listS, // Store out-edges of each vertex in a std::list
vecS, // Store vertex set in a std::vector
directedS // The file dependency graph is directed
>
file_dep_graph;
using file_dep_graph
= adjacency_list< listS, // Store out-edges of each vertex in a std::list
vecS, // Store vertex set in a std::vector
directedS // The file dependency graph is directed
>;
typedef graph_traits< file_dep_graph >::vertex_descriptor vertex_t;
typedef graph_traits< file_dep_graph >::edge_descriptor edge_t;
using vertex_t = graph_traits< file_dep_graph >::vertex_descriptor;
using edge_t = graph_traits< file_dep_graph >::edge_descriptor;
bool has_cycle_dfs(
const file_dep_graph& g, vertex_t u, default_color_type* color)
@@ -64,7 +64,7 @@ bool has_cycle(const file_dep_graph& g)
int main(int argc, const char** argv)
{
std::ifstream file_in(argc >= 2 ? argv[1] : "makefile-dependencies.dat");
typedef graph_traits< file_dep_graph >::vertices_size_type size_type;
using size_type = graph_traits< file_dep_graph >::vertices_size_type;
size_type n_vertices;
file_in >> n_vertices; // read in number of vertices
std::istream_iterator< std::pair< size_type, size_type > > input_begin(

View File

@@ -26,14 +26,14 @@ std::istream& operator>>(std::istream& in, std::pair< T, T >& p)
}
}
typedef adjacency_list< listS, // Store out-edges of each vertex in a std::list
vecS, // Store vertex set in a std::vector
directedS // The file dependency graph is directed
>
file_dep_graph;
using file_dep_graph
= adjacency_list< listS, // Store out-edges of each vertex in a std::list
vecS, // Store vertex set in a std::vector
directedS // The file dependency graph is directed
>;
typedef graph_traits< file_dep_graph >::vertex_descriptor vertex_t;
typedef graph_traits< file_dep_graph >::edge_descriptor edge_t;
using vertex_t = graph_traits< file_dep_graph >::vertex_descriptor;
using edge_t = graph_traits< file_dep_graph >::edge_descriptor;
template < typename Visitor >
void dfs_v1(
@@ -103,7 +103,7 @@ bool has_cycle(const file_dep_graph& g)
int main(int argc, const char** argv)
{
std::ifstream file_in(argc >= 2 ? argv[1] : "makefile-dependencies.dat");
typedef graph_traits< file_dep_graph >::vertices_size_type size_type;
using size_type = graph_traits< file_dep_graph >::vertices_size_type;
size_type n_vertices;
file_in >> n_vertices; // read in number of vertices
std::istream_iterator< std::pair< size_type, size_type > > input_begin(

View File

@@ -18,10 +18,9 @@
*/
using namespace boost;
typedef adjacency_list< listS, listS, directedS,
property< vertex_index_t, int >,
property< edge_weight_t, double, property< edge_weight2_t, double > > >
grap_real_t;
using grap_real_t
= adjacency_list< listS, listS, directedS, property< vertex_index_t, int >,
property< edge_weight_t, double, property< edge_weight2_t, double > > >;
template < typename TG > void gen_rand_graph(TG& g, size_t nV, size_t nE)
{
@@ -45,8 +44,8 @@ int main(int argc, char* argv[])
using std::endl;
const double epsilon = 0.0000001;
double min_cr, max_cr; /// Minimum and maximum cycle ratio
typedef std::vector< graph_traits< grap_real_t >::edge_descriptor >
ccReal_t;
using ccReal_t
= std::vector< graph_traits< grap_real_t >::edge_descriptor >;
ccReal_t cc; /// critical cycle
grap_real_t tgr;

View File

@@ -25,9 +25,8 @@
int main()
{
using namespace boost;
typedef adjacency_list< vecS, vecS, directedS,
property< vertex_distance_t, int >, property< edge_weight_t, int > >
graph_t;
using graph_t = adjacency_list< vecS, vecS, directedS,
property< vertex_distance_t, int >, property< edge_weight_t, int > >;
graph_t g(6);
enum verts
{

View File

@@ -71,18 +71,17 @@ b(14); d a
*/
typedef property< vertex_color_t, default_color_type,
property< vertex_distance_t, int > >
VProperty;
typedef int weight_t;
typedef property< edge_weight_t, weight_t > EProperty;
using VProperty = property< vertex_color_t, default_color_type,
property< vertex_distance_t, int > >;
using weight_t = int;
using EProperty = property< edge_weight_t, weight_t >;
typedef adjacency_list< vecS, vecS, directedS, VProperty, EProperty > Graph;
using Graph = adjacency_list< vecS, vecS, directedS, VProperty, EProperty >;
template < class Tag >
struct endl_printer : public boost::base_visitor< endl_printer< Tag > >
{
typedef Tag event_filter;
using event_filter = Tag;
endl_printer(std::ostream& os) : m_os(os) {}
template < class T, class Graph > void operator()(T, Graph&)
{
@@ -98,7 +97,7 @@ template < class Tag > endl_printer< Tag > print_endl(std::ostream& os, Tag)
template < class PA, class Tag >
struct edge_printer : public boost::base_visitor< edge_printer< PA, Tag > >
{
typedef Tag event_filter;
using event_filter = Tag;
edge_printer(PA pa, std::ostream& os) : m_pa(pa), m_os(os) {}
@@ -120,7 +119,7 @@ template < class NewGraph, class Tag >
struct graph_copier
: public boost::base_visitor< graph_copier< NewGraph, Tag > >
{
typedef Tag event_filter;
using event_filter = Tag;
graph_copier(NewGraph& graph) : new_g(graph) {}
@@ -172,10 +171,10 @@ int main(int, char*[])
auto vertex_id = get(vertex_index, G);
std::vector< weight_t > distance(N, (numeric_limits< weight_t >::max)());
typedef boost::graph_traits< Graph >::vertex_descriptor Vertex;
using Vertex = boost::graph_traits< Graph >::vertex_descriptor;
std::vector< Vertex > parent(N);
typedef std::pair< int, int > E;
using E = std::pair< int, int >;
E edges[] = { E(a, c), E(a, d), E(b, a), E(b, d), E(c, f), E(d, c), E(d, e),
E(d, f), E(e, b), E(e, g), E(f, e), E(f, g) };

View File

@@ -13,7 +13,7 @@ using namespace boost;
template < typename Graph > void read_graph_file(std::istream& in, Graph& g)
{
typedef typename graph_traits< Graph >::vertices_size_type size_type;
using size_type = typename graph_traits< Graph >::vertices_size_type;
size_type n_vertices;
in >> n_vertices; // read in number of vertices
for (size_type i = 0; i < n_vertices; ++i) // Add n vertices to the graph
@@ -28,12 +28,11 @@ template < typename Graph > void read_graph_file(std::istream& in, Graph& g)
int main(int argc, const char** argv)
{
typedef adjacency_list< listS, // Store out-edges of each vertex in a
// std::list
using graph_type = adjacency_list< listS, // Store out-edges of each vertex
// in a std::list
vecS, // Store vertex set in a std::vector
directedS // The graph is directed
>
graph_type;
>;
graph_type g; // use default constructor to create empty graph
std::ifstream file_in(argc >= 2 ? argv[1] : "makefile-dependencies.dat");

View File

@@ -13,8 +13,8 @@ using namespace boost;
template < typename Graph > void read_graph_file(std::istream& in, Graph& g)
{
typedef typename graph_traits< Graph >::vertex_descriptor Vertex;
typedef typename graph_traits< Graph >::vertices_size_type size_type;
using Vertex = typename graph_traits< Graph >::vertex_descriptor;
using size_type = typename graph_traits< Graph >::vertices_size_type;
size_type n_vertices;
in >> n_vertices; // read in number of vertices
std::vector< Vertex > vertex_set(n_vertices);
@@ -31,12 +31,11 @@ template < typename Graph > void read_graph_file(std::istream& in, Graph& g)
int main(int argc, const char** argv)
{
typedef adjacency_list< listS, // Store out-edges of each vertex in a
// std::list
using graph_type = adjacency_list< listS, // Store out-edges of each vertex
// in a std::list
vecS, // Store vertex set in a std::vector
directedS // The graph is directed
>
graph_type;
>;
graph_type g; // use default constructor to create empty graph
std::ifstream file_in(argc >= 2 ? argv[1] : "makefile-dependencies.dat");

View File

@@ -24,19 +24,19 @@ struct Actor
};
// Declare the graph type and its vertex and edge types.
typedef undirected_graph< Actor > Graph;
typedef graph_traits< Graph >::vertex_descriptor Vertex;
typedef graph_traits< Graph >::edge_descriptor Edge;
using Graph = undirected_graph< Actor >;
using Vertex = graph_traits< Graph >::vertex_descriptor;
using Edge = graph_traits< Graph >::edge_descriptor;
// The name map provides an abstract accessor for the names of
// each vertex. This is used during graph creation.
typedef property_map< Graph, string Actor::* >::type NameMap;
using NameMap = property_map< Graph, string Actor::* >::type;
// Declare a container type for degree centralities and its
// corresponding property map.
typedef exterior_vertex_property< Graph, unsigned > CentralityProperty;
typedef CentralityProperty::container_type CentralityContainer;
typedef CentralityProperty::map_type CentralityMap;
using CentralityProperty = exterior_vertex_property< Graph, unsigned >;
using CentralityContainer = CentralityProperty::container_type;
using CentralityMap = CentralityProperty::map_type;
int main(int argc, char* argv[])
{

View File

@@ -16,7 +16,7 @@ using namespace boost;
template < typename TimeMap >
class dfs_time_visitor : public default_dfs_visitor
{
typedef typename property_traits< TimeMap >::value_type T;
using T = typename property_traits< TimeMap >::value_type;
public:
dfs_time_visitor(TimeMap dmap, TimeMap fmap, T& t)
@@ -41,8 +41,8 @@ public:
int main()
{
// Select the graph type we wish to use
typedef adjacency_list< vecS, vecS, directedS > graph_t;
typedef graph_traits< graph_t >::vertices_size_type size_type;
using graph_t = adjacency_list< vecS, vecS, directedS >;
using size_type = graph_traits< graph_t >::vertices_size_type;
// Set up the vertex names
enum
{
@@ -56,7 +56,7 @@ int main()
};
char name[] = { 'u', 'v', 'w', 'x', 'y', 'z' };
// Specify the edges in the graph
typedef std::pair< int, int > E;
using E = std::pair< int, int >;
E edge_array[] = { E(u, v), E(u, x), E(x, v), E(y, x), E(v, y), E(w, y),
E(w, z), E(z, z) };
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
@@ -70,9 +70,9 @@ int main()
// discover time and finish time properties
std::vector< size_type > dtime(num_vertices(g));
std::vector< size_type > ftime(num_vertices(g));
typedef iterator_property_map< std::vector< size_type >::iterator,
property_map< graph_t, vertex_index_t >::const_type >
time_pm_type;
using time_pm_type
= iterator_property_map< std::vector< size_type >::iterator,
property_map< graph_t, vertex_index_t >::const_type >;
time_pm_type dtime_pm(dtime.begin(), get(vertex_index, g));
time_pm_type ftime_pm(ftime.begin(), get(vertex_index, g));
size_type t = 0;

View File

@@ -52,7 +52,7 @@ using namespace std;
template < class VisitorList >
struct edge_categorizer : public dfs_visitor< VisitorList >
{
typedef dfs_visitor< VisitorList > Base;
using Base = dfs_visitor< VisitorList >;
edge_categorizer(const VisitorList& v = null_visitor()) : Base(v) {}
@@ -93,7 +93,7 @@ int main(int, char*[])
using namespace boost;
typedef adjacency_list<> Graph;
using Graph = adjacency_list<>;
Graph G(5);
add_edge(0, 2, G);
@@ -106,7 +106,7 @@ int main(int, char*[])
add_edge(4, 0, G);
add_edge(4, 1, G);
typedef graph_traits< Graph >::vertices_size_type size_type;
using size_type = graph_traits< Graph >::vertices_size_type;
std::vector< size_type > d(num_vertices(G));
std::vector< size_type > f(num_vertices(G));

View File

@@ -29,7 +29,7 @@ using namespace std;
struct open_paren : public base_visitor< open_paren >
{
typedef on_discover_vertex event_filter;
using event_filter = on_discover_vertex;
template < class Vertex, class Graph > void operator()(Vertex v, Graph&)
{
std::cout << "(" << v;
@@ -37,7 +37,7 @@ struct open_paren : public base_visitor< open_paren >
};
struct close_paren : public base_visitor< close_paren >
{
typedef on_finish_vertex event_filter;
using event_filter = on_finish_vertex;
template < class Vertex, class Graph > void operator()(Vertex v, Graph&)
{
std::cout << v << ")";
@@ -49,8 +49,8 @@ int main(int, char*[])
using namespace boost;
typedef adjacency_list<> Graph;
typedef std::pair< int, int > E;
using Graph = adjacency_list<>;
using E = std::pair< int, int >;
E edge_array[] = { E(0, 2), E(1, 1), E(1, 3), E(2, 1), E(2, 3), E(3, 1),
E(3, 4), E(4, 0), E(4, 1) };
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300

View File

@@ -17,16 +17,15 @@ using namespace boost;
int main(int, char*[])
{
typedef adjacency_list_traits< listS, listS, directedS >::vertex_descriptor
vertex_descriptor;
typedef adjacency_list< listS, listS, directedS,
using vertex_descriptor
= adjacency_list_traits< listS, listS, directedS >::vertex_descriptor;
using graph_t = adjacency_list< listS, listS, directedS,
property< vertex_index_t, int,
property< vertex_name_t, char,
property< vertex_distance_t, int,
property< vertex_predecessor_t, vertex_descriptor > > > >,
property< edge_weight_t, int > >
graph_t;
typedef std::pair< int, int > Edge;
property< edge_weight_t, int > >;
using Edge = std::pair< int, int >;
const int num_nodes = 5;
enum nodes

View File

@@ -18,11 +18,10 @@ using namespace boost;
int main(int, char*[])
{
typedef adjacency_list< listS, vecS, directedS, no_property,
property< edge_weight_t, int > >
graph_t;
typedef graph_traits< graph_t >::vertex_descriptor vertex_descriptor;
typedef std::pair< int, int > Edge;
using graph_t = adjacency_list< listS, vecS, directedS, no_property,
property< edge_weight_t, int > >;
using vertex_descriptor = graph_traits< graph_t >::vertex_descriptor;
using Edge = std::pair< int, int >;
const int num_nodes = 5;
enum nodes

View File

@@ -22,11 +22,10 @@ using namespace boost;
int main(int, char*[])
{
typedef adjacency_list< listS, vecS, directedS, no_property,
property< edge_weight_t, int > >
graph_t;
typedef graph_traits< graph_t >::vertex_descriptor vertex_descriptor;
typedef std::pair< int, int > Edge;
using graph_t = adjacency_list< listS, vecS, directedS, no_property,
property< edge_weight_t, int > >;
using vertex_descriptor = graph_traits< graph_t >::vertex_descriptor;
using Edge = std::pair< int, int >;
const int num_nodes = 5;
enum nodes

View File

@@ -16,7 +16,7 @@ int main(int, char*[])
// the code easier to understand. However, it hard codes many of the
// template parameters, so it is much less flexible.
typedef boost::directed_graph<> Graph;
using Graph = boost::directed_graph<>;
Graph g;
auto v0 = g.add_vertex();
auto v1 = g.add_vertex();

View File

@@ -24,29 +24,29 @@ struct Actor
};
// Declare the graph type and its vertex and edge types.
typedef undirected_graph< Actor > Graph;
typedef graph_traits< Graph >::vertex_descriptor Vertex;
typedef graph_traits< Graph >::edge_descriptor Edge;
using Graph = undirected_graph< Actor >;
using Vertex = graph_traits< Graph >::vertex_descriptor;
using Edge = graph_traits< Graph >::edge_descriptor;
// The name map provides an abstract accessor for the names of
// each vertex. This is used during graph creation.
typedef property_map< Graph, string Actor::* >::type NameMap;
using NameMap = property_map< Graph, string Actor::* >::type;
// Declare a matrix type and its corresponding property map that
// will contain the distances between each pair of vertices.
typedef exterior_vertex_property< Graph, int > DistanceProperty;
typedef DistanceProperty::matrix_type DistanceMatrix;
typedef DistanceProperty::matrix_map_type DistanceMatrixMap;
using DistanceProperty = exterior_vertex_property< Graph, int >;
using DistanceMatrix = DistanceProperty::matrix_type;
using DistanceMatrixMap = DistanceProperty::matrix_map_type;
// Declare the weight map so that each edge returns the same value.
typedef constant_property_map< Edge, int > WeightMap;
using WeightMap = constant_property_map< Edge, int >;
// Declare a container and its corresponding property map that
// will contain the resulting eccentricities of each vertex in
// the graph.
typedef boost::exterior_vertex_property< Graph, int > EccentricityProperty;
typedef EccentricityProperty::container_type EccentricityContainer;
typedef EccentricityProperty::map_type EccentricityMap;
using EccentricityProperty = boost::exterior_vertex_property< Graph, int >;
using EccentricityContainer = EccentricityProperty::container_type;
using EccentricityMap = EccentricityProperty::map_type;
int main(int argc, char* argv[])
{

View File

@@ -29,7 +29,7 @@ std::pair< typename graph_traits< Graph >::vertex_descriptor,
min_degree_vertex(Graph& g)
{
typename graph_traits< Graph >::vertex_descriptor p;
typedef typename graph_traits< Graph >::degree_size_type size_type;
using size_type = typename graph_traits< Graph >::degree_size_type;
auto delta = (std::numeric_limits< size_type >::max)();
typename graph_traits< Graph >::vertex_iterator i, iend;
for (boost::tie(i, iend) = vertices(g); i != iend; ++i)
@@ -61,19 +61,17 @@ template < typename VertexListGraph, typename OutputIterator >
typename graph_traits< VertexListGraph >::degree_size_type edge_connectivity(
VertexListGraph& g, OutputIterator disconnecting_set)
{
typedef typename graph_traits< VertexListGraph >::vertex_descriptor
vertex_descriptor;
typedef typename graph_traits< VertexListGraph >::degree_size_type
degree_size_type;
typedef color_traits< default_color_type > Color;
typedef
typename adjacency_list_traits< vecS, vecS, directedS >::edge_descriptor
edge_descriptor;
typedef adjacency_list< vecS, vecS, directedS, no_property,
using vertex_descriptor =
typename graph_traits< VertexListGraph >::vertex_descriptor;
using degree_size_type =
typename graph_traits< VertexListGraph >::degree_size_type;
using Color = color_traits< default_color_type >;
using edge_descriptor = typename adjacency_list_traits< vecS, vecS,
directedS >::edge_descriptor;
using FlowGraph = adjacency_list< vecS, vecS, directedS, no_property,
property< edge_capacity_t, degree_size_type,
property< edge_residual_capacity_t, degree_size_type,
property< edge_reverse_t, edge_descriptor > > > >
FlowGraph;
property< edge_reverse_t, edge_descriptor > > > >;
vertex_descriptor u, v, p, k;
edge_descriptor e1, e2;
@@ -161,7 +159,7 @@ int main()
GraphvizGraph g;
read_graphviz("figs/edge-connectivity.dot", g);
typedef graph_traits< GraphvizGraph >::edge_descriptor edge_descriptor;
using edge_descriptor = graph_traits< GraphvizGraph >::edge_descriptor;
std::vector< edge_descriptor > disconnecting_set;
auto c = edge_connectivity(g, std::back_inserter(disconnecting_set));

View File

@@ -17,7 +17,7 @@ template < typename Graph, typename VertexNamePropertyMap >
void read_graph_file(std::istream& graph_in, std::istream& name_in, Graph& g,
VertexNamePropertyMap name_map)
{
typedef typename graph_traits< Graph >::vertices_size_type size_type;
using size_type = typename graph_traits< Graph >::vertices_size_type;
size_type n_vertices;
typename graph_traits< Graph >::vertex_descriptor u;
typename property_traits< VertexNamePropertyMap >::value_type name;
@@ -76,13 +76,12 @@ inline name_equals_t< NameMap > name_equals(
int main(int argc, const char** argv)
{
typedef adjacency_list< listS, // Store out-edges of each vertex in a
// std::list
using graph_type = adjacency_list< listS, // Store out-edges of each vertex
// in a std::list
vecS, // Store vertex set in a std::vector
directedS, // The graph is directed
property< vertex_name_t, std::string > // Add a vertex property
>
graph_type;
>;
graph_type g; // use default constructor to create empty graph
const char* dep_file_name

View File

@@ -21,15 +21,14 @@ std::istream& operator>>(std::istream& in, std::pair< T, T >& p)
int main(int argc, const char** argv)
{
typedef adjacency_list< listS, // Store out-edges of each vertex in a
// std::list
using graph_type = adjacency_list< listS, // Store out-edges of each vertex
// in a std::list
vecS, // Store vertex set in a std::vector
directedS // The graph is directed
>
graph_type;
>;
std::ifstream file_in(argc >= 2 ? argv[1] : "makefile-dependencies.dat");
typedef graph_traits< graph_type >::vertices_size_type size_type;
using size_type = graph_traits< graph_type >::vertices_size_type;
size_type n_vertices;
file_in >> n_vertices; // read in number of vertices

View File

@@ -40,8 +40,8 @@ template < class Graph > struct exercise_edge
{
exercise_edge(Graph& g) : G(g) {}
typedef typename boost::graph_traits< Graph >::edge_descriptor Edge;
typedef typename boost::graph_traits< Graph >::vertex_descriptor Vertex;
using Edge = typename boost::graph_traits< Graph >::edge_descriptor;
using Vertex = typename boost::graph_traits< Graph >::vertex_descriptor;
void operator()(Edge e) const
{
// begin
@@ -62,9 +62,9 @@ template < class Graph > struct exercise_edge
int main()
{
typedef adjacency_list<> MyGraph;
using MyGraph = adjacency_list<>;
typedef pair< int, int > Pair;
using Pair = pair< int, int >;
Pair edge_array[8] = { Pair(0, 1), Pair(0, 2), Pair(0, 3), Pair(0, 4),
Pair(2, 0), Pair(3, 0), Pair(2, 4), Pair(3, 1) };

View File

@@ -36,11 +36,10 @@ int main(int, char*[])
{
using namespace boost;
using namespace std;
typedef adjacency_list< vecS, vecS, undirectedS, no_property, size_t,
no_property >
Graph;
using Graph = adjacency_list< vecS, vecS, undirectedS, no_property, size_t,
no_property >;
typedef std::pair< std::size_t, std::size_t > Pair;
using Pair = std::pair< std::size_t, std::size_t >;
Pair edges[14] = { Pair(0, 3), // a-d
Pair(0, 5), // a-f
Pair(1, 2), // b-c

View File

@@ -27,7 +27,7 @@ using namespace boost;
int main()
{
const int N = 8;
typedef adjacency_list< vecS, vecS, undirectedS > UndirectedGraph;
using UndirectedGraph = adjacency_list< vecS, vecS, undirectedS >;
UndirectedGraph g(N);
add_edge(0, 1, g);
@@ -45,8 +45,8 @@ int main()
add_edge(5, 7, g);
add_edge(6, 7, g);
typedef graph_traits< UndirectedGraph >::edge_descriptor edge_descriptor;
typedef graph_traits< UndirectedGraph >::degree_size_type degree_size_type;
using edge_descriptor = graph_traits< UndirectedGraph >::edge_descriptor;
using degree_size_type = graph_traits< UndirectedGraph >::degree_size_type;
std::vector< edge_descriptor > disconnecting_set;
auto c = edge_connectivity(g, std::back_inserter(disconnecting_set));

View File

@@ -44,11 +44,11 @@
class edge_stream_iterator
{
public:
typedef std::input_iterator_tag iterator_category;
typedef std::pair< int, int > value_type;
typedef std::ptrdiff_t difference_type;
typedef const value_type* pointer;
typedef const value_type& reference;
using iterator_category = std::input_iterator_tag;
using value_type = std::pair< int, int >;
using difference_type = std::ptrdiff_t;
using pointer = const value_type*;
using reference = const value_type&;
edge_stream_iterator() : m_stream(0), m_end_marker(false) {}
edge_stream_iterator(std::istream& s) : m_stream(&s) { m_read(); }
@@ -93,8 +93,8 @@ bool operator!=(const edge_stream_iterator& x, const edge_stream_iterator& y)
int main(int argc, const char** argv)
{
typedef boost::adjacency_list<> IteratorConstructibleGraph;
typedef boost::graph_traits< IteratorConstructibleGraph > Traits;
using IteratorConstructibleGraph = boost::adjacency_list<>;
using Traits = boost::graph_traits< IteratorConstructibleGraph >;
Traits::vertices_size_type size_V;
Traits::edges_size_type size_E;

View File

@@ -75,10 +75,10 @@ BOOST_INSTALL_PROPERTY(edge, mycapacity);
template < class Graph > void print_network(const Graph& G)
{
typedef typename boost::graph_traits< Graph >::vertex_iterator Viter;
typedef
typename boost::graph_traits< Graph >::out_edge_iterator OutEdgeIter;
typedef typename boost::graph_traits< Graph >::in_edge_iterator InEdgeIter;
using Viter = typename boost::graph_traits< Graph >::vertex_iterator;
using OutEdgeIter =
typename boost::graph_traits< Graph >::out_edge_iterator;
using InEdgeIter = typename boost::graph_traits< Graph >::in_edge_iterator;
auto capacity = get(edge_mycapacity, G);
auto flow = get(edge_myflow, G);
@@ -109,10 +109,10 @@ template < class Graph > void print_network(const Graph& G)
int main(int, char*[])
{
typedef property< edge_mycapacity_t, int > Cap;
typedef property< edge_myflow_t, int, Cap > Flow;
typedef adjacency_list< vecS, vecS, bidirectionalS, no_property, Flow >
Graph;
using Cap = property< edge_mycapacity_t, int >;
using Flow = property< edge_myflow_t, int, Cap >;
using Graph
= adjacency_list< vecS, vecS, bidirectionalS, no_property, Flow >;
const int num_vertices = 9;
Graph G(num_vertices);

View File

@@ -51,13 +51,12 @@ int main()
{
using namespace boost;
typedef adjacency_list_traits< vecS, vecS, directedS > Traits;
typedef adjacency_list< listS, vecS, directedS,
using Traits = adjacency_list_traits< vecS, vecS, directedS >;
using Graph = adjacency_list< listS, vecS, directedS,
property< vertex_name_t, std::string >,
property< edge_capacity_t, long,
property< edge_residual_capacity_t, long,
property< edge_reverse_t, Traits::edge_descriptor > > > >
Graph;
property< edge_reverse_t, Traits::edge_descriptor > > > >;
Graph g;

View File

@@ -40,10 +40,10 @@
template < class Graph, class Capacity, class Flow >
void print_network(Graph& G, Capacity capacity, Flow flow)
{
typedef typename boost::graph_traits< Graph >::vertex_iterator Viter;
typedef
typename boost::graph_traits< Graph >::out_edge_iterator OutEdgeIter;
typedef typename boost::graph_traits< Graph >::in_edge_iterator InEdgeIter;
using Viter = typename boost::graph_traits< Graph >::vertex_iterator;
using OutEdgeIter =
typename boost::graph_traits< Graph >::out_edge_iterator;
using InEdgeIter = typename boost::graph_traits< Graph >::in_edge_iterator;
Viter ui, uiend;
for (boost::tie(ui, uiend) = boost::vertices(G); ui != uiend; ++ui)
@@ -71,10 +71,9 @@ void print_network(Graph& G, Capacity capacity, Flow flow)
int main(int, char*[])
{
typedef boost::adjacency_list< boost::vecS, boost::vecS,
using Graph = boost::adjacency_list< boost::vecS, boost::vecS,
boost::bidirectionalS, boost::no_property,
boost::property< boost::edge_index_t, std::size_t > >
Graph;
boost::property< boost::edge_index_t, std::size_t > >;
const int num_vertices = 9;
Graph G(num_vertices);
@@ -110,12 +109,12 @@ int main(int, char*[])
boost::add_edge(6, 8, 9, G);
typedef boost::property_map< Graph, boost::edge_index_t >::type
EdgeIndexMap;
using EdgeIndexMap
= boost::property_map< Graph, boost::edge_index_t >::type;
EdgeIndexMap edge_id = boost::get(boost::edge_index, G);
typedef boost::iterator_property_map< int*, EdgeIndexMap, int, int& >
IterMap;
using IterMap
= boost::iterator_property_map< int*, EdgeIndexMap, int, int& >;
print_network(G, IterMap(capacity, edge_id), IterMap(flow, edge_id));

View File

@@ -76,9 +76,9 @@ int main(int, char*[])
names[3] = "Jeff";
names[4] = "Kinis";
typedef adjacency_list<> MyGraphType;
using MyGraphType = adjacency_list<>;
typedef pair< int, int > Pair;
using Pair = pair< int, int >;
Pair edge_array[11] = { Pair(0, 1), Pair(0, 2), Pair(0, 3), Pair(0, 4),
Pair(2, 0), Pair(3, 0), Pair(2, 4), Pair(3, 1), Pair(3, 4), Pair(4, 0),
Pair(4, 1) };

View File

@@ -26,7 +26,7 @@ using namespace boost;
int main()
{
typedef indirect_cmp< float*, std::less< float > > ICmp;
using ICmp = indirect_cmp< float*, std::less< float > >;
int i;
random_ns::mt19937 gen;
for (int N = 2; N < 200; ++N)

View File

@@ -92,7 +92,7 @@ protected:
int main(int, char*[])
{
typedef pair< int, int > Edge;
using Edge = pair< int, int >;
Edge used_by[] = { Edge(dax_h, foo_cpp), Edge(dax_h, bar_cpp),
Edge(dax_h, yow_h), Edge(yow_h, bar_cpp), Edge(yow_h, zag_cpp),
Edge(boz_h, bar_cpp), Edge(boz_h, zig_cpp), Edge(boz_h, zag_cpp),
@@ -103,7 +103,7 @@ int main(int, char*[])
Edge(zag_o, libzigzag_a), Edge(libzigzag_a, killerapp) };
const std::size_t nedges = sizeof(used_by) / sizeof(Edge);
typedef adjacency_list< vecS, vecS, bidirectionalS > Graph;
using Graph = adjacency_list< vecS, vecS, bidirectionalS >;
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
// VC++ can't handle the iterator constructor
Graph g(N);
@@ -117,12 +117,12 @@ int main(int, char*[])
#else
Graph g(used_by, used_by + nedges, N);
#endif
typedef graph_traits< Graph >::vertex_descriptor Vertex;
using Vertex = graph_traits< Graph >::vertex_descriptor;
// Determine ordering for a full recompilation
// and the order with files that can be compiled in parallel
{
typedef list< Vertex > MakeOrder;
using MakeOrder = list< Vertex >;
MakeOrder::iterator i;
MakeOrder make_order;

View File

@@ -29,9 +29,8 @@ template < typename Graph > struct non_zero_degree
int main()
{
using namespace boost;
typedef adjacency_list< vecS, vecS, bidirectionalS,
property< vertex_name_t, char > >
graph_t;
using graph_t = adjacency_list< vecS, vecS, bidirectionalS,
property< vertex_name_t, char > >;
enum
{
@@ -51,7 +50,7 @@ int main()
for (boost::tie(v, v_end) = vertices(G); v != v_end; ++v, ++name)
name_map[*v] = name;
typedef std::pair< int, int > E;
using E = std::pair< int, int >;
E edges[] = { E(a, c), E(a, d), E(b, a), E(b, d), E(c, f), E(d, c), E(d, e),
E(d, f), E(e, b), E(e, g), E(f, e), E(f, g) };
for (int i = 0; i < 12; ++i)

View File

@@ -40,10 +40,9 @@ int main()
{
using namespace boost;
typedef adjacency_list< vecS, vecS, directedS, no_property,
property< edge_weight_t, int > >
Graph;
typedef property_map< Graph, edge_weight_t >::type EdgeWeightMap;
using Graph = adjacency_list< vecS, vecS, directedS, no_property,
property< edge_weight_t, int > >;
using EdgeWeightMap = property_map< Graph, edge_weight_t >::type;
enum
{

View File

@@ -40,10 +40,9 @@ int main()
{
using namespace boost;
typedef adjacency_list< multisetS, vecS, directedS, no_property,
property< edge_weight_t, int > >
Graph;
typedef property_map< Graph, edge_weight_t >::type EdgeWeightMap;
using Graph = adjacency_list< multisetS, vecS, directedS, no_property,
property< edge_weight_t, int > >;
using EdgeWeightMap = property_map< Graph, edge_weight_t >::type;
enum
{
@@ -74,8 +73,8 @@ int main()
<< name[target(*f, g)] << "\n";
positive_edge_weight< EdgeWeightMap > filter(weight);
typedef filtered_graph< Graph, positive_edge_weight< EdgeWeightMap > >
FGraph;
using FGraph
= filtered_graph< Graph, positive_edge_weight< EdgeWeightMap > >;
FGraph fg(g, filter);
std::cout << "filtered edge_range(C,D)\n";

View File

@@ -48,7 +48,7 @@ int main()
E
};
const char* name = "ABCDE";
typedef std::vector< std::list< int > > Graph;
using Graph = std::vector< std::list< int > >;
Graph g = { { B, C }, // A
{}, // B
{ D, E }, // C

View File

@@ -41,16 +41,15 @@ void usage()
"vertex on each line, separated by spaces.\n";
}
typedef boost::rectangle_topology<> topology_type;
typedef topology_type::point_type point_type;
using topology_type = boost::rectangle_topology<>;
using point_type = topology_type::point_type;
typedef adjacency_list< listS, vecS, undirectedS,
property< vertex_name_t, std::string > >
Graph;
using Graph = adjacency_list< listS, vecS, undirectedS,
property< vertex_name_t, std::string > >;
typedef graph_traits< Graph >::vertex_descriptor Vertex;
using Vertex = graph_traits< Graph >::vertex_descriptor;
typedef std::map< std::string, Vertex > NameToVertex;
using NameToVertex = std::map< std::string, Vertex >;
Vertex get_vertex(const std::string& name, Graph& g, NameToVertex& names)
{
@@ -62,7 +61,7 @@ Vertex get_vertex(const std::string& name, Graph& g, NameToVertex& names)
class progress_cooling : public linear_cooling< double >
{
typedef linear_cooling< double > inherited;
using inherited = linear_cooling< double >;
public:
explicit progress_cooling(std::size_t iterations) : inherited(iterations)
@@ -135,11 +134,10 @@ int main(int argc, char* argv[])
add_edge(get_vertex(source, g, names), get_vertex(target, g, names), g);
}
typedef std::vector< point_type > PositionVec;
using PositionVec = std::vector< point_type >;
PositionVec position_vec(num_vertices(g));
typedef iterator_property_map< PositionVec::iterator,
property_map< Graph, vertex_index_t >::type >
PositionMap;
using PositionMap = iterator_property_map< PositionVec::iterator,
property_map< Graph, vertex_index_t >::type >;
PositionMap position(position_vec.begin(), get(vertex_index, g));
minstd_rand gen;

View File

@@ -42,7 +42,7 @@ void merge_vertex(typename boost::graph_traits< Graph >::vertex_descriptor u,
typename boost::graph_traits< Graph >::vertex_descriptor v, Graph& g,
GetEdgeProperties getp)
{
typedef boost::graph_traits< Graph > Traits;
using Traits = boost::graph_traits< Graph >;
typename Traits::edge_descriptor e;
typename Traits::out_edge_iterator out_i, out_end;
for (boost::tie(out_i, out_end) = out_edges(v, g); out_i != out_end;
@@ -65,9 +65,9 @@ void merge_vertex(typename boost::graph_traits< Graph >::vertex_descriptor u,
template < class StoredEdge > struct order_by_name
{
typedef StoredEdge first_argument_type;
typedef StoredEdge second_argument_type;
typedef bool result_type;
using first_argument_type = StoredEdge;
using second_argument_type = StoredEdge;
using result_type = bool;
bool operator()(const StoredEdge& e1, const StoredEdge& e2) const
{
// Using std::pair operator< as an easy way to get lexicographical
@@ -86,11 +86,11 @@ namespace boost
template < class ValueType >
struct container_gen< ordered_set_by_nameS, ValueType >
{
typedef std::set< ValueType, order_by_name< ValueType > > type;
using type = std::set< ValueType, order_by_name< ValueType > >;
};
template <> struct parallel_edge_traits< ordered_set_by_nameS >
{
typedef allow_parallel_edge_tag type;
using type = allow_parallel_edge_tag;
};
}
#endif
@@ -114,10 +114,9 @@ int main()
std::cout << "This program requires partial specialization." << std::endl;
#else
using namespace boost;
typedef property< edge_name_t, char > EdgeProperty;
typedef adjacency_list< ordered_set_by_nameS, vecS, bidirectionalS,
no_property, EdgeProperty >
graph_type;
using EdgeProperty = property< edge_name_t, char >;
using graph_type = adjacency_list< ordered_set_by_nameS, vecS,
bidirectionalS, no_property, EdgeProperty >;
graph_type g;

View File

@@ -49,20 +49,20 @@
#include <boost/graph/breadth_first_search.hpp>
#include <boost/graph/graph_utility.hpp>
typedef boost::graph_traits< Graph* > Traits;
typedef Traits::vertex_descriptor vertex_descriptor;
typedef Traits::edge_descriptor edge_descriptor;
typedef Traits::vertex_iterator vertex_iterator;
using Traits = boost::graph_traits< Graph* >;
using vertex_descriptor = Traits::vertex_descriptor;
using edge_descriptor = Traits::edge_descriptor;
using vertex_iterator = Traits::vertex_iterator;
std::vector< std::size_t > distance_list;
typedef boost::v_property< long > dist_t;
using dist_t = boost::v_property< long >;
boost::property_map< Graph*, dist_t >::type d_map;
typedef boost::u_property< vertex_descriptor > pred_t;
using pred_t = boost::u_property< vertex_descriptor >;
boost::property_map< Graph*, pred_t >::type p_map;
typedef boost::w_property< long > color_t;
using color_t = boost::w_property< long >;
boost::property_map< Graph*, color_t >::type c_map;
class diameter_and_girth_visitor : public boost::bfs_visitor<>

View File

@@ -13,11 +13,11 @@ using namespace boost;
template < typename Graph > void generic_foo(Graph& g)
{
// Access descriptor types
typedef typename graph_traits< Graph >::vertex_descriptor Vertex;
typedef typename graph_traits< Graph >::edge_descriptor Edge;
using Vertex = typename graph_traits< Graph >::vertex_descriptor;
using Edge = typename graph_traits< Graph >::edge_descriptor;
// Access category types
typedef typename graph_traits< Graph >::directed_category Dir;
typedef typename graph_traits< Graph >::edge_parallel_category Par;
using Dir = typename graph_traits< Graph >::directed_category;
using Par = typename graph_traits< Graph >::edge_parallel_category;
// Access iterator types...
// Access size types...
// Now do something useful...
@@ -52,7 +52,7 @@ template < typename Graph > void foo_dispatch(Graph& g, boost::undirected_tag)
template < typename Graph > void foo(Graph& g)
{
typedef typename boost::graph_traits< Graph >::directed_category Cat;
using Cat = typename boost::graph_traits< Graph >::directed_category;
foo_dispatch(g, Cat());
}
@@ -61,7 +61,7 @@ void foo(Digraph& digraph,
typename graph_traits< Digraph >::vertex_descriptor u,
typename graph_traits< Digraph >::vertex_descriptor v)
{
typedef typename graph_traits< Digraph >::edge_descriptor edge_t;
using edge_t = typename graph_traits< Digraph >::edge_descriptor;
std::pair< edge_t, bool > e1, e2;
e1 = edge(u, v, digraph);
e2 = edge(v, u, digraph);
@@ -72,7 +72,7 @@ void bar(Undigraph& undigraph,
typename graph_traits< Undigraph >::vertex_descriptor u,
typename graph_traits< Undigraph >::vertex_descriptor v)
{
typedef typename graph_traits< Undigraph >::edge_descriptor edge_t;
using edge_t = typename graph_traits< Undigraph >::edge_descriptor;
std::pair< edge_t, bool > e1, e2;
e1 = edge(u, v, undigraph);
e2 = edge(v, u, undigraph);

View File

@@ -15,9 +15,8 @@
int main()
{
using namespace boost;
typedef adjacency_list< listS, vecS, directedS,
property< vertex_name_t, std::string > >
graph_t;
using graph_t = adjacency_list< listS, vecS, directedS,
property< vertex_name_t, std::string > >;
graph_t g(3);
const char* vertex_names[] = { "Kubrick", "Clark", "Hal" };

View File

@@ -24,29 +24,27 @@ using namespace std;
// (see the documentation for adjacency list)
struct graph_identifier_t
{
typedef graph_property_tag kind;
using kind = graph_property_tag;
};
struct vertex_label_t
{
typedef vertex_property_tag kind;
using kind = vertex_property_tag;
};
int main()
{
// Vertex properties
typedef property< vertex_name_t, string,
property< vertex_label_t, string, property< vertex_root_t, int > > >
vertex_p;
using vertex_p = property< vertex_name_t, string,
property< vertex_label_t, string, property< vertex_root_t, int > > >;
// Edge properties
typedef property< edge_name_t, string > edge_p;
using edge_p = property< edge_name_t, string >;
// Graph properties
typedef property< graph_name_t, string,
property< graph_identifier_t, string > >
graph_p;
using graph_p = property< graph_name_t, string,
property< graph_identifier_t, string > >;
// adjacency_list-based type
typedef adjacency_list< vecS, vecS, directedS, vertex_p, edge_p, graph_p >
graph_t;
using graph_t
= adjacency_list< vecS, vecS, directedS, vertex_p, edge_p, graph_p >;
// Construct an empty graph and prepare the dynamic_property_maps.
graph_t graph(0);

View File

@@ -17,16 +17,14 @@
using namespace boost;
using namespace std;
typedef property< vertex_color_t, default_color_type,
using VertexProperty = property< vertex_color_t, default_color_type,
property< vertex_distance_t, int,
property< vertex_degree_t, int,
property< vertex_in_degree_t, int,
property< vertex_out_degree_t, int > > > > >
VertexProperty;
typedef property< edge_weight_t, int > EdgeProperty;
typedef adjacency_list< vecS, vecS, bidirectionalS, VertexProperty,
EdgeProperty >
Graph;
property< vertex_out_degree_t, int > > > > >;
using EdgeProperty = property< edge_weight_t, int >;
using Graph = adjacency_list< vecS, vecS, bidirectionalS, VertexProperty,
EdgeProperty >;
template < class Graph > void print(Graph& g)
{

View File

@@ -32,10 +32,9 @@ public:
int main()
{
using namespace boost;
typedef adjacency_list< vecS, vecS, directedS,
property< vertex_name_t, std::string > >
graph_t;
typedef graph_traits< graph_t >::vertex_descriptor vertex_t;
using graph_t = adjacency_list< vecS, vecS, directedS,
property< vertex_name_t, std::string > >;
using vertex_t = graph_traits< graph_t >::vertex_descriptor;
graph_t g;
@@ -49,11 +48,11 @@ int main()
name[b] = "B";
name[c] = "C";
typedef iterator_property_map< std::vector< vertex_t >::iterator,
property_map< graph_t, vertex_index_t >::type >
parent_map_t;
using parent_map_t
= iterator_property_map< std::vector< vertex_t >::iterator,
property_map< graph_t, vertex_index_t >::type >;
std::vector< vertex_t > parent(num_vertices(g));
typedef graph_as_tree< graph_t, parent_map_t > tree_t;
using tree_t = graph_as_tree< graph_t, parent_map_t >;
tree_t t(
g, a, make_iterator_property_map(parent.begin(), get(vertex_index, g)));

View File

@@ -14,16 +14,15 @@ int main()
using namespace boost;
using std::string;
typedef adjacency_list< vecS, vecS, directedS, no_property,
property< edge_index_t, int >, property< graph_name_t, string > >
graph_t;
using graph_t = adjacency_list< vecS, vecS, directedS, no_property,
property< edge_index_t, int >, property< graph_name_t, string > >;
graph_t g;
get_property(g, graph_name) = "graph";
std::cout << "name: " << get_property(g, graph_name) << std::endl;
typedef subgraph< graph_t > subgraph_t;
using subgraph_t = subgraph< graph_t >;
subgraph_t sg;
get_property(sg, graph_name) = "subgraph";

View File

@@ -14,13 +14,11 @@
using namespace boost;
typedef boost::adjacency_list< vecS, vecS, directedS,
property< vertex_name_t, std::string >, property< edge_weight_t, double > >
Digraph;
using Digraph = boost::adjacency_list< vecS, vecS, directedS,
property< vertex_name_t, std::string >, property< edge_weight_t, double > >;
typedef boost::adjacency_list< vecS, vecS, undirectedS,
property< vertex_name_t, std::string >, property< edge_weight_t, double > >
Graph;
using Graph = boost::adjacency_list< vecS, vecS, undirectedS,
property< vertex_name_t, std::string >, property< edge_weight_t, double > >;
void test_graph_read_write(const std::string& filename)
{
@@ -38,7 +36,7 @@ void test_graph_read_write(const std::string& filename)
BOOST_TEST(num_vertices(g) == 4);
BOOST_TEST(num_edges(g) == 4);
typedef graph_traits< Graph >::vertex_descriptor Vertex;
using Vertex = graph_traits< Graph >::vertex_descriptor;
std::map< std::string, Vertex > name_to_vertex;
BGL_FORALL_VERTICES(v, g, Graph)

View File

@@ -14,8 +14,8 @@
#define DIMENSIONS 3
using namespace boost;
typedef grid_graph< DIMENSIONS > Graph;
typedef graph_traits< Graph > Traits;
using Graph = grid_graph< DIMENSIONS >;
using Traits = graph_traits< Graph >;
// Define a simple function to print vertices
void print_vertex(Traits::vertex_descriptor vertex_to_print)

View File

@@ -14,7 +14,7 @@
int main(int argc, char* argv[])
{
// A 2D grid graph
typedef boost::grid_graph< 2 > GraphType;
using GraphType = boost::grid_graph< 2 >;
// Create a 5x5 graph
const unsigned int dimension = 5;
@@ -22,8 +22,8 @@ int main(int argc, char* argv[])
GraphType graph(lengths);
// Get the index map of the grid graph
typedef boost::property_map< GraphType, boost::vertex_index_t >::const_type
indexMapType;
using indexMapType
= boost::property_map< GraphType, boost::vertex_index_t >::const_type;
indexMapType indexMap(get(boost::vertex_index, graph));
// Create a float for every node in the graph

View File

@@ -47,8 +47,8 @@ template < typename Graph, typename VertexPairIterator >
void build_graph(Graph& graph, unsigned int const nvertices,
VertexPairIterator first, VertexPairIterator last)
{
typedef boost::graph_traits< Graph > Traits;
typedef typename Traits::vertex_descriptor vertex_descriptor;
using Traits = boost::graph_traits< Graph >;
using vertex_descriptor = typename Traits::vertex_descriptor;
std::map< unsigned int, vertex_descriptor > vertices;
for (unsigned int i = 0; i < nvertices; ++i)

View File

@@ -18,8 +18,8 @@ template < typename Graph, typename NameMap, typename VertexMap >
typename boost::graph_traits< Graph >::vertex_descriptor add_named_vertex(
Graph& g, NameMap nm, const std::string& name, VertexMap& vm)
{
typedef typename boost::graph_traits< Graph >::vertex_descriptor Vertex;
typedef typename VertexMap::iterator Iterator;
using Vertex = typename boost::graph_traits< Graph >::vertex_descriptor;
using Iterator = typename VertexMap::iterator;
Vertex v;
Iterator iter;
@@ -46,7 +46,7 @@ inline std::map< std::string,
typename boost::graph_traits< Graph >::vertex_descriptor >
read_graph(Graph& g, NameMap nm, InputStream& is)
{
typedef typename boost::graph_traits< Graph >::vertex_descriptor Vertex;
using Vertex = typename boost::graph_traits< Graph >::vertex_descriptor;
std::map< std::string, Vertex > verts;
for (std::string line; std::getline(is, line);)
{
@@ -68,8 +68,8 @@ inline std::map< std::string,
typename boost::graph_traits< Graph >::vertex_descriptor >
read_graph(Graph& g, InputStream& is)
{
typedef typename boost::graph_traits< Graph >::vertex_descriptor Vertex;
typedef boost::null_property_map< Vertex, std::string > NameMap;
using Vertex = typename boost::graph_traits< Graph >::vertex_descriptor;
using NameMap = boost::null_property_map< Vertex, std::string >;
return read_graph(g, NameMap(), is);
}
@@ -79,8 +79,8 @@ inline std::map< std::string,
typename boost::graph_traits< Graph >::vertex_descriptor >
read_weighted_graph(Graph& g, NameMap nm, WeightMap wm, InputStream& is)
{
typedef typename boost::graph_traits< Graph >::vertex_descriptor Vertex;
typedef typename boost::graph_traits< Graph >::edge_descriptor Edge;
using Vertex = typename boost::graph_traits< Graph >::vertex_descriptor;
using Edge = typename boost::graph_traits< Graph >::edge_descriptor;
std::map< std::string, Vertex > verts;
for (std::string line; std::getline(is, line);)
{
@@ -113,8 +113,8 @@ inline std::map< std::string,
typename boost::graph_traits< Graph >::vertex_descriptor >
read_weighted_graph(Graph& g, WeightMap wm, InputStream& is)
{
typedef typename boost::graph_traits< Graph >::vertex_descriptor Vertex;
typedef boost::null_property_map< Vertex, std::string > NameMap;
using Vertex = typename boost::graph_traits< Graph >::vertex_descriptor;
using NameMap = boost::null_property_map< Vertex, std::string >;
return read_weighted_graph(g, NameMap(), wm, is);
}

View File

@@ -92,14 +92,14 @@ namespace boost
{
template <> struct property_map< ring_graph, edge_weight_t >
{
typedef edge_weight_map type;
typedef edge_weight_map const_type;
using type = edge_weight_map;
using const_type = edge_weight_map;
};
template <> struct property_map< const ring_graph, edge_weight_t >
{
typedef edge_weight_map type;
typedef edge_weight_map const_type;
using type = edge_weight_map;
using const_type = edge_weight_map;
};
}
@@ -121,35 +121,35 @@ class ring_graph
{
public:
// Graph associated types
typedef std::size_t vertex_descriptor;
typedef boost::undirected_tag directed_category;
typedef boost::disallow_parallel_edge_tag edge_parallel_category;
typedef ring_traversal_catetory traversal_category;
using vertex_descriptor = std::size_t;
using directed_category = boost::undirected_tag;
using edge_parallel_category = boost::disallow_parallel_edge_tag;
using traversal_category = ring_traversal_catetory;
// IncidenceGraph associated types
typedef std::pair< vertex_descriptor, vertex_descriptor > edge_descriptor;
typedef ring_incident_edge_iterator out_edge_iterator;
typedef std::size_t degree_size_type;
using edge_descriptor = std::pair< vertex_descriptor, vertex_descriptor >;
using out_edge_iterator = ring_incident_edge_iterator;
using degree_size_type = std::size_t;
// BidirectionalGraph associated types
// Note that undirected graphs make no distinction between in- and out-
// edges.
typedef ring_incident_edge_iterator in_edge_iterator;
using in_edge_iterator = ring_incident_edge_iterator;
// AdjacencyGraph associated types
typedef ring_adjacency_iterator adjacency_iterator;
using adjacency_iterator = ring_adjacency_iterator;
// VertexListGraph associated types
typedef boost::counting_iterator< vertex_descriptor > vertex_iterator;
typedef std::size_t vertices_size_type;
using vertex_iterator = boost::counting_iterator< vertex_descriptor >;
using vertices_size_type = std::size_t;
// EdgeListGraph associated types
typedef ring_edge_iterator edge_iterator;
typedef std::size_t edges_size_type;
using edge_iterator = ring_edge_iterator;
using edges_size_type = std::size_t;
// This type is not part of a graph concept, but is used to return the
// default vertex index map used by the Dijkstra search algorithm.
typedef vertex_descriptor vertex_property_type;
using vertex_property_type = vertex_descriptor;
ring_graph(std::size_t n) : m_n(n) {};
std::size_t n() const { return m_n; }
@@ -161,18 +161,18 @@ private:
// Use these graph_traits parameterizations to refer to the associated
// graph types.
typedef boost::graph_traits< ring_graph >::vertex_descriptor vertex_descriptor;
typedef boost::graph_traits< ring_graph >::edge_descriptor edge_descriptor;
typedef boost::graph_traits< ring_graph >::out_edge_iterator out_edge_iterator;
typedef boost::graph_traits< ring_graph >::in_edge_iterator in_edge_iterator;
typedef boost::graph_traits< ring_graph >::adjacency_iterator
adjacency_iterator;
typedef boost::graph_traits< ring_graph >::degree_size_type degree_size_type;
typedef boost::graph_traits< ring_graph >::vertex_iterator vertex_iterator;
typedef boost::graph_traits< ring_graph >::vertices_size_type
vertices_size_type;
typedef boost::graph_traits< ring_graph >::edge_iterator edge_iterator;
typedef boost::graph_traits< ring_graph >::edges_size_type edges_size_type;
using vertex_descriptor = boost::graph_traits< ring_graph >::vertex_descriptor;
using edge_descriptor = boost::graph_traits< ring_graph >::edge_descriptor;
using out_edge_iterator = boost::graph_traits< ring_graph >::out_edge_iterator;
using in_edge_iterator = boost::graph_traits< ring_graph >::in_edge_iterator;
using adjacency_iterator
= boost::graph_traits< ring_graph >::adjacency_iterator;
using degree_size_type = boost::graph_traits< ring_graph >::degree_size_type;
using vertex_iterator = boost::graph_traits< ring_graph >::vertex_iterator;
using vertices_size_type
= boost::graph_traits< ring_graph >::vertices_size_type;
using edge_iterator = boost::graph_traits< ring_graph >::edge_iterator;
using edges_size_type = boost::graph_traits< ring_graph >::edges_size_type;
// Tag values passed to an iterator constructor to specify whether it should
// be created at the start or the end of its range.
@@ -295,8 +295,8 @@ class ring_adjacency_iterator
{
// The parent class is an iterator_adpator that turns an iterator over
// out edges into an iterator over adjacent vertices.
typedef boost::adjacency_iterator_generator< ring_graph, vertex_descriptor,
out_edge_iterator >::type parent_class;
using parent_class = boost::adjacency_iterator_generator< ring_graph,
vertex_descriptor, out_edge_iterator >::type;
public:
ring_adjacency_iterator() {};
@@ -395,10 +395,10 @@ Map from edges to weight values
*/
struct edge_weight_map
{
typedef double value_type;
typedef value_type reference;
typedef edge_descriptor key_type;
typedef boost::readable_property_map_tag category;
using value_type = double;
using reference = value_type;
using key_type = edge_descriptor;
using category = boost::readable_property_map_tag;
// Edges have a weight equal to the average of their endpoint indexes.
reference operator[](key_type e) const
@@ -409,12 +409,12 @@ struct edge_weight_map
// Use these propety_map and property_traits parameterizations to refer to
// the associated property map types.
typedef boost::property_map< ring_graph, boost::edge_weight_t >::const_type
const_edge_weight_map;
typedef boost::property_traits< const_edge_weight_map >::reference
edge_weight_map_value_type;
typedef boost::property_traits< const_edge_weight_map >::key_type
edge_weight_map_key;
using const_edge_weight_map
= boost::property_map< ring_graph, boost::edge_weight_t >::const_type;
using edge_weight_map_value_type
= boost::property_traits< const_edge_weight_map >::reference;
using edge_weight_map_key
= boost::property_traits< const_edge_weight_map >::key_type;
// PropertyMap valid expressions
edge_weight_map_value_type get(

View File

@@ -30,7 +30,7 @@ int main(int, char*[])
using namespace std;
using namespace boost;
typedef adjacency_list< listS, vecS, bidirectionalS > Graph;
using Graph = adjacency_list< listS, vecS, bidirectionalS >;
const int num_vertices = 5;
Graph g(num_vertices);

View File

@@ -24,8 +24,8 @@ template < typename Graph, typename DistanceType, typename ResultType,
typename Divides = divides< ResultType > >
struct inclusive_average
{
typedef DistanceType distance_type;
typedef ResultType result_type;
using distance_type = DistanceType;
using result_type = ResultType;
result_type operator()(distance_type d, const Graph& g)
{
@@ -56,30 +56,30 @@ struct Link
};
// Declare the graph type and its vertex and edge types.
typedef directed_graph< WebPage, Link > Graph;
typedef graph_traits< Graph >::vertex_descriptor Vertex;
typedef graph_traits< Graph >::edge_descriptor Edge;
using Graph = directed_graph< WebPage, Link >;
using Vertex = graph_traits< Graph >::vertex_descriptor;
using Edge = graph_traits< Graph >::edge_descriptor;
// The name map provides an abstract accessor for the names of
// each vertex. This is used during graph creation.
typedef property_map< Graph, string WebPage::* >::type NameMap;
using NameMap = property_map< Graph, string WebPage::* >::type;
// Declare a matrix type and its corresponding property map that
// will contain the distances between each pair of vertices.
typedef exterior_vertex_property< Graph, float > DistanceProperty;
typedef DistanceProperty::matrix_type DistanceMatrix;
typedef DistanceProperty::matrix_map_type DistanceMatrixMap;
using DistanceProperty = exterior_vertex_property< Graph, float >;
using DistanceMatrix = DistanceProperty::matrix_type;
using DistanceMatrixMap = DistanceProperty::matrix_map_type;
// Declare the weight map as an accessor into the bundled
// edge property.
typedef property_map< Graph, float Link::* >::type WeightMap;
using WeightMap = property_map< Graph, float Link::* >::type;
// Declare a container and its corresponding property map that
// will contain the resulting mean geodesic distances of each
// vertex in the graph.
typedef exterior_vertex_property< Graph, float > GeodesicProperty;
typedef GeodesicProperty::container_type GeodesicContainer;
typedef GeodesicProperty::map_type GeodesicMap;
using GeodesicProperty = exterior_vertex_property< Graph, float >;
using GeodesicContainer = GeodesicProperty::container_type;
using GeodesicMap = GeodesicProperty::map_type;
static float exclusive_geodesics(const Graph&, DistanceMatrixMap, GeodesicMap);
static float inclusive_geodesics(const Graph&, DistanceMatrixMap, GeodesicMap);

View File

@@ -20,10 +20,10 @@ using namespace boost;
int main(int argc, char* argv[])
{
typedef adjacency_list< vecS, vecS, undirectedS > Graph;
typedef graph_traits< Graph >::vertex_descriptor Vertex;
// typedef graph_traits<Graph>::edge_descriptor Edge;
typedef graph_traits< Graph >::vertices_size_type VertexIndex;
using Graph = adjacency_list< vecS, vecS, undirectedS >;
using Vertex = graph_traits< Graph >::vertex_descriptor;
// using Edge = graph_traits<Graph>::edge_descriptor;
using VertexIndex = graph_traits< Graph >::vertices_size_type;
// Create a graph
const int VERTEX_COUNT = 6;
@@ -37,8 +37,8 @@ int main(int argc, char* argv[])
std::vector< Vertex > rank(num_vertices(graph));
std::vector< Vertex > parent(num_vertices(graph));
typedef VertexIndex* Rank;
typedef Vertex* Parent;
using Rank = VertexIndex*;
using Parent = Vertex*;
disjoint_sets< Rank, Parent > ds(&rank[0], &parent[0]);
// Determine the connected components, storing the results in the
@@ -65,7 +65,7 @@ int main(int argc, char* argv[])
// index map into the component_index constructor if our graph type
// used listS instead of vecS (identity_property_map is used by
// default).
typedef component_index< VertexIndex > Components;
using Components = component_index< VertexIndex >;
Components components(parent.begin(), parent.end());
// Iterate through the component indices

View File

@@ -49,9 +49,9 @@ using namespace boost;
int main(int argc, char* argv[])
{
typedef adjacency_list< vecS, vecS, undirectedS > Graph;
typedef graph_traits< Graph >::vertex_descriptor Vertex;
typedef graph_traits< Graph >::vertices_size_type VertexIndex;
using Graph = adjacency_list< vecS, vecS, undirectedS >;
using Vertex = graph_traits< Graph >::vertex_descriptor;
using VertexIndex = graph_traits< Graph >::vertices_size_type;
const int VERTEX_COUNT = 6;
Graph graph(VERTEX_COUNT);
@@ -59,8 +59,8 @@ int main(int argc, char* argv[])
std::vector< VertexIndex > rank(num_vertices(graph));
std::vector< Vertex > parent(num_vertices(graph));
typedef VertexIndex* Rank;
typedef Vertex* Parent;
using Rank = VertexIndex*;
using Parent = Vertex*;
disjoint_sets< Rank, Parent > ds(&rank[0], &parent[0]);
@@ -94,7 +94,7 @@ int main(int argc, char* argv[])
std::cout << std::endl;
typedef component_index< VertexIndex > Components;
using Components = component_index< VertexIndex >;
// NOTE: Because we're using vecS for the graph type, we're
// effectively using identity_property_map for a vertex index map.

View File

@@ -24,20 +24,20 @@ struct Actor
};
// Declare the graph type and its vertex and edge types.
typedef directed_graph< Actor > Graph;
typedef graph_traits< Graph >::vertex_descriptor Vertex;
typedef graph_traits< Graph >::edge_descriptor Edge;
using Graph = directed_graph< Actor >;
using Vertex = graph_traits< Graph >::vertex_descriptor;
using Edge = graph_traits< Graph >::edge_descriptor;
// The name map provides an abstract accessor for the names of
// each vertex. This is used during graph creation.
typedef property_map< Graph, string Actor::* >::type NameMap;
using NameMap = property_map< Graph, string Actor::* >::type;
// Declare a container type for influence and prestige (both
// of which are degree centralities) and its corresponding
// property map.
typedef exterior_vertex_property< Graph, unsigned > CentralityProperty;
typedef CentralityProperty::container_type CentralityContainer;
typedef CentralityProperty::map_type CentralityMap;
using CentralityProperty = exterior_vertex_property< Graph, unsigned >;
using CentralityContainer = CentralityProperty::container_type;
using CentralityMap = CentralityProperty::map_type;
int main(int argc, char* argv[])
{

View File

@@ -66,9 +66,9 @@ int main()
{
// Create the graph, and specify that we will use std::string to
// store the first name's.
typedef adjacency_list< vecS, vecS, directedS, VertexData > MyGraphType;
using MyGraphType = adjacency_list< vecS, vecS, directedS, VertexData >;
typedef pair< int, int > Pair;
using Pair = pair< int, int >;
Pair edge_array[11] = { Pair(0, 1), Pair(0, 2), Pair(0, 3), Pair(0, 4),
Pair(2, 0), Pair(3, 0), Pair(2, 4), Pair(3, 1), Pair(3, 4),
Pair(4, 0), Pair(4, 1) };

View File

@@ -59,11 +59,11 @@ template < class EdgeIter, class Graph >
void who_owes_who(EdgeIter first, EdgeIter last, const Graph& G)
{
// Access the propety acessor type for this graph
typedef
typename property_map< Graph, vertex_first_name_t >::const_type NamePA;
using NamePA =
typename property_map< Graph, vertex_first_name_t >::const_type;
auto name = get(vertex_first_name, G);
typedef typename boost::property_traits< NamePA >::value_type NameType;
using NameType = typename boost::property_traits< NamePA >::value_type;
NameType src_name, targ_name;
@@ -81,11 +81,10 @@ int main()
{
// Create the graph, and specify that we will use std::string to
// store the first name's.
typedef adjacency_list< vecS, vecS, directedS,
property< vertex_first_name_t, std::string > >
MyGraphType;
using MyGraphType = adjacency_list< vecS, vecS, directedS,
property< vertex_first_name_t, std::string > >;
typedef pair< int, int > Pair;
using Pair = pair< int, int >;
Pair edge_array[11] = { Pair(0, 1), Pair(0, 2), Pair(0, 3), Pair(0, 4),
Pair(2, 0), Pair(3, 0), Pair(2, 4), Pair(3, 1), Pair(3, 4),
Pair(4, 0), Pair(4, 1) };

View File

@@ -22,9 +22,8 @@ int main()
const int n = 12;
typedef adjacency_list< vecS, listS, undirectedS,
property< vertex_index_t, int > >
graph_t;
using graph_t = adjacency_list< vecS, listS, undirectedS,
property< vertex_index_t, int > >;
graph_t g1(n), g2(n);
std::vector< graph_traits< graph_t >::vertex_descriptor > v1(n), v2(n);

View File

@@ -18,11 +18,10 @@
int main()
{
using namespace boost;
typedef adjacency_list< vecS, vecS, directedS, no_property,
property< edge_weight_t, int, property< edge_weight2_t, int > > >
Graph;
using Graph = adjacency_list< vecS, vecS, directedS, no_property,
property< edge_weight_t, int, property< edge_weight2_t, int > > >;
const int V = 6;
typedef std::pair< int, int > Edge;
using Edge = std::pair< int, int >;
Edge edge_array[] = { Edge(0, 1), Edge(0, 2), Edge(0, 3), Edge(0, 4),
Edge(0, 5), Edge(1, 2), Edge(1, 5), Edge(1, 3), Edge(2, 4), Edge(2, 5),
Edge(3, 2), Edge(4, 3), Edge(4, 1), Edge(5, 4) };

View File

@@ -52,17 +52,16 @@ int main(int argc, const char** argv)
return EXIT_FAILURE;
}
typedef adjacency_list< vecS, vecS, undirectedS,
using Graph = adjacency_list< vecS, vecS, undirectedS,
property< vertex_name_t, std::string >,
property< edge_name_t, std::string > >
Graph;
property< edge_name_t, std::string > >;
Graph g;
auto actor_name = get(vertex_name, g);
auto connecting_movie = get(edge_name, g);
typedef graph_traits< Graph >::vertex_descriptor Vertex;
typedef std::map< std::string, Vertex > NameVertexMap;
using Vertex = graph_traits< Graph >::vertex_descriptor;
using NameVertexMap = std::map< std::string, Vertex >;
NameVertexMap actors;
for (std::string line; std::getline(datafile, line);)

View File

@@ -52,11 +52,10 @@ struct edge_properties
using namespace boost;
typedef adjacency_list< vecS, vecS, undirectedS, vertex_properties,
edge_properties >
Graph;
typedef graph_traits< Graph >::vertex_descriptor Vertex;
typedef graph_traits< Graph >::edge_descriptor Edge;
using Graph = adjacency_list< vecS, vecS, undirectedS, vertex_properties,
edge_properties >;
using Vertex = graph_traits< Graph >::vertex_descriptor;
using Edge = graph_traits< Graph >::edge_descriptor;
class bacon_number_recorder : public default_bfs_visitor
{

View File

@@ -33,14 +33,13 @@ int main(int, char*[])
{
using namespace boost;
using namespace std;
typedef adjacency_list< vecS, vecS, undirectedS,
using Graph = adjacency_list< vecS, vecS, undirectedS,
property< vertex_color_t, default_color_type,
property< vertex_degree_t, int > > >
Graph;
typedef graph_traits< Graph >::vertex_descriptor Vertex;
typedef graph_traits< Graph >::vertices_size_type size_type;
property< vertex_degree_t, int > > >;
using Vertex = graph_traits< Graph >::vertex_descriptor;
using size_type = graph_traits< Graph >::vertices_size_type;
typedef std::pair< std::size_t, std::size_t > Pair;
using Pair = std::pair< std::size_t, std::size_t >;
Pair edges[14] = { Pair(0, 3), // a-d
Pair(0, 5), // a-f
Pair(1, 2), // b-c

View File

@@ -18,7 +18,7 @@
using namespace boost;
typedef std::pair< int, int > Position;
using Position = std::pair< int, int >;
Position knight_jumps[8]
= { Position(2, -1), Position(1, -2), Position(-1, -2), Position(-2, -1),
Position(-2, 1), Position(-1, 2), Position(1, 2), Position(2, 1) };
@@ -59,19 +59,19 @@ protected:
struct knights_tour_graph
{
typedef Position vertex_descriptor;
typedef std::pair< vertex_descriptor, vertex_descriptor > edge_descriptor;
typedef knight_adjacency_iterator adjacency_iterator;
typedef void out_edge_iterator;
typedef void in_edge_iterator;
typedef void edge_iterator;
typedef void vertex_iterator;
typedef int degree_size_type;
typedef int vertices_size_type;
typedef int edges_size_type;
typedef directed_tag directed_category;
typedef disallow_parallel_edge_tag edge_parallel_category;
typedef adjacency_graph_tag traversal_category;
using vertex_descriptor = Position;
using edge_descriptor = std::pair< vertex_descriptor, vertex_descriptor >;
using adjacency_iterator = knight_adjacency_iterator;
using out_edge_iterator = void;
using in_edge_iterator = void;
using edge_iterator = void;
using vertex_iterator = void;
using degree_size_type = int;
using vertices_size_type = int;
using edges_size_type = int;
using directed_category = directed_tag;
using edge_parallel_category = disallow_parallel_edge_tag;
using traversal_category = adjacency_graph_tag;
knights_tour_graph(int n) : m_board_size(n) {}
int m_board_size;
};
@@ -98,7 +98,7 @@ std::pair< knights_tour_graph::adjacency_iterator,
adjacent_vertices(
knights_tour_graph::vertex_descriptor v, const knights_tour_graph& g)
{
typedef knights_tour_graph::adjacency_iterator Iter;
using Iter = knights_tour_graph::adjacency_iterator;
return std::make_pair(Iter(0, v, g), Iter(8, v, g));
}
@@ -115,8 +115,8 @@ bool backtracking_search(Graph& g,
typename graph_traits< Graph >::vertex_descriptor src,
TimePropertyMap time_map)
{
typedef typename graph_traits< Graph >::vertex_descriptor Vertex;
typedef std::pair< int, Vertex > P;
using Vertex = typename graph_traits< Graph >::vertex_descriptor;
using P = std::pair< int, Vertex >;
std::stack< P > S;
int time_stamp = 0;
@@ -171,8 +171,8 @@ template < typename Graph, typename TimePropertyMap >
bool warnsdorff(Graph& g, typename graph_traits< Graph >::vertex_descriptor src,
TimePropertyMap time_map)
{
typedef typename graph_traits< Graph >::vertex_descriptor Vertex;
typedef std::pair< int, Vertex > P;
using Vertex = typename graph_traits< Graph >::vertex_descriptor;
using P = std::pair< int, Vertex >;
std::stack< P > S;
int time_stamp = 0;
@@ -222,9 +222,9 @@ bool warnsdorff(Graph& g, typename graph_traits< Graph >::vertex_descriptor src,
struct board_map
{
typedef int value_type;
typedef Position key_type;
typedef read_write_property_map_tag category;
using value_type = int;
using key_type = Position;
using category = read_write_property_map_tag;
board_map(int* b, int n) : m_board(b), m_size(n) {}
friend int get(const board_map& ba, Position p);
friend void put(const board_map& ba, Position p, int v);

View File

@@ -13,11 +13,10 @@
int main()
{
using namespace boost;
typedef adjacency_list< vecS, vecS, undirectedS, no_property,
property< edge_weight_t, int > >
Graph;
typedef graph_traits< Graph >::edge_descriptor Edge;
typedef std::pair< int, int > E;
using Graph = adjacency_list< vecS, vecS, undirectedS, no_property,
property< edge_weight_t, int > >;
using Edge = graph_traits< Graph >::edge_descriptor;
using E = std::pair< int, int >;
const int num_nodes = 5;
E edge_array[] = { E(0, 2), E(1, 3), E(1, 4), E(2, 1), E(2, 3), E(3, 4),

View File

@@ -26,9 +26,8 @@ int main()
GraphvizGraph g_dot;
read_graphviz("figs/telephone-network.dot", g_dot);
typedef adjacency_list< vecS, vecS, undirectedS, no_property,
property< edge_weight_t, int > >
Graph;
using Graph = adjacency_list< vecS, vecS, undirectedS, no_property,
property< edge_weight_t, int > >;
Graph g(num_vertices(g_dot));
auto edge_attr_map = get(edge_attribute, g_dot);
graph_traits< GraphvizGraph >::edge_iterator ei, ei_end;
@@ -40,8 +39,8 @@ int main()
}
std::vector< graph_traits< Graph >::edge_descriptor > mst;
typedef std::vector< graph_traits< Graph >::edge_descriptor >::size_type
size_type;
using size_type
= std::vector< graph_traits< Graph >::edge_descriptor >::size_type;
kruskal_minimum_spanning_tree(g, std::back_inserter(mst));
auto weight = get(edge_weight, g);
@@ -50,7 +49,7 @@ int main()
total_weight += get(weight, edge);
std::cout << "total weight: " << total_weight << std::endl;
typedef graph_traits< Graph >::vertex_descriptor Vertex;
using Vertex = graph_traits< Graph >::vertex_descriptor;
for (auto const& edge : mst)
{
auto u = source(edge, g), v = target(edge, g);

View File

@@ -21,9 +21,8 @@ using namespace boost;
int main(int argc, char** argv)
{
typedef adjacency_list< vecS, vecS, undirectedS,
property< vertex_index_t, int >, property< edge_index_t, int > >
graph;
using graph = adjacency_list< vecS, vecS, undirectedS,
property< vertex_index_t, int >, property< edge_index_t, int > >;
// Create a K_6 (complete graph on 6 vertices), which
// contains both Kuratowski subgraphs as minors.
@@ -53,8 +52,8 @@ int main(int argc, char** argv)
// Test for planarity - we know it is not planar, we just want to
// compute the kuratowski subgraph as a side-effect
typedef std::vector< graph_traits< graph >::edge_descriptor >
kuratowski_edges_t;
using kuratowski_edges_t
= std::vector< graph_traits< graph >::edge_descriptor >;
kuratowski_edges_t kuratowski_edges;
if (boyer_myrvold_planarity_test(boyer_myrvold_params::graph = g,
boyer_myrvold_params::kuratowski_subgraph

View File

@@ -27,10 +27,10 @@ int main()
using namespace boost::graph_detail;
typedef directed_graph<> Digraph;
using Digraph = directed_graph<>;
{
typedef labeled_graph< Digraph, unsigned > Graph;
using Graph = labeled_graph< Digraph, unsigned >;
Graph g;
add_vertex(1, g);
add_vertex(2, g);
@@ -39,14 +39,14 @@ int main()
}
{
typedef labeled_graph< Digraph, string > Graph;
using Graph = labeled_graph< Digraph, string >;
Graph g;
add_vertex("foo", g);
add_vertex("bar", g);
}
{
typedef labeled_graph< Digraph, string, mapS > Graph;
using Graph = labeled_graph< Digraph, string, mapS >;
Graph g;
add_vertex("foo", g);
add_vertex("bar", g);
@@ -54,7 +54,7 @@ int main()
}
{
typedef labeled_graph< Digraph*, int > TempGraph;
using TempGraph = labeled_graph< Digraph*, int >;
Digraph g;
TempGraph h(&g);
add_vertex(12, h);
@@ -62,8 +62,8 @@ int main()
{
// This is actually a fairly complicated specialization.
typedef adjacency_list< vecS, vecS, bidirectionalS > G;
typedef labeled_graph< G, size_t > Graph;
using G = adjacency_list< vecS, vecS, bidirectionalS >;
using Graph = labeled_graph< G, size_t >;
Graph g;
add_vertex(0, g);
add_vertex(1, g);

View File

@@ -36,7 +36,7 @@ template < typename Graph, typename VertexNamePropertyMap >
void read_graph_file(std::istream& graph_in, std::istream& name_in, Graph& g,
VertexNamePropertyMap name_map)
{
typedef typename graph_traits< Graph >::vertices_size_type size_type;
using size_type = typename graph_traits< Graph >::vertices_size_type;
size_type n_vertices;
typename graph_traits< Graph >::vertex_descriptor u;
typename property_traits< VertexNamePropertyMap >::value_type name;
@@ -58,13 +58,12 @@ void read_graph_file(std::istream& graph_in, std::istream& name_in, Graph& g,
int main(int argc, const char** argv)
{
typedef adjacency_list< listS, // Store out-edges of each vertex in a
// std::list
using graph_type = adjacency_list< listS, // Store out-edges of each vertex
// in a std::list
vecS, // Store vertex set in a std::vector
directedS, // The graph is directed
property< vertex_name_t, std::string > // Add a vertex property
>
graph_type;
>;
graph_type g; // use default constructor to create empty graph
std::ifstream file_in(argc >= 2 ? argv[1] : "makefile-dependencies.dat"),
@@ -82,16 +81,15 @@ int main(int argc, const char** argv)
// Create storage for last modified times
std::vector< time_t > last_mod_vec(num_vertices(g));
// Create nickname for the property map type
typedef iterator_property_map< std::vector< time_t >::iterator,
property_map< graph_type, vertex_index_t >::type, time_t, time_t& >
iter_map_t;
using iter_map_t = iterator_property_map< std::vector< time_t >::iterator,
property_map< graph_type, vertex_index_t >::type, time_t, time_t& >;
// Create last modified time property map
iter_map_t mod_time_map(last_mod_vec.begin(), get(vertex_index, g));
auto name = get(vertex_name, g);
struct stat stat_buf;
graph_traits< graph_type >::vertex_descriptor u;
typedef graph_traits< graph_type >::vertex_iterator vertex_iter_t;
using vertex_iter_t = graph_traits< graph_type >::vertex_iterator;
std::pair< vertex_iter_t, vertex_iter_t > p;
for (p = vertices(g); p.first != p.second; ++p.first)
{

View File

@@ -12,7 +12,7 @@
int main()
{
using namespace boost;
typedef leda::GRAPH< int, int > Graph;
using Graph = leda::GRAPH< int, int >;
BOOST_CONCEPT_ASSERT((VertexListGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((BidirectionalGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((VertexMutableGraphConcept< Graph >));

Some files were not shown because too many files have changed in this diff Show More