Boost
From ProgrammingExamples
Revision as of 09:39, 30 June 2011 by Daviddoria (Talk | contribs)
The following examples are frequent use cases of parts of the Boost (http://www.boost.org/) library. Each example includes a CMakeLists.txt file so it can be easily compiled.
- Bidirectional (both ways) map
- Glorified function pointers (function.hpp and bind.hpp)
- Create a histogram (accumulator)
- Matrix
- Multi dimensional array
- Simple command line argument parsing (ProgramOptions)
- Multiple command line argument parsing (ProgramOptions)
- ProgressBar
- Threads
- Threads with member functions
- ThreadCommunication
- Timer
- Signal/slot pattern
- Signal/slot pattern with member functions
- Signal/slot pattern with member classes
- Signal/slot pattern with member classes which have parameters
- Signals2: Signal/slot pattern with type safety
- Signals2: Signal/slot pattern with parameters type safety
Contents
Boost Graph Library (BGL)
Basics
- Create a graph - This is the most fundamental process of using BGL - creating a graph. This example explains 3 methods of creating a graph, using adjacency_list directly, and also using the directed_graph and undirected_graph subclasses.
- Iterate over all edges in the graph
- Check if an edge exists - If it does, you also get the edge_descriptor
- Copy a graph
- Access an edge
- Remove a vertex from a graph
- Remove an edge from a graph
- Add properties to edges
- Add properties to vertices
- Bundled properties
- Get a list of neighboring (adjacent) vertices
- Directed graphs only give access to out edges
- Bidirectional graphs give access to both in and out edges
- Number of incoming, outgoing, and total edges
- Breadth first search (BFS with a custom visitor)
- Breadth first search with make_bfs_visitor
- Depth first search (DFS)
I/O
- Read a graph from a file
- Write a graph to a file
- Relabel input vertices read from a dot file so they match the labels used in the file
Algorithms
- Find the shortest path (Dijkstra) from a specified vertex to all other vertices in a directed graph
- Find the shortest path (Dijkstra) from a specified vertex to all other vertices in an undirected graph
- Find the shortest path (Dijkstra) from one specified vertex to another specified vertex in a graph
- Cluster a graph using betweenness centrality
Visualization
Wish List
Examples in this section are either shells or something is wrong with them that must be fixed before they can graduate into real examples.