Difference between revisions of "Boost/BGL/RemoveVertex"
From ProgrammingExamples
Daviddoria (Talk | contribs) (Created page with '==CreateGraph.cpp== <source lang="cpp"> #include <iostream> #include <boost/graph/graph_traits.hpp> #include <boost/graph/undirected_graph.hpp> typedef boost::undirected_graph<b…') |
(No difference)
|
Revision as of 15:10, 11 June 2011
CreateGraph.cpp
#include <iostream> #include <boost/graph/graph_traits.hpp> #include <boost/graph/undirected_graph.hpp> typedef boost::undirected_graph<boost::no_property> Graph; int main(int,char*[]) { // Create a graph object Graph g; // Add vertices Graph::vertex_descriptor v0 = g.add_vertex(); Graph::vertex_descriptor v1 = g.add_vertex(); Graph::vertex_descriptor v2 = g.add_vertex(); std::cout << "There are " << g.num_vertices() << " vertices." << std::endl; g.remove_vertex(v0); std::cout << "There are " << g.num_vertices() << " vertices." << std::endl; return 0; }
CMakeLists.txt
cmake_minimum_required(VERSION 2.6) Project(RemoveVertex) set(Boost_USE_MULTITHREADED ON) FIND_PACKAGE(Boost 1.38 COMPONENTS required) INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} ${Boost_INCLUDE_DIRS}) LINK_DIRECTORIES(${LINK_DIRECTORIES} ${Boost_LIBRARY_DIRS}) ADD_EXECUTABLE(RemoveVertex RemoveVertex.cpp)