Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions example/accum-compile-times.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions example/actor_clustering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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)
{
Expand Down Expand Up @@ -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(
Expand Down
7 changes: 3 additions & 4 deletions example/adj_list_ra_edgelist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions example/adjacency_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
30 changes: 16 additions & 14 deletions example/adjacency_list_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,29 @@ struct n1_t
{
num = 23063
};
typedef vertex_property_tag kind;

using kind = vertex_property_tag;
};
struct n2_t
{
enum
{
num = 23062
};
typedef vertex_property_tag kind;

using kind = vertex_property_tag;
};
struct n3_t
{
enum
{
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
Expand All @@ -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()
{
Expand All @@ -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())
Expand Down
4 changes: 2 additions & 2 deletions example/adjacency_matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
17 changes: 8 additions & 9 deletions example/astar-cities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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
Expand Down
27 changes: 13 additions & 14 deletions example/astar_maze.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
//
Expand Down Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions example/bellman-example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 3 additions & 4 deletions example/bellman-ford-internet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,16 @@ 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),
Edge(C, E), Edge(C, F), Edge(D, H), Edge(D, E), Edge(E, H), Edge(F, G),
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.
Expand Down
15 changes: 7 additions & 8 deletions example/bfs-example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand All @@ -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
{
Expand All @@ -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
Expand All @@ -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;
Expand Down
Loading
Loading