diff --git a/Code/Common/CMakeLists.txt b/Code/Common/CMakeLists.txt index 56010dbaa84bd003ec71b0e81b022c0e04bdccbf..97c41896c0ee37cba1065400630d551cefb1352b 100644 --- a/Code/Common/CMakeLists.txt +++ b/Code/Common/CMakeLists.txt @@ -13,10 +13,10 @@ ENDIF( NOT OTB_USE_PQXX ) ADD_LIBRARY(OTBCommon ${OTBCommon_SRCS}) TARGET_LINK_LIBRARIES (OTBCommon ITKAlgorithms ITKStatistics ITKCommon otbconfigfile) -IF (OTB_USE_MAPNIK) +IF(OTB_USE_MAPNIK) TARGET_LINK_LIBRARIES(OTBCommon ${MAPNIK_LIBRARY}) ENDIF(OTB_USE_MAPNIK) -IF (OTB_USE_PQXX) +IF(OTB_USE_PQXX) #TODO this line should be refined when we will like to have this capability with windows TARGET_LINK_LIBRARIES(OTBCommon pq pqxx) ENDIF(OTB_USE_PQXX) diff --git a/Code/Common/otbVectorDataExtractROI.txx b/Code/Common/otbVectorDataExtractROI.txx index f81dbf8cf59e12239cedf40376255207cb96d1be..69a62573e68d1ee1b1fa5a655a73a8d3bce6efad 100644 --- a/Code/Common/otbVectorDataExtractROI.txx +++ b/Code/Common/otbVectorDataExtractROI.txx @@ -117,7 +117,7 @@ VectorDataExtractROI<TVectorData> chrono.Start(); ProcessNode(inputRoot,outputRoot); chrono.Stop(); - std::cout<<"VectorDataExtractROI: "<<m_Kept<<" Features processed in "<<chrono.GetMeanTime()<<" seconds."<<std::endl; + otbMsgDevMacro(<<"VectorDataExtractROI: "<<m_Kept<<" Features processed in "<<chrono.GetMeanTime()<<" seconds."); }/*End GenerateData()*/ diff --git a/Code/IO/CMakeLists.txt b/Code/IO/CMakeLists.txt index 62c477e20be8d1eb7b4c822562e8781edc2e347c..9dfd24ded5d922d4e737cb4e5f64c382bdfa9f60 100644 --- a/Code/IO/CMakeLists.txt +++ b/Code/IO/CMakeLists.txt @@ -36,7 +36,7 @@ IF( OTB_COMPILE_JPEG2000 ) ENDIF( OTB_COMPILE_JPEG2000 ) IF( OTB_USE_CURL ) - TARGET_LINK_LIBRARIES (OTBIO ${CURL_LIBRARY}) + TARGET_LINK_LIBRARIES (OTBIO ${CURL_LIBRARY} tinyXML) ENDIF( OTB_USE_CURL ) IF(OTB_LIBRARY_PROPERTIES) SET_TARGET_PROPERTIES(OTBIO PROPERTIES ${OTB_LIBRARY_PROPERTIES}) diff --git a/Code/Projections/otbCoordinateToName.cxx b/Code/IO/otbCoordinateToName.cxx similarity index 59% rename from Code/Projections/otbCoordinateToName.cxx rename to Code/IO/otbCoordinateToName.cxx index 480bf2a0b0f3c1a3c83f77dfbaf13a70bfe55661..d9a78c1a8417d863d09eab539d81568efc2aa7e5 100644 --- a/Code/Projections/otbCoordinateToName.cxx +++ b/Code/IO/otbCoordinateToName.cxx @@ -17,29 +17,36 @@ =========================================================================*/ #include "otbCoordinateToName.h" +#include "otbMacro.h" + +#ifdef OTB_USE_CURL #include "tinyxml.h" #include <curl/curl.h> -#include "otbMacro.h" +#endif namespace otb { /** - * Constructor - */ + * Constructor + */ -CoordinateToName::CoordinateToName() +CoordinateToName::CoordinateToName(): + m_Lon(-1000.0), m_Lat(-1000.0), m_Multithread(false), m_IsValid(false) { - m_Lon = -1000.0; - m_Lat = -1000.0; m_PlaceName = ""; m_CountryName = ""; + m_TempFileName = "out-SignayriUt1.xml"; + + m_Threader = itk::MultiThreader::New(); + + m_UpdateDistance = 0.01;//about 1km at equator + } /** - * - */ - + * PrintSelf + */ void CoordinateToName ::PrintSelf(std::ostream& os, itk::Indent indent) const @@ -53,7 +60,29 @@ CoordinateToName bool CoordinateToName::Evaluate() { + if (m_Multithread) + { + m_Threader->SpawnThread(ThreadFunction, this); + } + else + { + DoEvaluate(); + } + return true; +} + +ITK_THREAD_RETURN_TYPE +CoordinateToName::ThreadFunction( void *arg ) +{ + struct itk::MultiThreader::ThreadInfoStruct * pInfo = (itk::MultiThreader::ThreadInfoStruct *)(arg); + CoordinateToName::Pointer lThis = (CoordinateToName*)(pInfo->UserData); + lThis->DoEvaluate(); + return 0; +} + +void CoordinateToName::DoEvaluate() +{ std::ostringstream urlStream; urlStream << "http://ws.geonames.org/findNearbyPlaceName?lat="; urlStream << m_Lat; @@ -61,41 +90,24 @@ bool CoordinateToName::Evaluate() urlStream << m_Lon; otbMsgDevMacro("CoordinateToName: retrieve url " << urlStream.str()); RetrieveXML(urlStream); - ParseXMLGeonames(); - - return true; + std::string placeName = ""; + std::string countryName = ""; + ParseXMLGeonames(placeName, countryName); + m_PlaceName = placeName; + m_CountryName = countryName; + m_IsValid = true; } -/* -//This method will be necessary to process the file directly in memory -//without writing it to the disk. Waiting for the xml lib to handle that -//also -static size_t -curlHandlerWriteMemoryCallback(void *ptr, size_t size, size_t nmemb, - void *data) -{ - register int realsize = (int)(size * nmemb); - - std::vector<char> *vec - = static_cast<std::vector<char>*>(data); - const char* chPtr = static_cast<char*>(ptr); - vec->insert(vec->end(), chPtr, chPtr + realsize); - return realsize; -} -*/ - -void CoordinateToName::RetrieveXML(std::ostringstream& urlStream) +void CoordinateToName::RetrieveXML(std::ostringstream& urlStream) const { - +#ifdef OTB_USE_CURL CURL *curl; CURLcode res; - FILE* output_file = fopen("out.xml","w"); + FILE* output_file = fopen(m_TempFileName.c_str(),"w"); curl = curl_easy_init(); -// std::cout << "URL data " << urlStream.str().data() << std::endl; - char url[256]; strcpy(url,urlStream.str().data()); @@ -105,11 +117,7 @@ void CoordinateToName::RetrieveXML(std::ostringstream& urlStream) { std::vector<char> chunk; curl_easy_setopt(curl, CURLOPT_URL, url); - /* - //Step needed to handle curl without temporary file - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,this->curlHandlerWriteMemoryCallback); - curl_easy_setopt(curl, CURLOPT_FILE, (void *)&chunk); - */ + curl_easy_setopt(curl, CURLOPT_WRITEDATA, output_file); res = curl_easy_perform(curl); @@ -117,27 +125,32 @@ void CoordinateToName::RetrieveXML(std::ostringstream& urlStream) /* always cleanup */ curl_easy_cleanup(curl); } - +#endif } -void CoordinateToName::ParseXMLGeonames() +void CoordinateToName::ParseXMLGeonames(std::string& placeName, std::string& countryName) const { - TiXmlDocument doc( "out.xml" ); +#ifdef OTB_USE_CURL + TiXmlDocument doc( m_TempFileName.c_str() ); doc.LoadFile(); TiXmlHandle docHandle( &doc ); - TiXmlElement* childName = docHandle.FirstChild( "geonames" ).FirstChild( "geoname" ).FirstChild( "name" ).Element(); + TiXmlElement* childName = docHandle.FirstChild( "geonames" ).FirstChild( "geoname" ). + FirstChild( "name" ).Element(); if ( childName ) { - m_PlaceName=childName->GetText(); + placeName=childName->GetText(); } - TiXmlElement* childCountryName = docHandle.FirstChild( "geonames" ).FirstChild( "geoname" ).FirstChild( "countryName" ).Element(); + TiXmlElement* childCountryName = docHandle.FirstChild( "geonames" ).FirstChild( "geoname" ). + FirstChild( "countryName" ).Element(); if ( childCountryName ) { - m_CountryName=childCountryName->GetText(); + countryName=childCountryName->GetText(); } + + remove(m_TempFileName.c_str()); +#endif } } // namespace otb - diff --git a/Code/IO/otbCoordinateToName.h b/Code/IO/otbCoordinateToName.h new file mode 100644 index 0000000000000000000000000000000000000000..3303bc5a49b8cdf0d6eebd676426c0b4e71c9a0c --- /dev/null +++ b/Code/IO/otbCoordinateToName.h @@ -0,0 +1,147 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#ifndef __otbCoordinateToName_h +#define __otbCoordinateToName_h + +#include "itkObject.h" +#include "itkObjectFactory.h" +#include "itkPoint.h" +#include "itkMultiThreader.h" + +namespace otb +{ + +/** + * \class CoordinateToName + * \brief Retrieve geographical information for longitude and latitude coordinates + * + * This class can work in asynchronous mode using \code MultithreadOn() \endcode. In this + * case, the web request does not block the rest of the program. + * + */ + +class ITK_EXPORT CoordinateToName : public itk::Object +{ +public: + /** Standard class typedefs. */ + typedef CoordinateToName Self; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + + typedef itk::Object Superclass; + + itkTypeMacro(CoordinateToName, Object); + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + typedef itk::Point<double,2> PointType; + + itkGetMacro( Lon, double ); + itkGetMacro( Lat, double ); + + itkSetMacro( Lon, double ); + itkSetMacro( Lat, double ); + + /** + * Set the lon/lat only if they are far enough from the current point to + * avoid triggering too many updates + */ + bool SetLonLat(PointType point) + { + if ((vcl_abs(point[0] - m_Lon) > m_UpdateDistance) || (vcl_abs(point[1] - m_Lat) > m_UpdateDistance)) + { + std::cout << "Update lon/lat " << m_Lon << ", " << m_Lat << " -> " << point << std::endl; + m_Lon = point[0]; + m_Lat = point[1]; + //TODO Check whether it is better to have something imprecise or nothing at all + m_IsValid = false; + return true; + } + else + { + std::cout << "Keeping lon/lat" << std::endl; + return false; + } + } + + std::string GetPlaceName() const + { + if (m_IsValid) + { + return m_PlaceName; + } + else + { + return ""; + } + } + + std::string GetCountryName() const + { + if (m_IsValid) + { + return m_CountryName; + } + else + { + return ""; + } + } + + itkGetMacro(Multithread, bool); + itkSetMacro(Multithread, bool); + itkBooleanMacro(Multithread); + + virtual bool Evaluate(); + +protected: + CoordinateToName(); + virtual ~CoordinateToName() {}; + void PrintSelf(std::ostream& os, itk::Indent indent) const; + void RetrieveXML(std::ostringstream& urlStream) const; + void ParseXMLGeonames(std::string& placeName, std::string& countryName) const; + + virtual void DoEvaluate(); + + static ITK_THREAD_RETURN_TYPE ThreadFunction(void*); + +private: + CoordinateToName( const Self& ); //purposely not implemented + void operator=( const Self& ); //purposely not implemented + + double m_Lon; + double m_Lat; + + bool m_Multithread; + bool m_IsValid; + + //Minimum distance to trigger an update of the coordinates + //specified in degrees + double m_UpdateDistance; + + std::string m_PlaceName; + std::string m_CountryName; + std::string m_TempFileName; + + itk::MultiThreader::Pointer m_Threader; +}; + +} // namespace otb + +#endif diff --git a/Code/Projections/otbCoordinateToName.h b/Code/Projections/otbCoordinateToName.h deleted file mode 100644 index 451594d8d12f367b0cc7685e2a7f2128972e266f..0000000000000000000000000000000000000000 --- a/Code/Projections/otbCoordinateToName.h +++ /dev/null @@ -1,80 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ -#ifndef __otbCoordinateToName_h -#define __otbCoordinateToName_h - -#include "itkObject.h" -#include "itkObjectFactory.h" - -namespace otb -{ - -/** - * \class CoordinateToName - * \brief Retrieve Geographical information for Longitude and Latitude coordinates - * - - */ - - -class ITK_EXPORT CoordinateToName : public itk::Object -{ -public: - /** Standard class typedefs. */ - typedef CoordinateToName Self; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - - typedef itk::Object Superclass; - - itkTypeMacro(CoordinateToName, Object); - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - itkGetMacro( Lon, double ); - itkGetMacro( Lat, double ); - itkGetMacro( PlaceName, std::string ); - itkGetMacro( CountryName, std::string ); - - itkSetMacro( Lon, double ); - itkSetMacro( Lat, double ); - - virtual bool Evaluate(); - -protected: - CoordinateToName(); - virtual ~CoordinateToName() {}; - void PrintSelf(std::ostream& os, itk::Indent indent) const; - void RetrieveXML(std::ostringstream& urlStream); - void ParseXMLGeonames(); - -private: - CoordinateToName( const Self& ); //purposely not implemented - void operator=( const Self& ); //purposely not implemented - - double m_Lon; - double m_Lat; - std::string m_PlaceName; - std::string m_CountryName; -}; - -} // namespace otb - - -#endif diff --git a/Code/Projections/otbForwardSensorModel.txx b/Code/Projections/otbForwardSensorModel.txx index ae2ad8d5e0aa61f985cff6e72f6ff8f4d69b4829..003d03f415c6fc7cb9a1544793bbd07618bec5ef 100644 --- a/Code/Projections/otbForwardSensorModel.txx +++ b/Code/Projections/otbForwardSensorModel.txx @@ -84,14 +84,9 @@ ForwardSensorModel< TScalarType, NInputDimensions, NOutputDimensions> currentPoint[1] = ossimGPointRef.lat; // otbMsgDevMacro(<< "PointP Before iter : (" << point[1] << "," << point[0] <<")"); - if (this->m_UseDEM) - { - heightTmp = this->m_DEMHandler->GetHeightAboveMSL(currentPoint); - } - else - { - heightTmp = this->m_AverageElevation; - } + + heightTmp = this->m_DEMHandler->GetHeightAboveMSL(currentPoint); + // otbMsgDevMacro(<< "height : " << heightTmp); this->m_Model->lineSampleHeightToWorld(ossimPoint, heightTmp, ossimGPointRef); diff --git a/Code/Projections/otbPlaceNameToLonLat.h b/Code/Projections/otbPlaceNameToLonLat.h index 5dc5b8bddaaedb04b8108d40672945903243ec2c..5d6b3b8c8bebb235c064d6fc1cfaa698a9eadc87 100644 --- a/Code/Projections/otbPlaceNameToLonLat.h +++ b/Code/Projections/otbPlaceNameToLonLat.h @@ -51,8 +51,6 @@ public: itkGetMacro( Lat, double ); itkGetMacro( PlaceName, std::string ); - itkSetMacro( Lon, double ); - itkSetMacro( Lat, double ); itkSetMacro( PlaceName, std::string ); typedef enum {ALL, GEONAMES, GOOGLE, YAHOO} SearchMethodEnum;//Not implemented yet TODO @@ -80,5 +78,4 @@ private: } // namespace otb - #endif diff --git a/Code/Visualization/otbImageLayer.h b/Code/Visualization/otbImageLayer.h index 5c87ff1f5b6dbf68a0617ffcd0091e32744ac254..88cfff086ab980748aafeab32a323eb25cd640db 100644 --- a/Code/Visualization/otbImageLayer.h +++ b/Code/Visualization/otbImageLayer.h @@ -29,6 +29,8 @@ #include "otbRenderingImageFilter.h" #include "otbGenericRSTransform.h" +#include "otbCoordinateToName.h" + namespace otb { /** \class ImageLayer @@ -246,6 +248,7 @@ private: /** Coordinate transform */ TransformType::Pointer m_Transform; + CoordinateToName::Pointer m_CoordinateToName; /** General info about the image*/ std::string m_PlaceName;//FIXME the call should be done by a more general method outside of the layer diff --git a/Code/Visualization/otbImageLayer.txx b/Code/Visualization/otbImageLayer.txx index a75e08af3a8916487eac45eb3fe3b355bc75ed0d..7329ad3a832f58dcb5a55f29b0e3751d8fdc53da 100644 --- a/Code/Visualization/otbImageLayer.txx +++ b/Code/Visualization/otbImageLayer.txx @@ -59,6 +59,7 @@ ImageLayer<TImage,TOutputImage> m_ScaledExtractRenderingFilter->SetInput(m_ScaledExtractFilter->GetOutput()); m_Transform = TransformType::New(); + m_CoordinateToName = CoordinateToName::New(); m_PlaceName = ""; m_CountryName = ""; @@ -273,18 +274,16 @@ ImageLayer<TImage,TOutputImage> if (m_Transform->GetTransformAccuracy() == Projection::PRECISE) oss<< "(precise location)" << std::endl; if (m_Transform->GetTransformAccuracy() == Projection::ESTIMATE) oss<< "(estimated location)" << std::endl; -// if ((m_PlaceName == "") && (m_CountryName == "")) -// { -// CoordinateToName::Pointer conv = CoordinateToName::New(); -// conv->SetLon(point[0]); -// conv->SetLat(point[1]); -// conv->Evaluate(); -// -// m_PlaceName = conv->GetPlaceName(); -// m_CountryName = conv->GetCountryName(); -// } -// if (m_PlaceName != "") oss << "Near " << m_PlaceName; -// if (m_CountryName != "") oss << " in " << m_CountryName; + if (m_CoordinateToName->SetLonLat(point)) + { + m_CoordinateToName->Evaluate(); + } + + m_PlaceName = m_CoordinateToName->GetPlaceName(); + m_CountryName = m_CoordinateToName->GetCountryName(); + + if (m_PlaceName != "") oss << "Near " << m_PlaceName; + if (m_CountryName != "") oss << " in " << m_CountryName; } else { diff --git a/Examples/Projections/CMakeLists.txt b/Examples/Projections/CMakeLists.txt index f627e3b621ffc38ee0daef5157327736e4c8ca77..b0d60fa5a11df9dfcb88abe0f484d8672fdaf0eb 100644 --- a/Examples/Projections/CMakeLists.txt +++ b/Examples/Projections/CMakeLists.txt @@ -116,8 +116,12 @@ ADD_TEST(prTePlaceNameToLonLatExampleTest ${EXE_TESTS2} Toulouse ) ADD_TEST(prTeCoordinateToNameExampleTest ${EXE_TESTS2} + --compare-ascii ${TOL} + ${BASELINE}/CoordinateToNameExample.txt + ${TEMP}/CoordinateToNameExample.txt CoordinateToNameExampleTest 103.78 1.29 + ${TEMP}/CoordinateToNameExample.txt ) ENDIF( OTB_USE_CURL ) diff --git a/Examples/Projections/CoordinateToNameExample.cxx b/Examples/Projections/CoordinateToNameExample.cxx index 727eaad4ef80475b9d1073815190d017889964fd..bdc7f5628172587af7727f3de89c1afcb32b4868 100644 --- a/Examples/Projections/CoordinateToNameExample.cxx +++ b/Examples/Projections/CoordinateToNameExample.cxx @@ -19,21 +19,22 @@ #pragma warning ( disable : 4786 ) #endif +#include <fstream> #include "otbCoordinateToName.h" - int main( int argc, char* argv[] ) { - if (argc!=3) + if (argc!=4) { - std::cout << argv[0] <<" <lon> <lat>" + std::cout << argv[0] <<" <lon> <lat> <outputfile>" << std::endl; return EXIT_FAILURE; } + const char * outFileName = argv[3]; otb::CoordinateToName::Pointer conv = otb::CoordinateToName::New(); conv->SetLon(atof(argv[1])); @@ -46,6 +47,11 @@ int main( int argc, char* argv[] ) std::cout << "Nearby place: " << name << std::endl; std::cout << "Country: " << country << std::endl; + std::ofstream file; + file.open(outFileName); + file << "Nearby place: " << name << std::endl; + file << "Country: " << country << std::endl; + file.close(); return EXIT_SUCCESS; diff --git a/Testing/Code/IO/CMakeLists.txt b/Testing/Code/IO/CMakeLists.txt index 8b04f67289c500a0934e5fed29269b93426b4050..98a2565404cc2b400dd81fe160fcb0321b46b51a 100755 --- a/Testing/Code/IO/CMakeLists.txt +++ b/Testing/Code/IO/CMakeLists.txt @@ -680,33 +680,31 @@ ADD_TEST(ioTvImageFileReaderRGB_Gdal_SPOT5TIF2PNG ${IO_TESTS7} # ${INPUTDATA}/poupeesBIL # ${TEMP}/ioImageFileReaderRGB_SPOT5TIF2PNG_poupeesBIL.png ) -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbIOTests8 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # ------- otb::ImageFileWriter pour CAI ------------------------------ # Niveau de Gris -ADD_TEST(ioTvImageFileWriterPNG2PNG ${IO_TESTS8} +ADD_TEST(ioTvImageFileWriterPNG2PNG ${IO_TESTS7} --compare-image ${EPSILON_9} ${INPUTDATA}/cthead1.png ${TEMP}/ioImageFileWriterPNG2PNG_cthead1.png otbImageFileWriterTest ${INPUTDATA}/cthead1.png ${TEMP}/ioImageFileWriterPNG2PNG_cthead1.png ) -ADD_TEST(ioTvImageFileWriterPNG2BSQ ${IO_TESTS8} +ADD_TEST(ioTvImageFileWriterPNG2BSQ ${IO_TESTS7} otbImageFileWriterTest ${INPUTDATA}/cthead1.png ${TEMP}/ioImageFileWriterPNG2BSQ_cthead1.hdr ) -ADD_TEST(ioTvImageFileReaderENVI2PNG ${IO_TESTS8} +ADD_TEST(ioTvImageFileReaderENVI2PNG ${IO_TESTS7} --compare-image ${EPSILON_9} ${INPUTDATA}/cthead1.png ${TEMP}/ioImageFileWriterPNG2BSQ_cthead1_2.png otbImageFileReaderTest ${TEMP}/ioImageFileWriterPNG2BSQ_cthead1.hdr ${TEMP}/ioImageFileWriterPNG2BSQ_cthead1_2.png ) -ADD_TEST(ioTvImageFileReaderPDS2TIFF ${IO_TESTS8} +ADD_TEST(ioTvImageFileReaderPDS2TIFF ${IO_TESTS7} --compare-image ${EPSILON_9} ${INPUTDATA}/pdsImage.img ${TEMP}/ioTvImageFileReaderPDS2TIFF.tif otbImageFileReaderTest @@ -714,19 +712,19 @@ ADD_TEST(ioTvImageFileReaderPDS2TIFF ${IO_TESTS8} ${TEMP}/ioTvImageFileReaderPDS2TIFF.tif) # RGB -ADD_TEST(ioTvImageFileWriterRGB_PNG2PNG ${IO_TESTS8} +ADD_TEST(ioTvImageFileWriterRGB_PNG2PNG ${IO_TESTS7} --compare-image ${EPSILON_9} ${BASELINE}/ioImageFileWriterRGB_PNG2PNG.png ${TEMP}/ioImageFileWriterRGB_PNG2PNG.png otbImageFileWriterRGBTest ${INPUTDATA}/couleurs_extrait.png ${TEMP}/ioImageFileWriterRGB_PNG2PNG.png ) -ADD_TEST(ioTvImageFileWriterRGB_PNG2BSQ ${IO_TESTS8} +ADD_TEST(ioTvImageFileWriterRGB_PNG2BSQ ${IO_TESTS7} otbImageFileWriterRGBTest ${INPUTDATA}/couleurs_extrait.png ${TEMP}/ioImageFileWriterRGB_PNG2BSQ.hdr ) -ADD_TEST(ioTvImageFileReaderRGB_BSQ2PNG_2 ${IO_TESTS8} +ADD_TEST(ioTvImageFileReaderRGB_BSQ2PNG_2 ${IO_TESTS7} --compare-image ${EPSILON_9} ${INPUTDATA}/couleurs_extrait.png ${TEMP}/ioImageFileReaderRGB_PNG2BSQ_2.png otbImageFileReaderRGBTest @@ -734,7 +732,7 @@ ADD_TEST(ioTvImageFileReaderRGB_BSQ2PNG_2 ${IO_TESTS8} ${TEMP}/ioImageFileReaderRGB_PNG2BSQ_2.png ) # WRITER GDAL -ADD_TEST(ioTvGDALImageFileWriterTIF2TIF ${IO_TESTS8} +ADD_TEST(ioTvGDALImageFileWriterTIF2TIF ${IO_TESTS7} otbImageFileWriterRGBTest ${INPUTDATA}/poupeesTIF/IMAGERY.TIF ${TEMP}/poupees.tiff ) @@ -744,26 +742,26 @@ ADD_TEST(ioTvGDALImageFileWriterTIF2TIF ${IO_TESTS8} # ------- otb::ImageFileWriter pour GDAL ------------------------------ -ADD_TEST(ioTvImageReaderWriterRgbPNG2PNG ${IO_TESTS8} +ADD_TEST(ioTvImageReaderWriterRgbPNG2PNG ${IO_TESTS7} --compare-image ${EPSILON_9} ${INPUTDATA}/poupees.png ${TEMP}/ioImageReaderWriterRgbPNG2PNG_poupees.png otbImageFileReaderRGBTest ${INPUTDATA}/poupees.png ${TEMP}/ioImageReaderWriterRgbPNG2PNG_poupees.png ) -ADD_TEST(ioTvImageReaderWriterRgbPNG2TIF ${IO_TESTS8} +ADD_TEST(ioTvImageReaderWriterRgbPNG2TIF ${IO_TESTS7} --compare-image ${EPSILON_9} ${INPUTDATA}/poupees.png ${TEMP}/ioImageReaderWriterRgbPNG2TIF_poupees.tif otbImageFileReaderRGBTest ${INPUTDATA}/poupees.png ${TEMP}/ioImageReaderWriterRgbPNG2TIF_poupees.tif ) -ADD_TEST(ioTvImageReaderWriterRgbPNG2ENVI ${IO_TESTS8} +ADD_TEST(ioTvImageReaderWriterRgbPNG2ENVI ${IO_TESTS7} --compare-image ${EPSILON_9} ${INPUTDATA}/poupees.png ${TEMP}/ioImageReaderWriterRgbPNG2ENVI_poupees otbImageFileReaderRGBTest ${INPUTDATA}/poupees.png ${TEMP}/ioImageReaderWriterRgbPNG2ENVI_poupees.hdr ) -ADD_TEST(ioTvImageReaderWriterRgbPNG2JPEG ${IO_TESTS8} +ADD_TEST(ioTvImageReaderWriterRgbPNG2JPEG ${IO_TESTS7} # THOMAS (provisoire) : Images OK mais erreur au DIFF ITK !!! # --compare-image ${EPSILON_9} ${INPUTDATA}/poupees.png # ${TEMP}/ioImageReaderWriterRgbPNG2JPEG_poupees.jpg @@ -771,31 +769,58 @@ ADD_TEST(ioTvImageReaderWriterRgbPNG2JPEG ${IO_TESTS8} ${INPUTDATA}/poupees.png ${TEMP}/ioImageReaderWriterRgbPNG2JPEG_poupees.jpg ) -ADD_TEST(ioTvImageReaderWriterRgbTIF2PNG ${IO_TESTS8} +ADD_TEST(ioTvImageReaderWriterRgbTIF2PNG ${IO_TESTS7} --compare-image ${EPSILON_9} ${INPUTDATA}/poupees.tif ${TEMP}/ioImageReaderWriterRgbTIF2PNG_poupees.png otbImageFileReaderRGBTest ${INPUTDATA}/poupees.tif ${TEMP}/ioImageReaderWriterRgbTIF2PNG_poupees.png ) -ADD_TEST(ioTvImageReaderWriterRgbENVI2PNG ${IO_TESTS8} +ADD_TEST(ioTvImageReaderWriterRgbENVI2PNG ${IO_TESTS7} --compare-image ${EPSILON_9} ${INPUTDATA}/poupees ${TEMP}/ioImageReaderWriterRgbENVI2PNG_poupees.png otbImageFileReaderRGBTest ${INPUTDATA}/poupees ${TEMP}/ioImageReaderWriterRgbENVI2PNG_poupees.png ) -ADD_TEST(ioTvImageReaderWriterRgbJPEG2PNG ${IO_TESTS8} +ADD_TEST(ioTvImageReaderWriterRgbJPEG2PNG ${IO_TESTS7} --compare-image ${EPSILON_9} ${INPUTDATA}/couleurs.jpg ${TEMP}/ioImageReaderWriterRgbJPEG2PNG_couleurs.png otbImageFileReaderRGBTest ${INPUTDATA}/couleurs.jpg ${TEMP}/ioImageReaderWriterRgbJPEG2PNG_couleurs.png ) -ADD_TEST(ioTvImageReaderWriterRgbJPEG2TIF ${IO_TESTS8} +ADD_TEST(ioTvImageReaderWriterRgbJPEG2TIF ${IO_TESTS7} --compare-image ${EPSILON_9} ${INPUTDATA}/couleurs.jpg ${TEMP}/ioImageReaderWriterRgbJPEG2TIF_couleurs.tif otbImageFileReaderRGBTest ${INPUTDATA}/couleurs.jpg ${TEMP}/ioImageReaderWriterRgbJPEG2TIF_couleurs.tif ) +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbIOTests8 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +IF( OTB_USE_CURL ) + +ADD_TEST(coTvCoordinateToNameTest ${IO_TESTS8} + --compare-ascii ${NOTOL} + ${BASELINE}/CoordinateToNameTest.txt + ${TEMP}/CoordinateToNameTest.txt + otbCoordinateToNameTest + 103.78 1.29 + ${TEMP}/CoordinateToNameTest.txt +) + +#this test intentionaly uses the same baseline as the previous one +ADD_TEST(coTvCoordinateToNameMultithreadTest ${IO_TESTS8} + --compare-ascii ${NOTOL} + ${BASELINE}/CoordinateToNameTest.txt + ${TEMP}/CoordinateToNameMultithreadTest.txt + otbCoordinateToNameTest + 103.78 1.29 + ${TEMP}/CoordinateToNameMultithreadTest.txt + 1 +) + +ENDIF( OTB_USE_CURL ) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ COMMON_TESTS2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1593,6 +1618,7 @@ ENDIF(OTB_DATA_USE_LARGEINPUT) ENDIF(OTB_COMPILE_JPEG2000) +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbIOTESTS14 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1634,6 +1660,7 @@ ADD_TEST(ioTvWritingComplexDataWithComplexImage ${IO_TESTS14} ) ENDIF(OTB_DATA_USE_LARGEINPUT) +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbIOTESTS15 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2181,13 +2208,12 @@ SET(BasicIO_SRCS7 otbIOTests7.cxx otbImageFileReaderTest.cxx otbImageFileReaderRGBTest.cxx +otbImageFileWriterTest.cxx +otbImageFileWriterRGBTest.cxx ) SET(BasicIO_SRCS8 otbIOTests8.cxx -otbImageFileWriterTest.cxx -otbImageFileReaderTest.cxx -otbImageFileReaderRGBTest.cxx -otbImageFileWriterRGBTest.cxx +otbCoordinateToNameTest.cxx ) SET(BasicIO_SRCS9 otbIOTests9.cxx diff --git a/Testing/Code/IO/otbCoordinateToNameTest.cxx b/Testing/Code/IO/otbCoordinateToNameTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6e433447e9c7ebd141bd479348d33b9990d8224b --- /dev/null +++ b/Testing/Code/IO/otbCoordinateToNameTest.cxx @@ -0,0 +1,71 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#if defined(_MSC_VER) +#pragma warning ( disable : 4786 ) +#endif + +#include <fstream> +#include <cstdlib> +#include <OpenThreads/Thread> + +#include "otbCoordinateToName.h" + +int otbCoordinateToNameTest( int argc, char* argv[] ) +{ + + if (argc < 4) + { + std::cout << argv[0] <<" <lon> <lat> <outputfile>" + << std::endl; + + return EXIT_FAILURE; + } + + const char * outFileName = argv[3]; + + otb::CoordinateToName::Pointer conv = otb::CoordinateToName::New(); + conv->SetLon(atof(argv[1])); + conv->SetLat(atof(argv[2])); + + if ((argc > 4) && atoi(argv[4]) == 1) + { + conv->MultithreadOn(); + conv->Evaluate(); + OpenThreads::Thread::microSleep(10000000);//Make sure that the web request has the time to complete + } + else + { + conv->MultithreadOff(); + conv->Evaluate(); + } + + std::string name = conv->GetPlaceName(); + std::string country = conv->GetCountryName(); + + std::cout << "Nearby place: " << name << std::endl; + std::cout << "Country: " << country << std::endl; + + std::ofstream file; + file.open(outFileName); + file << "Nearby place: " << name << std::endl; + file << "Country: " << country << std::endl; + file.close(); + + return EXIT_SUCCESS; + +} diff --git a/Testing/Code/IO/otbIOTests7.cxx b/Testing/Code/IO/otbIOTests7.cxx index 86a469af233efd60e2e81abba819c1f747fe0f1a..588852243733feec8f4c0820240b31f52db6e245 100644 --- a/Testing/Code/IO/otbIOTests7.cxx +++ b/Testing/Code/IO/otbIOTests7.cxx @@ -30,4 +30,7 @@ void RegisterTests() { REGISTER_TEST(otbImageFileReaderTest); REGISTER_TEST(otbImageFileReaderRGBTest); + REGISTER_TEST(otbImageFileWriterTest); + REGISTER_TEST(otbImageFileReaderRGBTest); + REGISTER_TEST(otbImageFileWriterRGBTest); } diff --git a/Testing/Code/IO/otbIOTests8.cxx b/Testing/Code/IO/otbIOTests8.cxx index 27011d130f8f9d07cac81aa1ad08d065e47ce8f3..25dcf7f39ba7f3a5ecb11f22db0ab349c1db7113 100644 --- a/Testing/Code/IO/otbIOTests8.cxx +++ b/Testing/Code/IO/otbIOTests8.cxx @@ -28,9 +28,5 @@ void RegisterTests() { - - REGISTER_TEST(otbImageFileWriterTest); - REGISTER_TEST(otbImageFileReaderTest); - REGISTER_TEST(otbImageFileReaderRGBTest); - REGISTER_TEST(otbImageFileWriterRGBTest); + REGISTER_TEST(otbCoordinateToNameTest); } diff --git a/Testing/Code/Projections/CMakeLists.txt b/Testing/Code/Projections/CMakeLists.txt index 88834f8c5cefa66affb5b747c7adadd4ff54233b..e36cc7c492bfbe8021a61f2855db9c16324607c3 100644 --- a/Testing/Code/Projections/CMakeLists.txt +++ b/Testing/Code/Projections/CMakeLists.txt @@ -460,6 +460,9 @@ ADD_TEST(prTvVectorDataExtractROIandProjection ${PROJECTIONS_TESTS3} ) ENDIF(OTB_DATA_USE_LARGEINPUT) + + + #======================================================================================= SET(Projections_SRCS1 otbProjectionsTests1.cxx @@ -497,6 +500,7 @@ otbGeocentricTransform.cxx otbVectorDataExtractROIandProjection.cxx ) + OTB_ADD_EXECUTABLE(otbProjectionsTests1 "${Projections_SRCS1}" "OTBProjections;OTBIO;OTBTesting") OTB_ADD_EXECUTABLE(otbProjectionsTests2 "${Projections_SRCS2}" "OTBProjections;OTBIO;OTBTesting") OTB_ADD_EXECUTABLE(otbProjectionsTests3 "${Projections_SRCS3}" "OTBProjections;OTBIO;OTBTesting") diff --git a/Utilities/BGL/boost/graph/example/Jamfile b/Utilities/BGL/boost/graph/example/Jamfile deleted file mode 100644 index 24b241321fbded4178255dc716ff3b2975d99d97..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/Jamfile +++ /dev/null @@ -1,136 +0,0 @@ -subproject libs/graph/example ; - -# Define SGB (stanford graph base top level directory) and -# LEDA (also top level directory) at the command line of jam using -s - -rule graph-test ( sources + : requirements * ) -{ - unit-test $(sources[1]:S=) : $(sources) : $(requirements) <sysinclude>$(BOOST_ROOT) : debug <inlining>on ; -} - -graph-test remove_edge_if_bidir.cpp ; -graph-test undirected_dfs.cpp ; -graph-test remove_edge_if_dir.cpp ; -graph-test remove_edge_if_undir.cpp ; -graph-test reverse-graph-eg.cpp ; -graph-test scc.cpp <lib>../build/bgl-viz ; -graph-test strong_components.cpp <lib>../build/bgl-viz ; -graph-test strong-components.cpp ; -graph-test subgraph.cpp ; -graph-test subgraph_properties.cpp ; -graph-test topo-sort1.cpp ; -graph-test topo-sort2.cpp ; -graph-test topo_sort.cpp ; -graph-test topo-sort-file-dep2.cpp ; -graph-test topo-sort-file-dep.cpp ; -graph-test transitive_closure.cpp ; -graph-test transpose-example.cpp ; -graph-test undirected.cpp ; -graph-test vector-as-graph.cpp ; -graph-test vertex_basics.cpp ; -graph-test vertex-name-property.cpp ; -graph-test visitor.cpp ; -graph-test accum-compile-times.cpp ; -graph-test adjacency_list.cpp ; -graph-test adjacency_list_io.cpp ; -graph-test adjacency_matrix.cpp ; -graph-test bellman-example.cpp ; -graph-test bellman-ford-internet.cpp ; -graph-test bfs.cpp ; -graph-test bfs-example.cpp ; -graph-test bfs-name-printer.cpp ; -graph-test bfs_neighbor.cpp ; -graph-test biconnected_components.cpp ; -graph-test boost_web_graph.cpp ; -graph-test bucket_sorter.cpp ; -graph-test cc-internet.cpp <lib>../build/bgl-viz ; -graph-test city_visitor.cpp ; -graph-test components_on_edgelist.cpp ; -graph-test connected_components.cpp ; -graph-test connected-components.cpp ; -graph-test container_gen.cpp ; -graph-test copy-example.cpp ; -graph-test cuthill_mckee_ordering.cpp ; -graph-test cycle-file-dep2.cpp ; -graph-test cycle-file-dep.cpp ; -graph-test dag_shortest_paths.cpp ; -graph-test dave.cpp ; -graph-test default-constructor2.cpp ; -graph-test default-constructor.cpp ; -graph-test dfs.cpp ; -graph-test dfs-example.cpp ; -graph-test dfs_parenthesis.cpp <lib>../build/bgl-viz ; -graph-test dfs-parenthesis.cpp <lib>../build/bgl-viz ; -graph-test dijkstra-example.cpp ; -graph-test edge_basics.cpp ; -graph-test edge_connectivity.cpp ; -graph-test edge-connectivity.cpp <lib>../build/bgl-viz ; -graph-test edge-function.cpp ; -graph-test edge_iterator_constructor.cpp ; -graph-test edge-iter-constructor.cpp ; -graph-test edge_property.cpp ; -graph-test edmunds-karp-eg.cpp ; -graph-test exterior_properties.cpp ; -graph-test exterior_property_map.cpp ; -graph-test family-tree-eg.cpp ; -graph-test fibonacci_heap.cpp ; -graph-test file_dependencies.cpp ; -graph-test filtered_graph.cpp ; -graph-test filtered_vec_as_graph.cpp ; -graph-test gerdemann.cpp ; -graph-test graph-assoc-types.cpp ; -graph-test graph.cpp ; -graph-test graph-property-iter-eg.cpp ; -graph-test graphviz.cpp <lib>../build/bgl-viz ; -graph-test incremental_components.cpp ; -graph-test incremental-components-eg.cpp ; -graph-test in_edges.cpp ; -graph-test interior_property_map.cpp ; -graph-test isomorphism.cpp ; -graph-test iterator-property-map-eg.cpp ; -graph-test johnson-eg.cpp <lib>../build/bgl-viz ; -graph-test kevin-bacon.cpp ; -graph-test knights-tour.cpp ; -graph-test kruskal-example.cpp ; -graph-test kruskal-telephone.cpp <lib>../build/bgl-viz ; -graph-test last-mod-time.cpp ; -graph-test loops_dfs.cpp <lib>../build/bgl-viz ; -graph-test max_flow.cpp ; -graph-test minimum_degree_ordering.cpp iohb.c ; -graph-test min_max_paths.cpp ; -graph-test modify_graph.cpp ; -graph-test neighbor_bfs.cpp ; -graph-test ordered_out_edges.cpp ; -graph-test ospf-example.cpp <lib>../build/bgl-viz ; -graph-test parallel-compile-time.cpp ; -graph-test prim-example.cpp ; -graph-test prim-telephone.cpp <lib>../build/bgl-viz ; -graph-test print-adjacent-vertices.cpp ; -graph-test print-edges.cpp ; -graph-test print-in-edges.cpp ; -graph-test print-out-edges.cpp ; -graph-test property_iterator.cpp ; -graph-test property-map-traits-eg.cpp ; -graph-test push-relabel-eg.cpp ; -graph-test put-get-helper-eg.cpp ; -graph-test quick_tour.cpp ; -graph-test quick-tour.cpp ; -graph-test reachable-loop-head.cpp <lib>../build/bgl-viz ; -graph-test reachable-loop-tail.cpp <lib>../build/bgl-viz ; -graph-test roget_components.cpp : - <include>$(SGB) <library-file>$(SGB)/libgb.a ; -graph-test topo-sort-with-leda.cpp : - <include>$(LEDA)/incl <library-file>$(LEDA)/libG.a - <library-file>$(LEDA)/libL.a <library-file>$(LEDA)/libP.a ; -graph-test topo-sort-with-sgb.cpp : - <include>$(SGB) <library-file>$(SGB)/libgb.a ; -graph-test leda-concept-check.cpp : - <include>$(LEDA)/incl <library-file>$(LEDA)/libG.a <library-file>$(LEDA)/libL.a <library-file>$(LEDA)/libP.a ; -graph-test leda-graph-eg.cpp : - <include>$(LEDA)/incl <library-file>$(LEDA)/libG.a - <library-file>$(LEDA)/libL.a <library-file>$(LEDA)/libP.a ; -graph-test girth.cpp : <include>$(SGB) - <library-file>$(SGB)/libgb.a ; -graph-test miles_span.cpp : <include>$(SGB) - <library-file>$(SGB)/libgb.a ; - diff --git a/Utilities/BGL/boost/graph/example/accum-compile-times.cpp b/Utilities/BGL/boost/graph/example/accum-compile-times.cpp deleted file mode 100644 index 0cc66b60396470be481cd172d5dfa6bc80fde261..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/accum-compile-times.cpp +++ /dev/null @@ -1,101 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <fstream> -#include <iostream> -#include <numeric> -#include <iterator> -#include <string> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/property_iter_range.hpp> - -namespace std -{ - template < typename T > - std::istream& operator >> (std::istream& in, std::pair < T, T > &p) - { - in >> p.first >> p.second; - return in; - } -} - -namespace boost -{ - enum vertex_compile_cost_t { vertex_compile_cost }; - 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; - -typedef graph_traits<file_dep_graph2>::vertex_descriptor vertex_t; -typedef graph_traits<file_dep_graph2>::edge_descriptor edge_t; - -int -main() -{ - std::ifstream file_in("makefile-dependencies.dat"); - typedef graph_traits<file_dep_graph2>::vertices_size_type size_type; - size_type n_vertices; - file_in >> n_vertices; // read in number of vertices -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // std::istream_iterator causes trouble with VC++ - std::vector<vertex_t> id2vertex; - file_dep_graph2 g; - for (std::size_t i = 0; i < n_vertices; ++i) - id2vertex.push_back(add_vertex(g)); - std::pair<size_type, size_type> p; - while (file_in >> p) - add_edge(id2vertex[p.first], id2vertex[p.second], g); -#else - std::istream_iterator<std::pair<size_type, size_type> > - input_begin(file_in), input_end; - file_dep_graph2 g(input_begin, input_end, n_vertices); -#endif - - typedef property_map < file_dep_graph2, vertex_name_t >::type name_map_t; - typedef property_map < file_dep_graph2, vertex_compile_cost_t >::type - compile_cost_map_t; - typedef property_map <file_dep_graph2, vertex_distance_t >::type - distance_map_t; - typedef property_map <file_dep_graph2, vertex_color_t >::type - color_map_t; - - name_map_t name_map = get(vertex_name, g); - compile_cost_map_t compile_cost_map = get(vertex_compile_cost, g); - distance_map_t distance_map = get(vertex_distance, g); - color_map_t color_map = get(vertex_color, g); - - std::ifstream name_in("makefile-target-names.dat"); - std::ifstream compile_cost_in("target-compile-costs.dat"); - graph_traits < file_dep_graph2 >::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { - name_in >> name_map[*vi]; - compile_cost_in >> compile_cost_map[*vi]; - } - - graph_property_iter_range < file_dep_graph2, - vertex_compile_cost_t >::iterator ci, ci_end; - tie(ci, ci_end) = get_property_iter_range(g, vertex_compile_cost); - std::cout << "total (sequential) compile time: " - << std::accumulate(ci, ci_end, 0.0) << std::endl; - - return 0; -} - diff --git a/Utilities/BGL/boost/graph/example/actor_clustering.cpp b/Utilities/BGL/boost/graph/example/actor_clustering.cpp deleted file mode 100644 index a292564791b0d9419868d2c9664e993aa4652f9c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/actor_clustering.cpp +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright 2004 The Trustees of Indiana University. - -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Authors: Douglas Gregor -// Andrew Lumsdaine - -// This program performs betweenness centrality (BC) clustering on the -// actor collaboration graph available at -// http://www.nd.edu/~networks/database/index.html and outputs the -// result of clustering in Pajek format. -// -// This program mimics the BC clustering algorithm program implemented -// by Shashikant Penumarthy for JUNG, so that we may compare results -// and timings. -#include <boost/graph/bc_clustering.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graph_traits.hpp> -#include <fstream> -#include <iostream> -#include <string> -#include <boost/tokenizer.hpp> -#include <boost/lexical_cast.hpp> -#include <map> - -using namespace boost; - -struct Actor -{ - Actor(int id = -1) : id(id) {} - - 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; - -void load_actor_graph(std::istream& in, ActorGraph& g) -{ - std::map<int, Vertex> actors; - - std::string line; - while (getline(in, line)) { - std::vector<Vertex> actors_in_movie; - - // Map from the actor numbers on this line to the actor vertices - typedef tokenizer<char_separator<char> > Tok; - Tok tok(line, char_separator<char>(" ")); - for (Tok::iterator id = tok.begin(); id != tok.end(); ++id) { - int actor_id = lexical_cast<int>(*id); - std::map<int, Vertex>::iterator v = actors.find(actor_id); - if (v == actors.end()) { - Vertex new_vertex = add_vertex(Actor(actor_id), g); - actors[actor_id] = new_vertex; - actors_in_movie.push_back(new_vertex); - } else { - actors_in_movie.push_back(v->second); - } - } - - for (std::vector<Vertex>::iterator i = actors_in_movie.begin(); - i != actors_in_movie.end(); ++i) { - for (std::vector<Vertex>::iterator j = i + 1; - j != actors_in_movie.end(); ++j) { - if (!edge(*i, *j, g).second) add_edge(*i, *j, g); - } - } - } -} - -template<typename Graph, typename VertexIndexMap, typename VertexNameMap> -std::ostream& -write_pajek_graph(std::ostream& out, const Graph& g, - VertexIndexMap vertex_index, VertexNameMap vertex_name) -{ - out << "*Vertices " << num_vertices(g) << '\n'; - typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; - for (vertex_iterator v = vertices(g).first; v != vertices(g).second; ++v) { - out << get(vertex_index, *v)+1 << " \"" << get(vertex_name, *v) << "\"\n"; - } - - out << "*Edges\n"; - typedef typename graph_traits<Graph>::edge_iterator edge_iterator; - for (edge_iterator e = edges(g).first; e != edges(g).second; ++e) { - out << get(vertex_index, source(*e, g))+1 << ' ' - << get(vertex_index, target(*e, g))+1 << " 1.0\n"; // HACK! - } - return out; -} - -class actor_clustering_threshold : public bc_clustering_threshold<double> -{ - typedef bc_clustering_threshold<double> inherited; - - public: - actor_clustering_threshold(double threshold, const ActorGraph& g, - bool normalize) - : inherited(threshold, g, normalize), iter(1) { } - - bool operator()(double max_centrality, Edge e, const ActorGraph& g) - { - std::cout << "Iter: " << iter << " Max Centrality: " - << (max_centrality / dividend) << std::endl; - ++iter; - return inherited::operator()(max_centrality, e, g); - } - - private: - unsigned int iter; -}; - -int main(int argc, char* argv[]) -{ - std::string in_file; - std::string out_file; - double threshold = -1.0; - bool normalize = false; - - // Parse command-line options - { - int on_arg = 1; - while (on_arg < argc) { - std::string arg(argv[on_arg]); - if (arg == "-in") { - ++on_arg; assert(on_arg < argc); - in_file = argv[on_arg]; - } else if (arg == "-out") { - ++on_arg; assert(on_arg < argc); - out_file = argv[on_arg]; - } else if (arg == "-threshold") { - ++on_arg; assert(on_arg < argc); - threshold = lexical_cast<double>(argv[on_arg]); - } else if (arg == "-normalize") { - normalize = true; - } else { - std::cerr << "Unrecognized parameter \"" << arg << "\".\n"; - return -1; - } - ++on_arg; - } - - if (in_file.empty() || out_file.empty() || threshold < 0) { - std::cerr << "error: syntax is actor_clustering [options]\n\n" - << "options are:\n" - << "\t-in <infile>\tInput file\n" - << "\t-out <outfile>\tOutput file\n" - << "\t-threshold <value>\tA threshold value\n" - << "\t-normalize\tNormalize edge centrality scores\n"; - return -1; - } - } - - ActorGraph g; - - // Load the actor graph - { - std::cout << "Building graph." << std::endl; - std::ifstream in(in_file.c_str()); - if (!in) { - std::cerr << "Unable to open file \"" << in_file << "\" for input.\n"; - return -2; - } - load_actor_graph(in, g); - } - - // Run the algorithm - std::cout << "Clusting..." << std::endl; - betweenness_centrality_clustering(g, - actor_clustering_threshold(threshold, g, normalize), - get(edge_centrality, g)); - - // Output the graph - { - std::cout << "Writing graph to file: " << out_file << std::endl; - std::ofstream out(out_file.c_str()); - if (!out) { - std::cerr << "Unable to open file \"" << out_file << "\" for output.\n"; - return -3; - } - write_pajek_graph(out, g, get(vertex_index, g), get(&Actor::id, g)); - } - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/adj_list_ra_edgelist.cpp b/Utilities/BGL/boost/graph/example/adj_list_ra_edgelist.cpp deleted file mode 100644 index 0c8dc032c136986b6855b459f5b2a2fed956c804..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/adj_list_ra_edgelist.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//======================================================================= -// Copyright 2001 Indiana University. -// Author: Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#include <boost/config.hpp> -#include <boost/graph/adjacency_list.hpp> - -int -main() -{ - using namespace boost; - typedef adjacency_list<vecS, vecS, bidirectionalS, no_property, - property<int, edge_weight_t>, no_property, vecS> Graph; - - const std::size_t n = 3; - typedef std::pair<std::size_t, std::size_t> E; - 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); - for (std::size_t i = 0; i < m; ++i) - std::cout << edges(g).first[i] << " "; - std::cout << std::endl; - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/adjacency_list.cpp b/Utilities/BGL/boost/graph/example/adjacency_list.cpp deleted file mode 100644 index 4d8c165def08faded4cea7df9e8176899d63af9e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/adjacency_list.cpp +++ /dev/null @@ -1,107 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <vector> -#include <utility> -#include <string> - -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graph_utility.hpp> -#include <boost/property_map.hpp> - -/* - Sample Output - - graph name: foo - 0 --joe--> 1 - 1 --joe--> 0 --curly--> 2 --dick--> 3 - 2 --curly--> 1 --tom--> 4 - 3 --dick--> 1 --harry--> 4 - 4 --tom--> 2 --harry--> 3 - (0,1) (1,2) (1,3) (2,4) (3,4) - - removing edge (1,3): - 0 --joe--> 1 - 1 --joe--> 0 --curly--> 2 - 2 --curly--> 1 --tom--> 4 - 3 --harry--> 4 - 4 --tom--> 2 --harry--> 3 - (0,1) (1,2) (2,4) (3,4) - - */ - -struct EdgeProperties { - EdgeProperties(const std::string& n) : name(n) { } - std::string name; -}; - -struct VertexProperties { - std::size_t index; - boost::default_color_type color; -}; - - -int main(int , char* []) -{ - using namespace boost; - using namespace std; - - typedef adjacency_list<vecS, listS, undirectedS, - VertexProperties, EdgeProperties> Graph; - - const int V = 5; - Graph g(V); - - property_map<Graph, std::size_t VertexProperties::*>::type - id = get(&VertexProperties::index, g); - property_map<Graph, std::string EdgeProperties::*>::type - name = get(&EdgeProperties::name, g); - - boost::graph_traits<Graph>::vertex_iterator vi, viend; - int vnum = 0; - - for (boost::tie(vi,viend) = vertices(g); vi != viend; ++vi) - id[*vi] = vnum++; - - add_edge(vertex(0, g), vertex(1, g), EdgeProperties("joe"), g); - add_edge(vertex(1, g), vertex(2, g), EdgeProperties("curly"), g); - add_edge(vertex(1, g), vertex(3, g), EdgeProperties("dick"), g); - add_edge(vertex(2, g), vertex(4, g), EdgeProperties("tom"), g); - add_edge(vertex(3, g), vertex(4, g), EdgeProperties("harry"), g); - - graph_traits<Graph>::vertex_iterator i, end; - graph_traits<Graph>::out_edge_iterator ei, edge_end; - for (boost::tie(i,end) = vertices(g); i != end; ++i) { - cout << id[*i] << " "; - for (boost::tie(ei,edge_end) = out_edges(*i, g); ei != edge_end; ++ei) - cout << " --" << name[*ei] << "--> " << id[target(*ei, g)] << " "; - cout << endl; - } - print_edges(g, id); - - cout << endl << "removing edge (1,3): " << endl; - remove_edge(vertex(1, g), vertex(3, g), g); - - ei = out_edges(vertex(1, g), g).first; - cout << "removing edge (" << id[source(*ei, g)] - << "," << id[target(*ei, g)] << ")" << endl; - remove_edge(ei, g); - - for(boost::tie(i,end) = vertices(g); i != end; ++i) { - cout << id[*i] << " "; - for (boost::tie(ei,edge_end) = out_edges(*i, g); ei != edge_end; ++ei) - cout << " --" << name[*ei] << "--> " << id[target(*ei, g)] << " "; - cout << endl; - } - - print_edges(g, id); - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/adjacency_list.expected b/Utilities/BGL/boost/graph/example/adjacency_list.expected deleted file mode 100644 index f85d7549f0927642905ac84d2e3e68ce20a8b552..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/adjacency_list.expected +++ /dev/null @@ -1,15 +0,0 @@ -0 --joe--> 1 -1 --joe--> 0 --curly--> 2 --dick--> 3 -2 --curly--> 1 --tom--> 4 -3 --dick--> 1 --harry--> 4 -4 --tom--> 2 --harry--> 3 -(0,1) (1,2) (1,3) (2,4) (3,4) - -removing edge (1,3): -removing edge (1,0) -0 -1 --curly--> 2 -2 --curly--> 1 --tom--> 4 -3 --harry--> 4 -4 --tom--> 2 --harry--> 3 -(1,2) (2,4) (3,4) diff --git a/Utilities/BGL/boost/graph/example/adjacency_list_io.cpp b/Utilities/BGL/boost/graph/example/adjacency_list_io.cpp deleted file mode 100644 index 565d1bac8b11341148b43efeb3683ed2239826b4..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/adjacency_list_io.cpp +++ /dev/null @@ -1,97 +0,0 @@ -// (C) Copyright François Faure 2001 -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include <boost/config.hpp> - -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 -#error adjacency_list_io.hpp has not been ported to work with VC++ -#endif - -#include <boost/graph/adjacency_list_io.hpp> -#include <fstream> - -using namespace boost; - -//======== my data structure -struct MyStruct { double value; }; -std::ostream& operator << ( std::ostream& out, const MyStruct& s ) -{ - out << s.value << " "; - return out; -} -std::istream& operator >> ( std::istream& in, MyStruct& s ) -{ - in >> s.value; - return in; -} - -//======== vertex properties -struct n1_t { enum { num = 23063}; typedef vertex_property_tag kind; }; -struct n2_t { enum { num = 23062}; typedef vertex_property_tag kind; }; -struct n3_t { enum { num = 23061}; typedef vertex_property_tag kind; }; -typedef property< n1_t, int, - property< n2_t, double, - property< n3_t, MyStruct > > > VertexProperty; - - -//====== edge properties -struct e1_t { enum { num = 23064}; typedef edge_property_tag kind; }; -typedef property<e1_t, double> EdgeProperty; - - - -//===== graph types - -typedef - adjacency_list<vecS, listS, directedS, no_property, no_property> - Graph1; - -typedef - adjacency_list<setS, setS, bidirectionalS, VertexProperty, EdgeProperty> - Graph2; - - - -int -main() -{ - // read Graph1 - Graph1 g1; - std::ifstream readFile1("data1.txt"); - readFile1 >> read( g1 ); - std::cout << "graph g1 from file data1.txt:\n" - << write( g1 ) - << std::endl; - - // read Graph2 and all internal properties - Graph2 g2; - std::ifstream readFile2("data2.txt"); - readFile2 >> read( g2 ); - std::cout << "graph g2 from file data2.txt:\n" - << write( g2 ) - << std::endl; - - // read Graph2, no property given. Write no property. - Graph2 g21; - std::ifstream readFile21("data1.txt"); - readFile21 >> read( g21, no_property(), no_property() ); - std::cout << "graph g21 from file data1.txt:\n" - << write(g21, no_property(), no_property()) - << std::endl; - - // 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; - readFile31 >> read( g31, readNodeProp() , EdgeProperty() ); - std::cout << "graph g31 from file data3.txt:\n" - << write( g31, property<n3_t, MyStruct>(), EdgeProperty() ) - << std::endl; - - - return 0; -} - - diff --git a/Utilities/BGL/boost/graph/example/adjacency_matrix.cpp b/Utilities/BGL/boost/graph/example/adjacency_matrix.cpp deleted file mode 100644 index accbfca1eeeb4580b36717304db9350ecaadf61b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/adjacency_matrix.cpp +++ /dev/null @@ -1,67 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Author: Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <boost/graph/adjacency_matrix.hpp> -#include <boost/graph/graph_utility.hpp> - - -int main() -{ - using namespace boost; - enum { A, B, C, D, E, F, N }; - const char* name = "ABCDEF"; - - // A directed graph - - typedef adjacency_matrix<directedS> Graph; - Graph g(N); - add_edge(B, C, g); - add_edge(B, F, g); - add_edge(C, A, g); - add_edge(C, C, g); - add_edge(D, E, g); - add_edge(E, D, g); - add_edge(F, A, g); - - std::cout << "vertex set: "; - print_vertices(g, name); - std::cout << std::endl; - - std::cout << "edge set: "; - print_edges(g, name); - std::cout << std::endl; - - std::cout << "out-edges: " << std::endl; - print_graph(g, name); - std::cout << std::endl; - - // An undirected graph - - typedef adjacency_matrix<undirectedS> UGraph; - UGraph ug(N); - add_edge(B, C, ug); - add_edge(B, F, ug); - add_edge(C, A, ug); - add_edge(D, E, ug); - add_edge(F, A, ug); - - std::cout << "vertex set: "; - print_vertices(ug, name); - std::cout << std::endl; - - std::cout << "edge set: "; - print_edges(ug, name); - std::cout << std::endl; - - std::cout << "incident edges: " << std::endl; - print_graph(ug, name); - std::cout << std::endl; - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/astar-cities.cpp b/Utilities/BGL/boost/graph/example/astar-cities.cpp deleted file mode 100644 index a2a115440bf2acbf2839d3827cf8fa92438247bf..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/astar-cities.cpp +++ /dev/null @@ -1,224 +0,0 @@ - - -// -//======================================================================= -// Copyright (c) 2004 Kristopher Beevers -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -// - - -#include <boost/graph/astar_search.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/random.hpp> -#include <boost/random.hpp> -#include <boost/graph/graphviz.hpp> -#include <sys/time.h> -#include <vector> -#include <list> -#include <iostream> -#include <fstream> -#include <math.h> // for sqrt - -using namespace boost; -using namespace std; - - -// auxiliary types -struct location -{ - float y, x; // lat, long -}; -typedef float cost; - -template <class Name, class LocMap> -class city_writer { -public: - city_writer(Name n, LocMap l, float _minx, float _maxx, - float _miny, float _maxy, - unsigned int _ptx, unsigned int _pty) - : name(n), loc(l), minx(_minx), maxx(_maxx), miny(_miny), - maxy(_maxy), ptx(_ptx), pty(_pty) {} - template <class Vertex> - void operator()(ostream& out, const Vertex& v) const { - float px = 1 - (loc[v].x - minx) / (maxx - minx); - float py = (loc[v].y - miny) / (maxy - miny); - out << "[label=\"" << name[v] << "\", pos=\"" - << static_cast<unsigned int>(ptx * px) << "," - << static_cast<unsigned int>(pty * py) - << "\", fontsize=\"11\"]"; - } -private: - Name name; - LocMap loc; - float minx, maxx, miny, maxy; - unsigned int ptx, pty; -}; - -template <class WeightMap> -class time_writer { -public: - time_writer(WeightMap w) : wm(w) {} - template <class Edge> - void operator()(ostream &out, const Edge& e) const { - out << "[label=\"" << wm[e] << "\", fontsize=\"11\"]"; - } -private: - WeightMap wm; -}; - - -// euclidean distance heuristic -template <class Graph, class CostType, class LocMap> -class distance_heuristic : public astar_heuristic<Graph, CostType> -{ -public: - typedef typename graph_traits<Graph>::vertex_descriptor Vertex; - distance_heuristic(LocMap l, Vertex goal) - : m_location(l), m_goal(goal) {} - CostType operator()(Vertex u) - { - CostType dx = m_location[m_goal].x - m_location[u].x; - CostType dy = m_location[m_goal].y - m_location[u].y; - return ::sqrt(dx * dx + dy * dy); - } -private: - LocMap m_location; - Vertex m_goal; -}; - - -struct found_goal {}; // exception for termination - -// visitor that terminates when we find the goal -template <class Vertex> -class astar_goal_visitor : public boost::default_astar_visitor -{ -public: - astar_goal_visitor(Vertex goal) : m_goal(goal) {} - template <class Graph> - void examine_vertex(Vertex u, Graph& g) { - if(u == m_goal) - throw found_goal(); - } -private: - Vertex m_goal; -}; - - -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 mygraph_t::vertex_iterator vertex_iterator; - typedef std::pair<int, int> edge; - - // specify data - enum nodes { - Troy, LakePlacid, Plattsburgh, Massena, Watertown, Utica, - Syracuse, Rochester, Buffalo, Ithaca, Binghamton, Woodstock, - NewYork, N - }; - const char *name[] = { - "Troy", "Lake Placid", "Plattsburgh", "Massena", - "Watertown", "Utica", "Syracuse", "Rochester", "Buffalo", - "Ithaca", "Binghamton", "Woodstock", "New York" - }; - location locations[] = { // lat/long - {42.73, 73.68}, {44.28, 73.99}, {44.70, 73.46}, - {44.93, 74.89}, {43.97, 75.91}, {43.10, 75.23}, - {43.04, 76.14}, {43.17, 77.61}, {42.89, 78.86}, - {42.44, 76.50}, {42.10, 75.91}, {42.04, 74.11}, - {40.67, 73.94} - }; - edge edge_array[] = { - edge(Troy,Utica), edge(Troy,LakePlacid), - edge(Troy,Plattsburgh), edge(LakePlacid,Plattsburgh), - edge(Plattsburgh,Massena), edge(LakePlacid,Massena), - edge(Massena,Watertown), edge(Watertown,Utica), - edge(Watertown,Syracuse), edge(Utica,Syracuse), - edge(Syracuse,Rochester), edge(Rochester,Buffalo), - edge(Syracuse,Ithaca), edge(Ithaca,Binghamton), - edge(Ithaca,Rochester), edge(Binghamton,Troy), - edge(Binghamton,Woodstock), edge(Binghamton,NewYork), - edge(Syracuse,Binghamton), edge(Woodstock,Troy), - edge(Woodstock,NewYork) - }; - unsigned int num_edges = sizeof(edge_array) / sizeof(edge); - cost weights[] = { // estimated travel time (mins) - 96, 134, 143, 65, 115, 133, 117, 116, 74, 56, - 84, 73, 69, 70, 116, 147, 173, 183, 74, 71, 124 - }; - - - // create graph - mygraph_t g(N); - WeightMap weightmap = get(edge_weight, g); - for(std::size_t j = 0; j < num_edges; ++j) { - edge_descriptor e; bool inserted; - tie(e, inserted) = add_edge(edge_array[j].first, - edge_array[j].second, g); - weightmap[e] = weights[j]; - } - - - // pick random start/goal - mt19937 gen(time(0)); - vertex start = random_vertex(g, gen); - vertex goal = random_vertex(g, gen); - - - cout << "Start vertex: " << name[start] << endl; - cout << "Goal vertex: " << name[goal] << endl; - - ofstream dotfile; - dotfile.open("test-astar-cities.dot"); - write_graphviz(dotfile, g, - city_writer<const char **, location*> - (name, locations, 73.46, 78.86, 40.67, 44.93, - 480, 400), - time_writer<WeightMap>(weightmap)); - - - vector<mygraph_t::vertex_descriptor> p(num_vertices(g)); - vector<cost> d(num_vertices(g)); - try { - // call astar named parameter interface - astar_search - (g, start, - distance_heuristic<mygraph_t, cost, location*> - (locations, goal), - predecessor_map(&p[0]).distance_map(&d[0]). - visitor(astar_goal_visitor<vertex>(goal))); - - - } catch(found_goal fg) { // found a path to the goal - list<vertex> shortest_path; - for(vertex v = goal;; v = p[v]) { - shortest_path.push_front(v); - if(p[v] == v) - break; - } - cout << "Shortest path from " << name[start] << " to " - << name[goal] << ": "; - list<vertex>::iterator spi = shortest_path.begin(); - cout << name[start]; - for(++spi; spi != shortest_path.end(); ++spi) - cout << " -> " << name[*spi]; - cout << endl << "Total travel time: " << d[goal] << endl; - return 0; - } - - cout << "Didn't find a path from " << name[start] << "to" - << name[goal] << "!" << endl; - return 0; - -} diff --git a/Utilities/BGL/boost/graph/example/bcsstk01 b/Utilities/BGL/boost/graph/example/bcsstk01 deleted file mode 100644 index a99a2f430323d7052c57bc4a13871a20405b6100..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/bcsstk01 +++ /dev/null @@ -1,96 +0,0 @@ - 24 - 37 - 30 - 26 - 25 - 38 - 22 - 31 - 29 - 15 - 14 - 13 - 39 - 32 - 33 - 20 - 40 - 41 - 42 - 43 - 34 - 12 - 11 - 10 - 5 - 4 - 3 - 6 - 2 - 1 - 19 - 21 - 44 - 27 - 45 - 35 - 46 - 28 - 47 - 9 - 8 - 7 - 23 - 16 - 18 - 17 - 36 - 48 - 30 - 29 - 27 - 26 - 25 - 28 - 42 - 41 - 40 - 24 - 23 - 22 - 12 - 11 - 10 - 44 - 46 - 45 - 31 - 16 - 32 - 7 - 43 - 1 - 5 - 4 - 34 - 38 - 9 - 3 - 8 - 14 - 15 - 21 - 36 - 47 - 2 - 6 - 13 - 17 - 18 - 19 - 20 - 33 - 35 - 37 - 39 - 48 diff --git a/Utilities/BGL/boost/graph/example/bcsstk01.rsa b/Utilities/BGL/boost/graph/example/bcsstk01.rsa deleted file mode 100644 index 3d420ed4720fa8a98742770d1189b308660e0dbe..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/bcsstk01.rsa +++ /dev/null @@ -1,78 +0,0 @@ -1SYMMETRIC STIFFNESS MATRIX SMALL GENERALIZED EIGENVALUE PROBLEM BCSSTK01 - 74 4 14 56 0 -RSA 48 48 224 0 -(16I5) (16I5) (4E20.12) - 1 9 17 25 31 37 43 49 55 62 66 70 75 85 95 104 - 112 120 127 132 136 141 144 146 149 154 158 161 164 167 169 173 - 178 183 185 188 191 196 201 205 208 211 213 216 219 221 222 224 - 225 - 1 5 6 7 11 19 25 30 2 4 6 8 10 20 24 26 - 3 4 5 9 21 23 27 28 4 8 10 22 27 28 5 7 - 11 21 23 29 6 12 20 24 25 30 7 11 12 13 31 36 - 8 10 12 14 18 32 9 10 11 15 17 33 34 10 16 33 - 34 11 15 17 35 12 14 18 31 36 13 17 18 19 23 37 - 42 43 47 48 14 15 16 18 20 22 38 44 45 46 15 16 - 17 21 39 40 44 45 46 16 20 22 39 40 44 45 46 17 - 18 19 23 41 43 47 48 18 24 37 42 43 47 48 19 23 - 24 43 48 20 22 24 44 21 22 23 45 46 22 45 46 23 - 47 24 43 48 25 29 30 31 35 26 28 32 34 27 28 33 - 28 32 34 29 31 35 30 36 31 35 36 37 32 34 36 38 - 42 33 34 35 39 41 34 40 35 39 41 36 38 42 37 41 - 42 43 47 38 40 42 44 46 39 40 41 45 40 44 46 41 - 43 47 42 48 43 47 48 44 45 46 45 46 46 47 48 48 - .283226851852E+07 .100000000000E+07 .208333333333E+07 -.333333333333E+04 - .100000000000E+07 -.280000000000E+07 -.289351851852E+05 .208333333333E+07 - .163544753086E+07 -.200000000000E+07 .555555555555E+07 -.666666666667E+04 - -.200000000000E+07 -.308641975309E+05 .555555555555E+07 -.159791666667E+07 - .172436728395E+07 -.208333333333E+07 -.277777777778E+07 -.168000000000E+07 - -.154320987654E+05 -.277777777778E+07 -.289351851852E+05 -.208333333333E+07 - .100333333333E+10 .200000000000E+07 .400000000000E+09 -.333333333333E+07 - .208333333333E+07 .100000000000E+09 .106750000000E+10 -.100000000000E+07 - .200000000000E+09 .277777777778E+07 .333333333333E+09 -.833333333333E+06 - .153533333333E+10 -.200000000000E+07 -.555555555555E+07 .666666666667E+09 - -.208333333333E+07 .100000000000E+09 .283226851852E+07 -.100000000000E+07 - .208333333333E+07 -.280000000000E+07 -.289351851852E+05 .208333333333E+07 - .163544753086E+07 .200000000000E+07 .555555555555E+07 -.308641975309E+05 - .555555555555E+07 -.159791666667E+07 .172436728395E+07 -.208333333333E+07 - -.277777777778E+07 -.154320987654E+05 -.277777777778E+07 -.289351851852E+05 - -.208333333333E+07 .100333333333E+10 -.333333333333E+07 .208333333333E+07 - .100000000000E+09 .106750000000E+10 .277777777778E+07 .333333333333E+09 - -.833333333333E+06 .153533333333E+10 -.555555555555E+07 .666666666667E+09 - -.208333333333E+07 .100000000000E+09 .283609946950E+07 -.214928529451E+07 - .235916180402E+07 -.333333333333E+04 -.100000000000E+07 -.289351851852E+05 - .208333333333E+07 -.383095098171E+04 -.114928529451E+07 .275828470683E+06 - .176741074446E+07 .517922131816E+06 .429857058902E+07 -.555555555555E+07 - -.666666666667E+04 .200000000000E+07 -.159791666667E+07 -.131963213599E+06 - -.517922131816E+06 .229857058902E+07 .389003806848E+07 -.263499027470E+07 - .277777777778E+07 -.168000000000E+07 -.289351851852E+05 -.208333333333E+07 - -.517922131816E+06 -.216567078453E+07 -.551656941367E+06 .197572063531E+10 - -.200000000000E+07 .400000000000E+09 .208333333333E+07 .100000000000E+09 - -.229857058902E+07 .551656941366E+06 .486193650990E+09 .152734651547E+10 - -.109779731332E+09 .100000000000E+07 .200000000000E+09 -.833333333333E+06 - .114928529451E+07 .229724661236E+09 -.557173510779E+08 .156411143711E+10 - -.200000000000E+07 -.208333333333E+07 .100000000000E+09 -.275828470683E+06 - -.557173510779E+08 .109411960038E+08 .283226851852E+07 .100000000000E+07 - .208333333333E+07 -.289351851852E+05 .208333333333E+07 .163544753086E+07 - -.200000000000E+07 -.555555555555E+07 -.159791666667E+07 .172436728395E+07 - -.208333333333E+07 .277777777778E+07 -.289351851852E+05 -.208333333333E+07 - .100333333333E+10 .208333333333E+07 .100000000000E+09 .106750000000E+10 - -.833333333333E+06 .153533333333E+10 -.208333333333E+07 .100000000000E+09 - .608796296296E+05 .125000000000E+07 .416666666667E+06 -.416666666667E+04 - .125000000000E+07 .337291666667E+07 -.250000000000E+07 -.833333333333E+04 - -.250000000000E+07 .241171296296E+07 -.416666666667E+06 -.235500000000E+07 - .150000000000E+10 .250000000000E+07 .500000000000E+09 .501833333333E+09 - -.125000000000E+07 .250000000000E+09 .502500000000E+09 -.250000000000E+07 - .398587962963E+07 -.125000000000E+07 .416666666667E+06 -.392500000000E+07 - .341149691358E+07 .250000000000E+07 .694444444444E+07 -.385802469136E+05 - .694444444445E+07 .243100308642E+07 -.416666666667E+06 -.347222222222E+07 - -.192901234568E+05 -.347222222222E+07 .150416666667E+10 -.416666666667E+07 - .133516666667E+10 .347222222222E+07 .416666666667E+09 .216916666667E+10 - -.694444444444E+07 .833333333333E+09 .398587962963E+07 -.125000000000E+07 - .416666666667E+06 -.416666666667E+04 -.125000000000E+07 .341149691358E+07 - .250000000000E+07 -.694444444445E+07 -.833333333333E+04 .250000000000E+07 - .243100308642E+07 -.416666666667E+06 .347222222222E+07 -.235500000000E+07 - .150416666667E+10 -.250000000000E+07 .500000000000E+09 .133516666667E+10 - .125000000000E+07 .250000000000E+09 .216916666667E+10 -.250000000000E+07 - .647105806113E+05 .239928529451E+07 .140838195984E+06 .350487988027E+07 - .517922131816E+06 -.479857058902E+07 .457738374749E+07 .134990274700E+06 - .247238730198E+10 .961679848804E+09 -.109779731332E+09 .531278103775E+09 diff --git a/Utilities/BGL/boost/graph/example/bellman-example.cpp b/Utilities/BGL/boost/graph/example/bellman-example.cpp deleted file mode 100644 index 4e0b27d3f023b89ebe472e2a74319be57988d3ad..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/bellman-example.cpp +++ /dev/null @@ -1,128 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <vector> -#include <iostream> -#include <fstream> -#include <iomanip> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/bellman_ford_shortest_paths.hpp> - -using namespace boost; - -template < typename Graph, typename ParentMap > -struct edge_writer -{ - edge_writer(const Graph & g, const ParentMap & p) - : m_g(g), m_parent(p) - { - } - - template < typename Edge > - void operator() (std::ostream & out, const Edge & e) const - { - out << "[label=\"" << get(edge_weight, m_g, e) << "\""; - typename graph_traits < Graph >::vertex_descriptor - u = source(e, m_g), v = target(e, m_g); - if (m_parent[v] == u) - out << ", color=\"black\""; - else - out << ", color=\"grey\""; - out << "]"; - } - const Graph & m_g; - ParentMap m_parent; -}; -template < typename Graph, typename Parent > -edge_writer < Graph, Parent > -make_edge_writer(const Graph & g, const Parent & p) -{ - return edge_writer < Graph, Parent > (g, p); -} - -struct EdgeProperties { - int weight; -}; - -int -main() -{ - enum { u, v, x, y, z, N }; - char name[] = { 'u', 'v', 'x', 'y', 'z' }; - typedef std::pair < int, int >E; - 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; -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ can't handle the iterator constructor - Graph g(N); - for (std::size_t j = 0; j < n_edges; ++j) - add_edge(edge_array[j].first, edge_array[j].second, g); -#else - Graph g(edge_array, edge_array + n_edges, N); -#endif - graph_traits < Graph >::edge_iterator ei, ei_end; - property_map<Graph, int EdgeProperties::*>::type - weight_pmap = get(&EdgeProperties::weight, g); - int i = 0; - for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei, ++i) - weight_pmap[*ei] = weight[i]; - - std::vector<int> distance(N, (std::numeric_limits < short >::max)()); - std::vector<std::size_t> parent(N); - for (i = 0; i < N; ++i) - parent[i] = i; - distance[z] = 0; - -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - bool r = bellman_ford_shortest_paths - (g, int(N), weight_pmap, &parent[0], &distance[0], - closed_plus<int>(), std::less<int>(), default_bellman_visitor()); -#else - bool r = bellman_ford_shortest_paths - (g, int (N), weight_map(weight_pmap).distance_map(&distance[0]). - predecessor_map(&parent[0])); -#endif - - if (r) - for (i = 0; i < N; ++i) - std::cout << name[i] << ": " << std::setw(3) << distance[i] - << " " << name[parent[i]] << std::endl; - else - std::cout << "negative cycle" << std::endl; - - std::ofstream dot_file("figs/bellman-eg.dot"); - dot_file << "digraph D {\n" - << " rankdir=LR\n" - << " size=\"5,3\"\n" - << " ratio=\"fill\"\n" - << " edge[style=\"bold\"]\n" << " node[shape=\"circle\"]\n"; - - { - for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { - graph_traits < Graph >::edge_descriptor e = *ei; - graph_traits < Graph >::vertex_descriptor - u = source(e, g), v = target(e, g); - // VC++ doesn't like the 3-argument get function, so here - // we workaround by using 2-nested get()'s. - dot_file << name[u] << " -> " << name[v] - << "[label=\"" << get(get(&EdgeProperties::weight, g), e) << "\""; - if (parent[v] == u) - dot_file << ", color=\"black\""; - else - dot_file << ", color=\"grey\""; - dot_file << "]"; - } - } - dot_file << "}"; - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/bellman-ford-internet.cpp b/Utilities/BGL/boost/graph/example/bellman-ford-internet.cpp deleted file mode 100644 index 24bbfef4f0b4503ad1848cce8689eaac3b701ac6..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/bellman-ford-internet.cpp +++ /dev/null @@ -1,63 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <iostream> -#include <boost/graph/edge_list.hpp> -#include <boost/graph/bellman_ford_shortest_paths.hpp> - -int -main() -{ - using namespace boost; - // ID numbers for the routers (vertices). - enum - { A, B, C, D, E, F, G, H, n_vertices }; - const int n_edges = 11; - typedef std::pair < int, int >Edge; - - // 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; - Graph g(edges, edges + n_edges); - - // The transmission delay values for each edge. - float delay[] = - {5.0, 1.0, 1.3, 3.0, 10.0, 2.0, 6.3, 0.4, 1.3, 1.2, 0.5}; - - // Declare some storage for some "external" vertex properties. - char name[] = "ABCDEFGH"; - int parent[n_vertices]; - for (int i = 0; i < n_vertices; ++i) - parent[i] = i; - float distance[n_vertices]; - std::fill(distance, distance + n_vertices, (std::numeric_limits < float >::max)()); - // Specify A as the source vertex - distance[A] = 0; - - bool r = bellman_ford_shortest_paths(g, int (n_vertices), - weight_map(make_iterator_property_map - (&delay[0], - get(edge_index, g), - delay[0])). - distance_map(&distance[0]). - predecessor_map(&parent[0])); - - if (r) - for (int i = 0; i < n_vertices; ++i) - std::cout << name[i] << ": " << distance[i] - << " " << name[parent[i]] << std::endl; - else - std::cout << "negative cycle" << std::endl; - - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/bellman_ford.expected b/Utilities/BGL/boost/graph/example/bellman_ford.expected deleted file mode 100644 index 7d38857560f6f834337501e4b818cdfab28aa0da..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/bellman_ford.expected +++ /dev/null @@ -1,5 +0,0 @@ -u: 2 v -v: 4 x -x: 7 z -y: -2 u -z: 0 z diff --git a/Utilities/BGL/boost/graph/example/bfs-example.cpp b/Utilities/BGL/boost/graph/example/bfs-example.cpp deleted file mode 100644 index 20e3b8da935d49ecbc0a012c8abd287187d0ac34..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/bfs-example.cpp +++ /dev/null @@ -1,81 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/breadth_first_search.hpp> -#include <boost/pending/indirect_cmp.hpp> -#include <boost/pending/integer_range.hpp> - -#include <iostream> - -using namespace boost; -template < typename TimeMap > class bfs_time_visitor:public default_bfs_visitor { - typedef typename property_traits < TimeMap >::value_type T; -public: - bfs_time_visitor(TimeMap tmap, T & t):m_timemap(tmap), m_time(t) { } - template < typename Vertex, typename Graph > - void discover_vertex(Vertex u, const Graph & g) const - { - put(m_timemap, u, m_time++); - } - TimeMap m_timemap; - T & m_time; -}; - - -int -main() -{ - using namespace boost; - // Select the graph type we wish to use - typedef adjacency_list < vecS, vecS, undirectedS > graph_t; - // Set up the vertex IDs and names - enum { r, s, t, u, v, w, x, y, N }; - const char *name = "rstuvwxy"; - // Specify the edges in the graph - typedef std::pair < int, int >E; - 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 - const int n_edges = sizeof(edge_array) / sizeof(E); -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ has trouble with the edge iterator constructor - graph_t g(N); - 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; - graph_t g(edge_array, edge_array + n_edges, v_size_t(N)); -#endif - - // Typedefs - typedef graph_traits < graph_t >::vertex_descriptor Vertex; - typedef graph_traits < graph_t >::vertices_size_type Size; - typedef Size* Iiter; - - // a vector to hold the discover time property for each vertex - std::vector < Size > dtime(num_vertices(g)); - - Size time = 0; - bfs_time_visitor < Size * >vis(&dtime[0], time); - breadth_first_search(g, vertex(s, g), visitor(vis)); - - // Use std::sort to order the vertices by their discover time - std::vector<graph_traits<graph_t>::vertices_size_type > discover_order(N); - integer_range < int >range(0, N); - std::copy(range.begin(), range.end(), discover_order.begin()); - std::sort(discover_order.begin(), discover_order.end(), - indirect_cmp < Iiter, std::less < Size > >(&dtime[0])); - - std::cout << "order of discovery: "; - for (int i = 0; i < N; ++i) - std::cout << name[discover_order[i]] << " "; - std::cout << std::endl; - - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/bfs-example2.cpp b/Utilities/BGL/boost/graph/example/bfs-example2.cpp deleted file mode 100644 index ca8e87748e089fb39ff9bc99daa2bb90d6e987aa..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/bfs-example2.cpp +++ /dev/null @@ -1,97 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/breadth_first_search.hpp> -#include <boost/pending/indirect_cmp.hpp> -#include <boost/pending/integer_range.hpp> - -#include <iostream> - -using namespace boost; -template < typename TimeMap > class bfs_time_visitor:public default_bfs_visitor { - typedef typename property_traits < TimeMap >::value_type T; -public: - bfs_time_visitor(TimeMap tmap, T & t):m_timemap(tmap), m_time(t) { } - template < typename Vertex, typename Graph > - void discover_vertex(Vertex u, const Graph & g) const - { - put(m_timemap, u, m_time++); - } - TimeMap m_timemap; - T & m_time; -}; - - -struct VertexProps { - boost::default_color_type color; - std::size_t discover_time; -}; - -int -main() -{ - using namespace boost; - // Select the graph type we wish to use - typedef adjacency_list < listS, listS, undirectedS, - VertexProps> graph_t; - // Set up the vertex IDs and names - enum { r, s, t, u, v, w, x, y, N }; - const char *name = "rstuvwxy"; - // Specify the edges in the graph - typedef std::pair < int, int >E; - 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 - const int n_edges = sizeof(edge_array) / sizeof(E); -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ has trouble with the edge iterator constructor - graph_t g; - std::vector<graph_traits<graph_t>::vertex_descriptor> verts; - for (std::size_t i = 0; i < N; ++i) - verts.push_back(add_vertex(g)); - 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; - graph_t g(edge_array, edge_array + n_edges, v_size_t(N)); -#endif - - // Typedefs - typedef graph_traits<graph_t>::vertex_descriptor Vertex; - typedef graph_traits<graph_t>::vertices_size_type Size; - typedef Size* Iiter; - - Size time = 0; - typedef property_map<graph_t, std::size_t VertexProps::*>::type dtime_map_t; - dtime_map_t dtime_map = get(&VertexProps::discover_time, g); - bfs_time_visitor < dtime_map_t > vis(dtime_map, time); - breadth_first_search(g, vertex(s, g), color_map(get(&VertexProps::color, g)). - visitor(vis)); - - // a vector to hold the discover time property for each vertex - std::vector < Size > dtime(num_vertices(g)); - graph_traits<graph_t>::vertex_iterator vi, vi_end; - std::size_t c = 0; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi, ++c) - dtime[c] = dtime_map[*vi]; - - // Use std::sort to order the vertices by their discover time - std::vector<graph_traits<graph_t>::vertices_size_type > discover_order(N); - integer_range < int >range(0, N); - std::copy(range.begin(), range.end(), discover_order.begin()); - std::sort(discover_order.begin(), discover_order.end(), - indirect_cmp < Iiter, std::less < Size > >(&dtime[0])); - - std::cout << "order of discovery: "; - for (int i = 0; i < N; ++i) - std::cout << name[discover_order[i]] << " "; - std::cout << std::endl; - - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/bfs-name-printer.cpp b/Utilities/BGL/boost/graph/example/bfs-name-printer.cpp deleted file mode 100644 index eba6dc4327003dd23e5b494d1bfbcfd7454102fd..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/bfs-name-printer.cpp +++ /dev/null @@ -1,94 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <fstream> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/breadth_first_search.hpp> -using namespace boost; - -template <typename Graph, typename VertexNameMap, typename TransDelayMap> -void -build_router_network(Graph & g, VertexNameMap name_map, - TransDelayMap delay_map) -{ - typename graph_traits < Graph >::vertex_descriptor a, b, c, d, e; - a = add_vertex(g); - name_map[a] = 'a'; - b = add_vertex(g); - name_map[b] = 'b'; - c = add_vertex(g); - name_map[c] = 'c'; - d = add_vertex(g); - name_map[d] = 'd'; - e = add_vertex(g); - name_map[e] = 'e'; - - typename graph_traits<Graph>::edge_descriptor ed; - bool inserted; - - tie(ed, inserted) = add_edge(a, b, g); - delay_map[ed] = 1.2; - tie(ed, inserted) = add_edge(a, d, g); - delay_map[ed] = 4.5; - tie(ed, inserted) = add_edge(b, d, g); - delay_map[ed] = 1.8; - tie(ed, inserted) = add_edge(c, a, g); - delay_map[ed] = 2.6; - tie(ed, inserted) = add_edge(c, e, g); - delay_map[ed] = 5.2; - tie(ed, inserted) = add_edge(d, c, g); - delay_map[ed] = 0.4; - tie(ed, inserted) = add_edge(d, e, g); - delay_map[ed] = 3.3; -} - - -template <typename VertexNameMap> -class bfs_name_printer : public default_bfs_visitor { - // inherit default (empty) event point actions -public: - bfs_name_printer(VertexNameMap n_map) : m_name_map(n_map) { - } - template <typename Vertex, typename Graph> - void discover_vertex(Vertex u, const Graph &) const - { - std::cout << get(m_name_map, u) << ' '; - } -private: - VertexNameMap m_name_map; -}; - -struct VP { - char name; -}; - -struct EP { - double weight; -}; - - -int -main() -{ - typedef adjacency_list < listS, vecS, directedS, VP, EP> graph_t; - graph_t g; - - property_map<graph_t, char VP::*>::type name_map = get(&VP::name, g); - property_map<graph_t, double EP::*>::type delay_map = get(&EP::weight, g); - - build_router_network(g, name_map, delay_map); - - typedef property_map<graph_t, char VP::*>::type VertexNameMap; - graph_traits<graph_t>::vertex_descriptor a = *vertices(g).first; - bfs_name_printer<VertexNameMap> vis(name_map); - std::cout << "BFS vertex discover order: "; - breadth_first_search(g, a, visitor(vis)); - std::cout << std::endl; - -} diff --git a/Utilities/BGL/boost/graph/example/bfs.cpp b/Utilities/BGL/boost/graph/example/bfs.cpp deleted file mode 100644 index 71b120084a64e9b86ad574d45786ad799465074a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/bfs.cpp +++ /dev/null @@ -1,160 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#include <boost/config.hpp> - -#include <algorithm> -#include <vector> -#include <utility> -#include <iostream> - -#include <boost/graph/visitors.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/breadth_first_search.hpp> -#include <boost/property_map.hpp> -#include <boost/graph/graph_utility.hpp> - -/* - - This examples shows how to use the breadth_first_search() GGCL - algorithm, specifically the 3 argument variant of bfs that assumes - the graph has a color property (property) stored internally. - - Two pre-defined visitors are used to record the distance of each - vertex from the source vertex, and also to record the parent of each - vertex. Any number of visitors can be layered and passed to a GGCL - algorithm. - - The call to vertices(G) returns an STL-compatible container which - contains all of the vertices in the graph. In this example we use - the vertices container in the STL for_each() function. - - Sample Output: - - 0 --> 2 - 1 --> 1 3 4 - 2 --> 1 3 4 - 3 --> 1 4 - 4 --> 0 1 - 0 --> 2 - 1 --> 1 3 4 - 2 --> 1 3 4 - 3 --> 1 4 - 4 --> 0 1 - distances: 0 2 1 2 2 - parent[0] = 0 - parent[1] = 2 - parent[2] = 0 - parent[3] = 2 - parent[4] = 2 - -*/ - -template <class ParentDecorator> -struct print_parent { - print_parent(const ParentDecorator& p_) : p(p_) { } - template <class Vertex> - void operator()(const Vertex& v) const { - std::cout << "parent[" << v << "] = " << p[v] << std::endl; - } - ParentDecorator p; -}; - - -template <class NewGraph, class Tag> -struct graph_copier - : public boost::base_visitor<graph_copier<NewGraph, Tag> > -{ - typedef Tag event_filter; - - graph_copier(NewGraph& graph) : new_g(graph) { } - - template <class Edge, class Graph> - void operator()(Edge e, Graph& g) { - boost::add_edge(boost::source(e, g), boost::target(e, g), new_g); - } -private: - NewGraph& new_g; -}; - -template <class NewGraph, class Tag> -inline graph_copier<NewGraph, Tag> -copy_graph(NewGraph& g, Tag) { - return graph_copier<NewGraph, Tag>(g); -} - -int main(int , char* []) -{ - typedef 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; - - Graph G(5); - boost::add_edge(0, 2, G); - boost::add_edge(1, 1, G); - boost::add_edge(1, 3, G); - boost::add_edge(1, 4, G); - boost::add_edge(2, 1, G); - boost::add_edge(2, 3, G); - boost::add_edge(2, 4, G); - boost::add_edge(3, 1, G); - boost::add_edge(3, 4, G); - boost::add_edge(4, 0, G); - boost::add_edge(4, 1, G); - - typedef Graph::vertex_descriptor Vertex; - - Graph G_copy(5); - // 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; - - // 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 - // a Decorator. - boost::graph_traits<Graph>::vertices_size_type d[5]; - std::fill_n(d, 5, 0); - - // The source vertex - Vertex s = *(boost::vertices(G).first); - p[s] = s; - boost::breadth_first_search - (G, s, - boost::visitor(boost::make_bfs_visitor - (std::make_pair(boost::record_distances(d, boost::on_tree_edge()), - std::make_pair - (boost::record_predecessors(&p[0], - boost::on_tree_edge()), - copy_graph(G_copy, boost::on_examine_edge())))) )); - - boost::print_graph(G); - boost::print_graph(G_copy); - - if (boost::num_vertices(G) < 11) { - std::cout << "distances: "; -#ifdef BOOST_OLD_STREAM_ITERATORS - std::copy(d, d + 5, std::ostream_iterator<int, char>(std::cout, " ")); -#else - std::copy(d, d + 5, std::ostream_iterator<int>(std::cout, " ")); -#endif - std::cout << std::endl; - - std::for_each(boost::vertices(G).first, boost::vertices(G).second, - print_parent<Piter>(&p[0])); - } - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/bfs.expected b/Utilities/BGL/boost/graph/example/bfs.expected deleted file mode 100644 index c58f0fb319e4b7ebe7496e6e297d1c236c9213c4..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/bfs.expected +++ /dev/null @@ -1,16 +0,0 @@ -0 --> 2 -1 --> 1 3 4 -2 --> 1 3 4 -3 --> 1 4 -4 --> 0 1 -0 --> 2 -1 --> 1 3 4 -2 --> 1 3 4 -3 --> 1 4 -4 --> 0 1 -distances: 0 2 1 2 2 -parent[0] = 0 -parent[1] = 2 -parent[2] = 0 -parent[3] = 2 -parent[4] = 2 diff --git a/Utilities/BGL/boost/graph/example/bfs_basics.expected b/Utilities/BGL/boost/graph/example/bfs_basics.expected deleted file mode 100644 index 6fc6c2dbd7b5de21ac5272480c087840c1ba36c4..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/bfs_basics.expected +++ /dev/null @@ -1,2 +0,0 @@ -order of discovery: s r w v t x u y -order of finish: s r w v t x u y diff --git a/Utilities/BGL/boost/graph/example/bfs_neighbor.cpp b/Utilities/BGL/boost/graph/example/bfs_neighbor.cpp deleted file mode 100644 index 5bac52b5ee55b5f2628f07b1a9bbfc33ec799a5c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/bfs_neighbor.cpp +++ /dev/null @@ -1,151 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#include <boost/config.hpp> - -#include <algorithm> -#include <vector> -#include <utility> -#include <iostream> - -#include <boost/graph/graph_utility.hpp> -#include <boost/graph/visitors.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/neighbor_bfs.hpp> -#include <boost/property_map.hpp> - -/* - - This examples shows how to use the breadth_first_search() GGCL - algorithm, specifically the 3 argument variant of bfs that assumes - the graph has a color property (property) stored internally. - - Two pre-defined visitors are used to record the distance of each - vertex from the source vertex, and also to record the parent of each - vertex. Any number of visitors can be layered and passed to a GGCL - algorithm. - - The call to vertices(G) returns an STL-compatible container which - contains all of the vertices in the graph. In this example we use - the vertices container in the STL for_each() function. - - Sample Output: - - 0 --> 2 - 1 --> 1 3 4 - 2 --> 1 3 4 - 3 --> 1 4 - 4 --> 0 1 - distances: 1 2 1 2 0 - parent[0] = 4 - parent[1] = 2 - parent[2] = 0 - parent[3] = 2 - parent[4] = 0 - -*/ - -template <class ParentDecorator> -struct print_parent { - print_parent(const ParentDecorator& p_) : p(p_) { } - template <class Vertex> - void operator()(const Vertex& v) const { - std::cout << "parent[" << v << "] = " << p[v] << std::endl; - } - ParentDecorator p; -}; - - -template <class NewGraph, class Tag> -struct graph_copier - : public boost::base_visitor<graph_copier<NewGraph, Tag> > -{ - typedef Tag event_filter; - - graph_copier(NewGraph& graph) : new_g(graph) { } - - template <class Edge, class Graph> - void operator()(Edge e, Graph& g) { - boost::add_edge(boost::source(e, g), boost::target(e, g), new_g); - } -private: - NewGraph& new_g; -}; - -template <class NewGraph, class Tag> -inline graph_copier<NewGraph, Tag> -copy_graph(NewGraph& g, Tag) { - return graph_copier<NewGraph, Tag>(g); -} - -int main(int , char* []) -{ - typedef 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; - - Graph G(5); - boost::add_edge(0, 2, G); - boost::add_edge(1, 1, G); - boost::add_edge(1, 3, G); - boost::add_edge(1, 4, G); - boost::add_edge(2, 1, G); - boost::add_edge(2, 3, G); - boost::add_edge(2, 4, G); - boost::add_edge(3, 1, G); - boost::add_edge(3, 4, G); - boost::add_edge(4, 0, G); - boost::add_edge(4, 1, G); - - typedef Graph::vertex_descriptor Vertex; - - // 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; - - // 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 - // a Decorator. - boost::graph_traits<Graph>::vertices_size_type d[5]; - std::fill_n(d, 5, 0); - - // The source vertex - Vertex s = *(boost::vertices(G).first); - p[s] = s; - boost::neighbor_breadth_first_search - (G, s, - boost::visitor(boost::make_neighbor_bfs_visitor - (std::make_pair(boost::record_distances(d, boost::on_tree_edge()), - boost::record_predecessors(&p[0], - boost::on_tree_edge()))))); - - boost::print_graph(G); - - if (boost::num_vertices(G) < 11) { - std::cout << "distances: "; -#ifdef BOOST_OLD_STREAM_ITERATORS - std::copy(d, d + 5, std::ostream_iterator<int, char>(std::cout, " ")); -#else - std::copy(d, d + 5, std::ostream_iterator<int>(std::cout, " ")); -#endif - std::cout << std::endl; - - std::for_each(boost::vertices(G).first, boost::vertices(G).second, - print_parent<Piter>(&p[0])); - } - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/biconnected_components.cpp b/Utilities/BGL/boost/graph/example/biconnected_components.cpp deleted file mode 100644 index e05d32e3746cecf93e31f7e320f6205d61c7d581..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/biconnected_components.cpp +++ /dev/null @@ -1,73 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <vector> -#include <list> -#include <boost/graph/biconnected_components.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <iterator> -#include <iostream> - -namespace boost -{ - struct edge_component_t - { - enum - { num = 555 }; - typedef edge_property_tag kind; - } - 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; - graph_t g(9); - add_edge(0, 5, g); - add_edge(0, 1, g); - add_edge(0, 6, g); - add_edge(1, 2, g); - add_edge(1, 3, g); - add_edge(1, 4, g); - add_edge(2, 3, g); - add_edge(4, 5, g); - add_edge(6, 8, g); - add_edge(6, 7, g); - add_edge(7, 8, g); - - property_map < graph_t, edge_component_t >::type - component = get(edge_component, g); - - std::size_t num_comps = biconnected_components(g, component); - std::cerr << "Found " << num_comps << " biconnected components.\n"; - - std::vector<vertex_t> art_points; - articulation_points(g, std::back_inserter(art_points)); - std::cerr << "Found " << art_points.size() << " articulation points.\n"; - - std::cout << "graph A {\n" << " node[shape=\"circle\"]\n"; - - for (std::size_t i = 0; i < art_points.size(); ++i) { - std::cout << (char)(art_points[i] + 'A') - << " [ style=\"filled\", fillcolor=\"red\" ];" - << std::endl; - } - - graph_traits < graph_t >::edge_iterator ei, ei_end; - for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) - std::cout << (char)(source(*ei, g) + 'A') << " -- " - << (char)(target(*ei, g) + 'A') - << "[label=\"" << component[*ei] << "\"]\n"; - std::cout << "}\n"; - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/boost_web.dat b/Utilities/BGL/boost/graph/example/boost_web.dat deleted file mode 100644 index b52a03198b757585416b5b73419210b931d6820b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/boost_web.dat +++ /dev/null @@ -1,34 +0,0 @@ -www.boost.org|Libraries|Boost Libraries -www.boost.org|Home|www.boost.org -www.boost.org|More|More Information -www.boost.org|People|Boost People -www.boost.org|FAQ|Frequently Asked Questions -More Information|More|More Information -More Information|Header Dependencies|Boost Header Dependencies -More Information|Compiler Status|Compiler Status -More Information|Library Formal Review Process|Formal Review Process -More Information|Home|www.boost.org -More Information|FAQ|Frequently Asked Questions -More Information|People|Boost People -More Information|Libraries|Boost Libraries -Frequently Asked Questions|FAQ|Frequently Asked Questions -Frequently Asked Questions|Home|www.boost.org -Frequently Asked Questions|People|Boost People -Frequently Asked Questions|Library Guidlines|Boost Library Requirements and Guidelines -Frequently Asked Questions|License Requirements|Boost Library Requirements and Guidelines -Frequently Asked Questions|More|More Information -Frequently Asked Questions|Libraries|Boost Libraries -Boost People|Dave Abrahams|Dave Abrahams -Boost People|Darin Adler|Darin Adler -Boost People|More|More Information -Boost People|Home|www.boost.org -Boost People|FAQ|Frequently Asked Questions -Boost People|Libraries|Boost Libraries -Boost People|People|Boost People -Boost Libraries|call_traits|Call Traits -Boost Libraries|compose|Compose Library -Boost Libraries|graph|Boost Graph Library -Boost Libraries|property_map|Property Map Library -Boost Libraries|array|Array wrapper -Boost Libraries|Libraries|Boost Libraries -Boost Libraries|People|Boost Libraries diff --git a/Utilities/BGL/boost/graph/example/boost_web_graph.cpp b/Utilities/BGL/boost/graph/example/boost_web_graph.cpp deleted file mode 100644 index eec82184578216542109931dc1f9c5a6edf55c9c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/boost_web_graph.cpp +++ /dev/null @@ -1,213 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <fstream> -#include <string> -#include <algorithm> -#include <map> -#include <boost/pending/stringtok.hpp> -#include <boost/utility.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/visitors.hpp> -#include <boost/graph/breadth_first_search.hpp> -#include <boost/graph/depth_first_search.hpp> - - -template <class Distance> -class calc_distance_visitor : public boost::bfs_visitor<> -{ -public: - calc_distance_visitor(Distance d) : distance(d) { } - - template <class Graph> - void tree_edge(typename boost::graph_traits<Graph>::edge_descriptor e, - Graph& g) - { - typename boost::graph_traits<Graph>::vertex_descriptor u, v; - u = boost::source(e, g); - v = boost::target(e, g); - distance[v] = distance[u] + 1; - } -private: - Distance distance; -}; - - -template <class VertexNameMap, class DistanceMap> -class print_tree_visitor : public boost::dfs_visitor<> -{ -public: - print_tree_visitor(VertexNameMap n, DistanceMap d) : name(n), distance(d) { } - template <class Graph> - void - discover_vertex(typename boost::graph_traits<Graph>::vertex_descriptor v, - Graph&) - { - typedef typename boost::property_traits<DistanceMap>::value_type Dist; - // indentation based on depth - for (Dist i = 0; i < distance[v]; ++i) - std::cout << " "; - std::cout << name[v] << std::endl; - } - - template <class Graph> - void tree_edge(typename boost::graph_traits<Graph>::edge_descriptor e, - Graph& g) - { - distance[boost::target(e, g)] = distance[boost::source(e, g)] + 1; - } - -private: - VertexNameMap name; - DistanceMap distance; -}; - -int -main() -{ - using namespace boost; - - std::ifstream datafile("./boost_web.dat"); - if (!datafile) { - std::cerr << "No ./boost_web.dat file" << std::endl; - return -1; - } - - //=========================================================================== - // Declare the graph type and object, and some property maps. - - typedef 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; - - typedef graph_traits<Graph> Traits; - typedef Traits::vertex_descriptor Vertex; - typedef Traits::edge_descriptor Edge; - - typedef std::map<std::string, Vertex> NameVertexMap; - NameVertexMap name2vertex; - Graph g; - - typedef property_map<Graph, vertex_name_t>::type NameMap; - NameMap node_name = get(vertex_name, g); - property_map<Graph, edge_name_t>::type link_name = get(edge_name, g); - - //=========================================================================== - // Read the data file and construct the graph. - - std::string line; - while (std::getline(datafile,line)) { - - std::list<std::string> line_toks; - boost::stringtok(line_toks, line, "|"); - - NameVertexMap::iterator pos; - bool inserted; - Vertex u, v; - - std::list<std::string>::iterator i = line_toks.begin(); - - tie(pos, inserted) = name2vertex.insert(std::make_pair(*i, Vertex())); - if (inserted) { - u = add_vertex(g); - put(node_name, u, *i); - pos->second = u; - } else - u = pos->second; - ++i; - - std::string hyperlink_name = *i++; - - tie(pos, inserted) = name2vertex.insert(std::make_pair(*i, Vertex())); - if (inserted) { - v = add_vertex(g); - put(node_name, v, *i); - pos->second = v; - } else - v = pos->second; - - Edge e; - tie(e, inserted) = add_edge(u, v, g); - if (inserted) { - put(link_name, e, hyperlink_name); - } - } - - //=========================================================================== - // Calculate the diameter of the graph. - - typedef Traits::vertices_size_type size_type; - typedef std::vector<size_type> IntVector; - // Create N x N matrix for storing the shortest distances - // between each vertex. Initialize all distances to zero. - std::vector<IntVector> d_matrix(num_vertices(g), - IntVector(num_vertices(g), 0)); - - size_type i; - for (i = 0; i < num_vertices(g); ++i) { - calc_distance_visitor<size_type*> vis(&d_matrix[i][0]); - Traits::vertex_descriptor src = vertices(g).first[i]; - breadth_first_search(g, src, boost::visitor(vis)); - } - - size_type diameter = 0; - BOOST_USING_STD_MAX(); - for (i = 0; i < num_vertices(g); ++i) - diameter = max BOOST_PREVENT_MACRO_SUBSTITUTION(diameter, *std::max_element(d_matrix[i].begin(), - d_matrix[i].end())); - - std::cout << "The diameter of the boost web-site graph is " << diameter - << std::endl << std::endl; - - std::cout << "Number of clicks from the home page: " << std::endl; - Traits::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) - std::cout << d_matrix[0][*vi] << "\t" << node_name[*vi] << std::endl; - std::cout << std::endl; - - //=========================================================================== - // Print out the breadth-first search tree starting at the home page - - // Create storage for a mapping from vertices to their parents - std::vector<Traits::vertex_descriptor> parent(num_vertices(g)); - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) - parent[*vi] = *vi; - - // Do a BFS starting at the home page, recording the parent of each - // vertex (where parent is with respect to the search tree). - Traits::vertex_descriptor src = vertices(g).first[0]; - breadth_first_search - (g, src, - boost::visitor(make_bfs_visitor(record_predecessors(&parent[0], - on_tree_edge())))); - - // Add all the search tree edges into a new graph - Graph search_tree(num_vertices(g)); - tie(vi, vi_end) = vertices(g); - ++vi; - for (; vi != vi_end; ++vi) - add_edge(parent[*vi], *vi, search_tree); - - std::cout << "The breadth-first search tree:" << std::endl; - - // Print out the search tree. We use DFS because it visits - // the tree nodes in the order that we want to print out: - // a directory-structure like format. - std::vector<size_type> dfs_distances(num_vertices(g), 0); - print_tree_visitor<NameMap, size_type*> - tree_printer(node_name, &dfs_distances[0]); - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) - get(vertex_color, g)[*vi] = white_color; - depth_first_visit(search_tree, src, tree_printer, get(vertex_color, g)); - - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/boost_web_graph.expected b/Utilities/BGL/boost/graph/example/boost_web_graph.expected deleted file mode 100644 index b79bbf47dcebd552f44fe5da0a82aced79a60cc7..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/boost_web_graph.expected +++ /dev/null @@ -1,37 +0,0 @@ -The diameter of the boost web-site graph is 2 - -Number of clicks from the home page: -0 www.boost.org -1 Boost Libraries -1 More Information -1 Boost People -1 Frequently Asked Questions -2 Boost Header Dependencies -2 Compiler Status -2 Formal Review Process -2 Boost Library Requirements and Guidelines -2 Dave Abrahams -2 Darin Adler -2 Call Traits -2 Compose Library -2 Boost Graph Library -2 Property Map Library -2 Array wrapper - -The breadth-first search tree: -www.boost.org - Boost Libraries - Call Traits - Compose Library - Boost Graph Library - Property Map Library - Array wrapper - More Information - Boost Header Dependencies - Compiler Status - Formal Review Process - Boost People - Dave Abrahams - Darin Adler - Frequently Asked Questions - Boost Library Requirements and Guidelines diff --git a/Utilities/BGL/boost/graph/example/bucket_sorter.cpp b/Utilities/BGL/boost/graph/example/bucket_sorter.cpp deleted file mode 100644 index 0b5ca055d05d820575ba674eab52770c0a3e035e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/bucket_sorter.cpp +++ /dev/null @@ -1,108 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <vector> -#include <iostream> - -#include <stdlib.h> -#include <boost/pending/bucket_sorter.hpp> - -template <class Integral> -struct trivial_id { - std::size_t operator[](Integral i) { - return i; - } - std::size_t operator[](Integral i) const { - return i; - } -}; - - -int main() { - using namespace std; - using boost::bucket_sorter; - - const std::size_t N = 10; - - vector<std::size_t> bucket(N); - for (std::size_t i=0; i<N; i++) { - bucket[i] = rand() % N; - cout.width(6); - cout << "Number " << i << " has its bucket " << bucket[i] << endl; - } - - typedef trivial_id<int> ID; - typedef bucket_sorter<std::size_t, int, - vector<std::size_t>::iterator, ID> BS; - BS my_bucket_sorter(N, N, bucket.begin()); - - for (std::size_t ii=0; ii<N; ii++) - my_bucket_sorter.push(ii); - - std::size_t j; - for (j=0; j<N; j++) { - cout << "The bucket " << j; - if ( ! my_bucket_sorter[j].empty() ) { - cout << " has number "; - do { - int v = my_bucket_sorter[j].top(); - my_bucket_sorter[j].pop(); - cout << v << " "; - } while ( ! my_bucket_sorter[j].empty() ); - cout << endl; - } else { - cout << " has no number associated with." << endl; - } - } - - for (std::size_t k=0; k<N; k++) - my_bucket_sorter.push(k); - - my_bucket_sorter.remove(5); - my_bucket_sorter.remove(7); - - cout << "Afer remove number 5 and 7, check correctness again." << endl; - - for (j=0; j<N; j++) { - cout << "The bucket " << j; - if ( ! my_bucket_sorter[j].empty() ) { - cout << " has number "; - do { - int v = my_bucket_sorter[j].top(); - my_bucket_sorter[j].pop(); - cout << v << " "; - } while ( ! my_bucket_sorter[j].empty() ); - cout << endl; - } else { - cout << " has no number associated with." << endl; - } - } - - std::size_t iii; - for (iii=0; iii<N; iii++) { - std::size_t current = rand() % N; - if ( ! my_bucket_sorter[current].empty() ) { - int v = my_bucket_sorter[current].top(); - my_bucket_sorter[current].pop(); - bucket[v] = rand() % N; - my_bucket_sorter.push(v); - } - } - - for (iii=0; iii<N; iii++) { - std::size_t current = rand() % N; - if ( ! my_bucket_sorter[current].empty() ) { - int v = my_bucket_sorter[current].top(); - bucket[v] = rand() % N; - my_bucket_sorter.update(v); - } - } - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/cc-internet.cpp b/Utilities/BGL/boost/graph/example/cc-internet.cpp deleted file mode 100644 index dbd29f0e5929a066d1f015e7a466dff913384beb..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/cc-internet.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <fstream> -#include <vector> -#include <string> -#include <boost/graph/connected_components.hpp> -#include <boost/graph/graphviz.hpp> - -int -main() -{ - using namespace boost; - GraphvizGraph g; - read_graphviz("figs/cc-internet.dot", g); - - std::vector<int> component(num_vertices(g)); - - connected_components - (g, make_iterator_property_map(component.begin(), - get(vertex_index, g), component[0])); - - property_map < GraphvizGraph, vertex_attribute_t >::type - vertex_attr_map = get(vertex_attribute, g); - std::string color[] = { - "white", "gray", "black", "lightgray"}; - graph_traits < GraphvizGraph >::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { - vertex_attr_map[*vi]["color"] = color[component[*vi]]; - vertex_attr_map[*vi]["style"] = "filled"; - if (vertex_attr_map[*vi]["color"] == "black") - vertex_attr_map[*vi]["fontcolor"] = "white"; - } - write_graphviz("figs/cc-internet-out.dot", g); - -} diff --git a/Utilities/BGL/boost/graph/example/city_visitor.cpp b/Utilities/BGL/boost/graph/example/city_visitor.cpp deleted file mode 100644 index 44a4a09c3f7b435776b35646821b702904004718..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/city_visitor.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -// - -#include <boost/config.hpp> -#include <iostream> -#include <vector> -#include <string> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/depth_first_search.hpp> -#include <boost/graph/breadth_first_search.hpp> -#include <boost/property_map.hpp> -#include <boost/graph/graph_utility.hpp> // for boost::make_list - - -/* - Example of using a visitor with the depth first search - and breadth first search algorithm - - Sacramento ---- Reno ---- Salt Lake City - | - San Francisco - | - San Jose ---- Fresno - | - Los Angeles ---- Las Vegas ---- Phoenix - | - San Diego - - - The visitor has three main functions: - - discover_vertex(u,g) is invoked when the algorithm first arrives at the - vertex u. This will happen in the depth first or breadth first - order depending on which algorithm you use. - - examine_edge(e,g) is invoked when the algorithm first checks an edge to see - whether it has already been there. Whether using BFS or DFS, all - the edges of vertex u are examined immediately after the call to - visit(u). - - finish_vertex(u,g) is called when after all the vertices reachable from vertex - u have already been visited. - - */ - -using namespace std; -using namespace boost; - - -struct city_arrival : public base_visitor<city_arrival> -{ - city_arrival(string* n) : names(n) { } - typedef on_discover_vertex event_filter; - template <class Vertex, class Graph> - inline void operator()(Vertex u, Graph&) { - cout << endl << "arriving at " << names[u] << endl - << " neighboring cities are: "; - } - string* names; -}; - -struct neighbor_cities : public base_visitor<neighbor_cities> -{ - neighbor_cities(string* n) : names(n) { } - typedef on_examine_edge event_filter; - template <class Edge, class Graph> - inline void operator()(Edge e, Graph& g) { - cout << names[ target(e, g) ] << ", "; - } - string* names; -}; - -struct finish_city : public base_visitor<finish_city> -{ - finish_city(string* n) : names(n) { } - typedef on_finish_vertex event_filter; - template <class Vertex, class Graph> - inline void operator()(Vertex u, Graph&) { - cout << endl << "finished with " << names[u] << endl; - } - string* names; -}; - -int main(int, char*[]) -{ - - enum { SanJose, SanFran, LA, SanDiego, Fresno, LasVegas, Reno, - Sacramento, SaltLake, Phoenix, N }; - - string names[] = { "San Jose", "San Francisco", "Los Angeles", "San Diego", - "Fresno", "Las Vegas", "Reno", "Sacramento", - "Salt Lake City", "Phoenix" }; - - typedef std::pair<int,int> E; - 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; -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ has trouble with the edge iterator constructor - Graph G(N); - for (std::size_t j = 0; j < sizeof(edge_array)/sizeof(E); ++j) - add_edge(edge_array[j].first, edge_array[j].second, G); -#else - Graph G(edge_array, edge_array + sizeof(edge_array)/sizeof(E), N); -#endif - - cout << "*** Depth First ***" << endl; - depth_first_search - (G, - visitor(make_dfs_visitor(boost::make_list(city_arrival(names), - neighbor_cities(names), - finish_city(names))))); - cout << endl; - - /* Get the source vertex */ - boost::graph_traits<Graph>::vertex_descriptor - s = vertex(SanJose,G); - - cout << "*** Breadth First ***" << endl; - breadth_first_search - (G, s, visitor(make_bfs_visitor(boost::make_list(city_arrival(names), - neighbor_cities(names), - finish_city(names))))); - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/components_on_edgelist.cpp b/Utilities/BGL/boost/graph/example/components_on_edgelist.cpp deleted file mode 100644 index 1d76fc0e4678d9a4b39f0626ab4f984efd844140..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/components_on_edgelist.cpp +++ /dev/null @@ -1,94 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <iterator> -#include <vector> -#include <algorithm> -#include <utility> -#include <boost/graph/edge_list.hpp> -#include <boost/graph/incremental_components.hpp> -#include <boost/pending/disjoint_sets.hpp> -#include <boost/utility.hpp> -#include <boost/graph/graph_utility.hpp> - -/* - - This example demonstrates the usage of the - connected_components_on_edgelist algorithm. This differs from the - connect_components algorithm in that the graph object - only needs to provide access to the "list" of edges (via the - edges() function). - - The example graphs come from "Introduction to - Algorithms", Cormen, Leiserson, and Rivest p. 87 (though we number - the vertices from zero instead of one). - - Sample output: - - An undirected graph (edge list): - (0,1) (1,4) (4,0) (2,5) - Total number of components: 3 - Vertex 0 is in the component who's representative is 1 - Vertex 1 is in the component who's representative is 1 - Vertex 2 is in the component who's representative is 5 - Vertex 3 is in the component who's representative is 3 - Vertex 4 is in the component who's representative is 1 - Vertex 5 is in the component who's representative is 5 - - component 0 contains: 4 1 0 - component 1 contains: 3 - component 2 contains: 5 2 - - */ - - -using namespace std; -using boost::tie; - -int main(int , char* []) -{ - using namespace boost; - typedef int Index; // ID of a Vertex - typedef pair<Index,Index> Edge; - const int N = 6; - const int E = 4; - Edge edgelist[] = { Edge(0, 1), Edge(1, 4), Edge(4, 0), Edge(2, 5) }; - - - - edge_list<Edge*,Edge,ptrdiff_t,std::random_access_iterator_tag> g(edgelist, edgelist + E); - cout << "An undirected graph (edge list):" << endl; - print_edges(g, identity_property_map()); - cout << endl; - - disjoint_sets_with_storage<> ds; - incremental_components(g, ds); - - component_index<int> components(&ds.parents()[0], - &ds.parents()[0] + ds.parents().size()); - - cout << "Total number of components: " << components.size() << endl; - for (int k = 0; k != N; ++k) - cout << "Vertex " << k << " is in the component who's representative is " - << ds.find_set(k) << endl; - cout << endl; - - for (component_index<int>::size_type i = 0; i < components.size(); ++i) { - cout << "component " << i << " contains: "; - component_index<int>::value_type::iterator - j = components[i].begin(), - jend = components[i].end(); - for ( ; j != jend; ++j) - cout << *j << " "; - cout << endl; - } - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/components_on_edgelist.expected b/Utilities/BGL/boost/graph/example/components_on_edgelist.expected deleted file mode 100644 index bb12dd332499735ad5b4cfc3745aa85f03248a43..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/components_on_edgelist.expected +++ /dev/null @@ -1,14 +0,0 @@ -An undirected graph (edge list): -(0,1) (1,4) (4,0) (2,5) - -Total number of components: 3 -Vertex 0 is in the component who's representative is 1 -Vertex 1 is in the component who's representative is 1 -Vertex 2 is in the component who's representative is 5 -Vertex 3 is in the component who's representative is 3 -Vertex 4 is in the component who's representative is 1 -Vertex 5 is in the component who's representative is 5 - -component 0 contains: 4 1 0 -component 1 contains: 3 -component 2 contains: 5 2 diff --git a/Utilities/BGL/boost/graph/example/concept_checks.expected b/Utilities/BGL/boost/graph/example/concept_checks.expected deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/Utilities/BGL/boost/graph/example/connected-components.cpp b/Utilities/BGL/boost/graph/example/connected-components.cpp deleted file mode 100644 index b07f3db033ee69b2b631d6df4375c4737d107fd4..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/connected-components.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <vector> -#include <boost/graph/connected_components.hpp> -#include <boost/graph/adjacency_list.hpp> - -int -main() -{ - using namespace boost; - typedef adjacency_list < vecS, vecS, undirectedS > Graph; - typedef graph_traits < Graph >::vertex_descriptor Vertex; - - const int N = 6; - Graph G(N); - add_edge(0, 1, G); - add_edge(1, 4, G); - add_edge(4, 0, G); - add_edge(2, 5, G); - - std::vector<int> c(num_vertices(G)); - int num = connected_components - (G, make_iterator_property_map(c.begin(), get(vertex_index, G), c[0])); - - std::cout << std::endl; - std::vector < int >::iterator i; - std::cout << "Total number of components: " << num << std::endl; - for (i = c.begin(); i != c.end(); ++i) - std::cout << "Vertex " << i - c.begin() - << " is in component " << *i << std::endl; - std::cout << std::endl; - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/connected_components.cpp b/Utilities/BGL/boost/graph/example/connected_components.cpp deleted file mode 100644 index 0d9102bb92d1d30ce0a0a63c7c67dc2febafd8b9..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/connected_components.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#include <boost/config.hpp> -#include <iostream> -#include <vector> -#include <algorithm> -#include <utility> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/connected_components.hpp> - -/* - - This example demonstrates the usage of the connected_components - algorithm on a undirected graph. The example graphs come from - "Introduction to Algorithms", Cormen, Leiserson, and Rivest p. 87 - (though we number the vertices from zero instead of one). - - Sample output: - - Total number of components: 3 - Vertex 0 is in component 0 - Vertex 1 is in component 0 - Vertex 2 is in component 1 - Vertex 3 is in component 2 - Vertex 4 is in component 0 - Vertex 5 is in component 1 - - */ - -using namespace std; - -int main(int , char* []) -{ - using namespace boost; - { - typedef adjacency_list <vecS, vecS, undirectedS> Graph; - - Graph G; - add_edge(0, 1, G); - add_edge(1, 4, G); - add_edge(4, 0, G); - add_edge(2, 5, G); - - std::vector<int> component(num_vertices(G)); - int num = connected_components(G, &component[0]); - - std::vector<int>::size_type i; - cout << "Total number of components: " << num << endl; - for (i = 0; i != component.size(); ++i) - cout << "Vertex " << i <<" is in component " << component[i] << endl; - cout << endl; - } - return 0; -} - diff --git a/Utilities/BGL/boost/graph/example/connected_components.expected b/Utilities/BGL/boost/graph/example/connected_components.expected deleted file mode 100644 index 862d934754b4d8272e59ca3886c0fc285b3fa16a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/connected_components.expected +++ /dev/null @@ -1,8 +0,0 @@ -Total number of components: 3 -Vertex 0 is in component 0 -Vertex 1 is in component 0 -Vertex 2 is in component 1 -Vertex 3 is in component 2 -Vertex 4 is in component 0 -Vertex 5 is in component 1 - diff --git a/Utilities/BGL/boost/graph/example/container_gen.cpp b/Utilities/BGL/boost/graph/example/container_gen.cpp deleted file mode 100644 index 298e3a62f13e06e424d110f4cd9b12483a97d01d..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/container_gen.cpp +++ /dev/null @@ -1,47 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/graph/adjacency_list.hpp> - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_STD_ALLOCATOR) - -template <class Allocator> -struct list_with_allocatorS { }; - -namespace boost { - template <class Alloc, class ValueType> - struct container_gen<list_with_allocatorS<Alloc>, ValueType> { - typedef typename Alloc::template rebind<ValueType>::other Allocator; - typedef std::list<ValueType, Allocator> type; - }; - template <class Alloc> - struct parallel_edge_traits< list_with_allocatorS<Alloc> > { - typedef allow_parallel_edge_tag type; - }; - -} - -// 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; - -int main(int, char*[]) -{ - MyGraph g(5); - - return 0; -} - -#else - -int main(int, char*[]) -{ - return 0; -} - -#endif diff --git a/Utilities/BGL/boost/graph/example/container_gen.expected b/Utilities/BGL/boost/graph/example/container_gen.expected deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/Utilities/BGL/boost/graph/example/copy-example.cpp b/Utilities/BGL/boost/graph/example/copy-example.cpp deleted file mode 100644 index b2af240efcd10d3132c98d25fd3f487b67667eb3..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/copy-example.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <boost/graph/copy.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graph_utility.hpp> - -int -main() -{ - using namespace boost; - typedef int weight_t; - typedef adjacency_list < vecS, vecS, directedS, - property < vertex_name_t, char > > graph_t; - - enum - { a, b, c, d, e, f, g, N }; - graph_t G(N); - property_map < graph_t, vertex_name_t >::type - name_map = get(vertex_name, G); - char name = 'a'; - graph_traits < graph_t >::vertex_iterator v, v_end; - for (tie(v, v_end) = vertices(G); v != v_end; ++v, ++name) - name_map[*v] = name; - - typedef std::pair < int, int >E; - 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) - add_edge(edges[i].first, edges[i].second, G); - - print_graph(G, name_map); - std::cout << std::endl; - - graph_t G_copy; - copy_graph(G, G_copy); - - print_graph(G_copy, name_map); - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/cuthill_mckee_ordering.cpp b/Utilities/BGL/boost/graph/example/cuthill_mckee_ordering.cpp deleted file mode 100644 index 11a6de36d556a1b96c5ee2cd88bb56aa0789cae8..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/cuthill_mckee_ordering.cpp +++ /dev/null @@ -1,147 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// Doug Gregor, D. Kevin McGrath -// -// This file is part of the Boost Graph Library -// -// You should have received a copy of the License Agreement for the -// Boost Graph Library along with the software; see the file LICENSE. -// If not, contact Office of Research, University of Notre Dame, Notre -// Dame, IN 46556. -// -// Permission to modify the code and to distribute modified code is -// granted, provided the text of this NOTICE is retained, a notice that -// the code was modified is included with the above COPYRIGHT NOTICE and -// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE -// file is distributed with the modified code. -// -// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. -// By way of example, but not limitation, Licensor MAKES NO -// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY -// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS -// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS -// OR OTHER RIGHTS. -//======================================================================= - -#include <boost/config.hpp> -#include <vector> -#include <iostream> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/cuthill_mckee_ordering.hpp> -#include <boost/graph/properties.hpp> -#include <boost/graph/bandwidth.hpp> - -/* - Sample Output - original bandwidth: 8 - Reverse Cuthill-McKee ordering starting at: 6 - 8 3 0 9 2 5 1 4 7 6 - bandwidth: 4 - Reverse Cuthill-McKee ordering starting at: 0 - 9 1 4 6 7 2 8 5 3 0 - bandwidth: 4 - Reverse Cuthill-McKee ordering: - 0 8 5 7 3 6 4 2 1 9 - bandwidth: 4 - */ -int main(int , char* []) -{ - using namespace boost; - using namespace std; - typedef 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; - - typedef std::pair<std::size_t, std::size_t> Pair; - Pair edges[14] = { Pair(0,3), //a-d - Pair(0,5), //a-f - Pair(1,2), //b-c - Pair(1,4), //b-e - Pair(1,6), //b-g - Pair(1,9), //b-j - Pair(2,3), //c-d - Pair(2,4), //c-e - Pair(3,5), //d-f - Pair(3,8), //d-i - Pair(4,6), //e-g - Pair(5,6), //f-g - Pair(5,7), //f-h - Pair(6,7) }; //g-h - - Graph G(10); - for (int i = 0; i < 14; ++i) - add_edge(edges[i].first, edges[i].second, G); - - graph_traits<Graph>::vertex_iterator ui, ui_end; - - property_map<Graph,vertex_degree_t>::type deg = get(vertex_degree, G); - for (boost::tie(ui, ui_end) = vertices(G); ui != ui_end; ++ui) - deg[*ui] = degree(*ui, G); - - property_map<Graph, vertex_index_t>::type - index_map = get(vertex_index, G); - - std::cout << "original bandwidth: " << bandwidth(G) << std::endl; - - std::vector<Vertex> inv_perm(num_vertices(G)); - std::vector<size_type> perm(num_vertices(G)); - { - Vertex s = vertex(6, G); - //reverse cuthill_mckee_ordering - cuthill_mckee_ordering(G, s, inv_perm.rbegin(), get(vertex_color, G), - get(vertex_degree, G)); - cout << "Reverse Cuthill-McKee ordering starting at: " << s << endl; - cout << " "; - for (std::vector<Vertex>::const_iterator i = inv_perm.begin(); - i != inv_perm.end(); ++i) - cout << index_map[*i] << " "; - cout << endl; - - for (size_type c = 0; c != inv_perm.size(); ++c) - perm[index_map[inv_perm[c]]] = c; - std::cout << " bandwidth: " - << bandwidth(G, make_iterator_property_map(&perm[0], index_map, perm[0])) - << std::endl; - } - { - Vertex s = vertex(0, G); - //reverse cuthill_mckee_ordering - cuthill_mckee_ordering(G, s, inv_perm.rbegin(), get(vertex_color, G), - get(vertex_degree, G)); - cout << "Reverse Cuthill-McKee ordering starting at: " << s << endl; - cout << " "; - for (std::vector<Vertex>::const_iterator i=inv_perm.begin(); - i != inv_perm.end(); ++i) - cout << index_map[*i] << " "; - cout << endl; - - for (size_type c = 0; c != inv_perm.size(); ++c) - perm[index_map[inv_perm[c]]] = c; - std::cout << " bandwidth: " - << bandwidth(G, make_iterator_property_map(&perm[0], index_map, perm[0])) - << std::endl; - } - - { - //reverse cuthill_mckee_ordering - cuthill_mckee_ordering(G, inv_perm.rbegin(), get(vertex_color, G), - make_degree_map(G)); - - cout << "Reverse Cuthill-McKee ordering:" << endl; - cout << " "; - for (std::vector<Vertex>::const_iterator i=inv_perm.begin(); - i != inv_perm.end(); ++i) - cout << index_map[*i] << " "; - cout << endl; - - for (size_type c = 0; c != inv_perm.size(); ++c) - perm[index_map[inv_perm[c]]] = c; - std::cout << " bandwidth: " - << bandwidth(G, make_iterator_property_map(&perm[0], index_map, perm[0])) - << std::endl; - } - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/cuthill_mckee_ordering.expected b/Utilities/BGL/boost/graph/example/cuthill_mckee_ordering.expected deleted file mode 100644 index 42fc655a3c58cfe31b6e9b27a00f38da1d743579..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/cuthill_mckee_ordering.expected +++ /dev/null @@ -1,8 +0,0 @@ -degree: -2 4 3 4 3 4 4 2 1 1 -Reverse Cuthill-McKee ordering starting at :6 -8 3 0 9 2 5 1 4 7 6 -Reverse Cuthill-McKee ordering starting at :0 -9 1 4 6 7 2 8 5 3 0 -Reverse Cuthill-McKee ordering: -0 8 5 7 3 6 4 2 1 9 diff --git a/Utilities/BGL/boost/graph/example/cycle-file-dep.cpp b/Utilities/BGL/boost/graph/example/cycle-file-dep.cpp deleted file mode 100644 index 210cb80d638e294cf5e288888abf041dbe9a9a12..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/cycle-file-dep.cpp +++ /dev/null @@ -1,93 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <fstream> -#include <iostream> -#include <string> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graph_utility.hpp> - -using namespace boost; - -namespace std -{ - template < typename T > - std::istream & operator >> (std::istream & in, std::pair < T, T > &p) - { - in >> p.first >> p.second; - return in; - } -} - -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; - -typedef graph_traits < file_dep_graph >::vertex_descriptor vertex_t; -typedef graph_traits < file_dep_graph >::edge_descriptor edge_t; - -bool -has_cycle_dfs(const file_dep_graph & g, vertex_t u, - default_color_type * color) -{ - color[u] = gray_color; - graph_traits < file_dep_graph >::adjacency_iterator vi, vi_end; - for (tie(vi, vi_end) = adjacent_vertices(u, g); vi != vi_end; ++vi) - if (color[*vi] == white_color) - if (has_cycle_dfs(g, *vi, color)) - return true; // cycle detected, return immediately - else if (color[*vi] == gray_color) // *vi is an ancestor! - return true; - color[u] = black_color; - return false; -} - -bool -has_cycle(const file_dep_graph & g) -{ - std::vector < default_color_type > color(num_vertices(g), white_color); - graph_traits < file_dep_graph >::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) - if (color[*vi] == white_color) - if (has_cycle_dfs(g, *vi, &color[0])) - return true; - return false; -} - - -int -main() -{ - std::ifstream file_in("makefile-dependencies.dat"); - typedef graph_traits < file_dep_graph >::vertices_size_type 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(file_in), input_end; -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ has trouble with the edge iterator constructor - file_dep_graph g(n_vertices); - while (input_begin != input_end) { - size_type i, j; - tie(i, j) = *input_begin++; - add_edge(i, j, g); - } -#else - file_dep_graph g(input_begin, input_end, n_vertices); -#endif - - std::vector < std::string > name(num_vertices(g)); - std::ifstream name_in("makefile-target-names.dat"); - graph_traits < file_dep_graph >::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) - name_in >> name[*vi]; - - assert(has_cycle(g) == false); - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/cycle-file-dep2.cpp b/Utilities/BGL/boost/graph/example/cycle-file-dep2.cpp deleted file mode 100644 index 4f55da15df1e71b30ea368e34d3745f69ea14c2c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/cycle-file-dep2.cpp +++ /dev/null @@ -1,150 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <fstream> -#include <iostream> -#include <string> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graph_utility.hpp> - -// can't do using namespace boost because then -// we get conflict with boost::default_dfs_visitor. -using namespace boost; - -namespace std { - template <typename T > - std::istream& operator >> (std::istream & in, std::pair < T, T > &p) - { - in >> p.first >> p.second; - return - in; - } -} - -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; - -typedef graph_traits<file_dep_graph>::vertex_descriptor vertex_t; -typedef graph_traits<file_dep_graph>::edge_descriptor edge_t; - -template < typename Visitor > void -dfs_v1(const file_dep_graph & g, vertex_t u, default_color_type * color, - Visitor vis) -{ - color[u] = gray_color; - vis.discover_vertex(u, g); - graph_traits < file_dep_graph >::out_edge_iterator ei, ei_end; - for (tie(ei, ei_end) = out_edges(u, g); ei != ei_end; ++ei) { - if (color[target(*ei, g)] == white_color) { - vis.tree_edge(*ei, g); - dfs_v1(g, target(*ei, g), color, vis); - } else if (color[target(*ei, g)] == gray_color) - vis.back_edge(*ei, g); - else - vis.forward_or_cross_edge(*ei, g); - } - color[u] = black_color; - vis.finish_vertex(u, g); -} - -template < typename Visitor > void -generic_dfs_v1(const file_dep_graph & g, Visitor vis) -{ - std::vector < default_color_type > color(num_vertices(g), white_color); - graph_traits < file_dep_graph >::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { - if (color[*vi] == white_color) - dfs_v1(g, *vi, &color[0], vis); - } -} - -struct dfs_visitor_default -{ - template <typename V, typename G > void - discover_vertex(V, const G &) - { - } - - template <typename E, typename G > void - tree_edge(E, const G &) - { - } - - template < typename E, typename G > void - back_edge(E, const G &) - { - } - - template < typename E, typename G > void - forward_or_cross_edge(E, const G &) - { - } - - template < typename V, typename G > void - finish_vertex(V, const G &) - { - } -}; - -struct cycle_detector : public dfs_visitor_default -{ - cycle_detector(bool & cycle): - has_cycle(cycle) - { - } - void - back_edge(edge_t, const file_dep_graph &) - { - has_cycle = true; - } - bool & has_cycle; -}; - -bool -has_cycle(const file_dep_graph & g) -{ - bool has_cycle = false; - cycle_detector vis(has_cycle); - generic_dfs_v1(g, vis); - return has_cycle; -} - - -int -main() -{ - std::ifstream file_in("makefile-dependencies.dat"); - typedef graph_traits <file_dep_graph >::vertices_size_type 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(file_in), input_end; -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ has trouble with the edge iterator constructor - file_dep_graph g(n_vertices); - while (input_begin != input_end) { - size_type i, j; - tie(i, j) = *input_begin++; - add_edge(i, j, g); - } -#else - file_dep_graph g(input_begin, input_end, n_vertices); -#endif - - std::vector < std::string > name(num_vertices(g)); - std::ifstream name_in("makefile-target-names.dat"); - graph_traits < file_dep_graph >::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) - name_in >> name[*vi]; - - assert(has_cycle(g) == false); - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/dag_shortest_paths.cpp b/Utilities/BGL/boost/graph/example/dag_shortest_paths.cpp deleted file mode 100644 index b86896f10e3401a1f668902b0e4156fbe8b89c0e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/dag_shortest_paths.cpp +++ /dev/null @@ -1,69 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#include <boost/graph/dag_shortest_paths.hpp> -#include <boost/graph/adjacency_list.hpp> - -#include <iostream> - -// Example from Introduction to Algorithms by Cormen, et all p.537. - -// Sample output: -// r: inifinity -// s: 0 -// t: 2 -// u: 6 -// v: 5 -// x: 3 - -int main() -{ - using namespace boost; - typedef adjacency_list<vecS, vecS, directedS, - property<vertex_distance_t, int>, property<edge_weight_t, int> > graph_t; - graph_t g(6); - enum verts { r, s, t, u, v, x }; - char name[] = "rstuvx"; - add_edge(r, s, 5, g); - add_edge(r, t, 3, g); - add_edge(s, t, 2, g); - add_edge(s, u, 6, g); - add_edge(t, u, 7, g); - add_edge(t, v, 4, g); - add_edge(t, x, 2, g); - add_edge(u, v, -1, g); - add_edge(u, x, 1, g); - add_edge(v, x, -2, g); - - property_map<graph_t, vertex_distance_t>::type - d_map = get(vertex_distance, g); - -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ has trouble with the named-parameter mechanism, so - // we make a direct call to the underlying implementation function. - std::vector<default_color_type> color(num_vertices(g)); - std::vector<std::size_t> pred(num_vertices(g)); - default_dijkstra_visitor vis; - std::less<int> compare; - closed_plus<int> combine; - property_map<graph_t, edge_weight_t>::type w_map = get(edge_weight, g); - dag_shortest_paths(g, s, d_map, w_map, &color[0], &pred[0], - vis, compare, combine, (std::numeric_limits<int>::max)(), 0); -#else - dag_shortest_paths(g, s, distance_map(d_map)); -#endif - - graph_traits<graph_t>::vertex_iterator vi , vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) - if (d_map[*vi] == (std::numeric_limits<int>::max)()) - std::cout << name[*vi] << ": inifinity\n"; - else - std::cout << name[*vi] << ": " << d_map[*vi] << '\n'; - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/data1.txt b/Utilities/BGL/boost/graph/example/data1.txt deleted file mode 100644 index 502e66eb64124ee761bd78013322e2feada06c3f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/data1.txt +++ /dev/null @@ -1,7 +0,0 @@ -# five vertices -n 5 -# the edges -e -1 2 -0 1 -2 0 diff --git a/Utilities/BGL/boost/graph/example/data2.txt b/Utilities/BGL/boost/graph/example/data2.txt deleted file mode 100644 index 5c3d75a8d6e13fda4eb41c88f567a5d5f875429c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/data2.txt +++ /dev/null @@ -1,11 +0,0 @@ -# vertices -v -0 0.5 4.1 # -1 1.5 5.1 # second vertex -2 2.5 6.1 - -# the edges -e -1 2 0.1 -0 1 0.2 -1 0 0.3 diff --git a/Utilities/BGL/boost/graph/example/data3.txt b/Utilities/BGL/boost/graph/example/data3.txt deleted file mode 100644 index 76cd7b77e09191f1a5e0ed7558f0431bf9eb670e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/data3.txt +++ /dev/null @@ -1,7 +0,0 @@ -# vertices and edges can be interleaved -v 3.14 0 -v 3.15 1 -e 0 1 0.1 -e 1 0 1.0 -v 3.16 2 -e 1 2 1.2 diff --git a/Utilities/BGL/boost/graph/example/dave.cpp b/Utilities/BGL/boost/graph/example/dave.cpp deleted file mode 100644 index 04c69f888a31079eb75bd3a6562805e316fcece9..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/dave.cpp +++ /dev/null @@ -1,249 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <iterator> -#include <vector> -#include <list> -// Use boost::queue instead of std::queue because std::queue doesn't -// model Buffer; it has to top() function. -Jeremy -#include <boost/pending/queue.hpp> - -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/visitors.hpp> -#include <boost/graph/breadth_first_search.hpp> -#include <boost/graph/dijkstra_shortest_paths.hpp> -#include <boost/graph/graph_utility.hpp> - -using namespace std; -using namespace boost; -/* - This example does a best-first-search (using dijkstra's) and - simultaneously makes a copy of the graph (assuming the graph is - connected). - - Example Graph: (p. 90 "Data Structures and Network Algorithms", Tarjan) - - g - 3+ +2 - / 1 \ - e+----f - |+0 5++ - | \ / | - 10| d |12 - |8++\7| - +/ | +| - b 4| c - \ | + - 6+|/3 - a - - Sample Output: -a --> c d -b --> a d -c --> f -d --> c e f -e --> b g -f --> e g -g --> -Starting graph: -a(32767); c d -c(32767); f -d(32767); c e f -f(32767); e g -e(32767); b g -g(32767); -b(32767); a d -Result: -a(0); d c -d(4); f e c -c(3); f -f(9); g e -e(4); g b -g(7); -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; - -typedef adjacency_list<vecS, vecS, directedS, VProperty, EProperty > Graph; - - - -template <class Tag> -struct endl_printer - : public boost::base_visitor< endl_printer<Tag> > -{ - typedef Tag event_filter; - endl_printer(std::ostream& os) : m_os(os) { } - template <class T, class Graph> - void operator()(T, Graph&) { m_os << std::endl; } - std::ostream& m_os; -}; -template <class Tag> -endl_printer<Tag> print_endl(std::ostream& os, Tag) { - return endl_printer<Tag>(os); -} - -template <class PA, class Tag> -struct edge_printer - : public boost::base_visitor< edge_printer<PA, Tag> > -{ - typedef Tag event_filter; - - edge_printer(PA pa, std::ostream& os) : m_pa(pa), m_os(os) { } - - template <class T, class Graph> - void operator()(T x, Graph& g) { - m_os << "(" << get(m_pa, source(x, g)) << "," - << get(m_pa, target(x, g)) << ") "; - } - PA m_pa; - std::ostream& m_os; -}; -template <class PA, class Tag> -edge_printer<PA, Tag> -print_edge(PA pa, std::ostream& os, Tag) { - return edge_printer<PA, Tag>(pa, os); -} - - -template <class NewGraph, class Tag> -struct graph_copier - : public boost::base_visitor<graph_copier<NewGraph, Tag> > -{ - typedef Tag event_filter; - - graph_copier(NewGraph& graph) : new_g(graph) { } - - template <class Edge, class Graph> - void operator()(Edge e, Graph& g) { - add_edge(source(e, g), target(e, g), new_g); - } -private: - NewGraph& new_g; -}; -template <class NewGraph, class Tag> -inline graph_copier<NewGraph, Tag> -copy_graph(NewGraph& g, Tag) { - return graph_copier<NewGraph, Tag>(g); -} - -template <class Graph, class Name> -void print(Graph& G, Name name) -{ - typename boost::graph_traits<Graph>::vertex_iterator ui, uiend; - for (boost::tie(ui, uiend) = vertices(G); ui != uiend; ++ui) { - cout << name[*ui] << " --> "; - typename boost::graph_traits<Graph>::adjacency_iterator vi, viend; - for(boost::tie(vi, viend) = adjacent_vertices(*ui, G); vi != viend; ++vi) - cout << name[*vi] << " "; - cout << endl; - } - -} - - -int -main(int , char* []) -{ - // Name and ID numbers for the vertices - char name[] = "abcdefg"; - enum { a, b, c, d, e, f, g, N}; - - Graph G(N); - boost::property_map<Graph, vertex_index_t>::type - 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; - std::vector<Vertex> parent(N); - - typedef std::pair<int,int> E; - - 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) }; - - int weight[] = { 3, 4, - 6, 8, - 12, - 7, 0, 5, - 10, 3, - 1, 2 }; - - for (int i = 0; i < 12; ++i) - add_edge(edges[i].first, edges[i].second, weight[i], G); - - print(G, name); - - adjacency_list<listS, vecS, directedS, - property<vertex_color_t, default_color_type> > G_copy(N); - - cout << "Starting graph:" << endl; - - std::ostream_iterator<int> cout_int(std::cout, " "); - std::ostream_iterator<char> cout_char(std::cout, " "); - - boost::queue<Vertex> Q; - boost::breadth_first_search - (G, vertex(a, G), Q, - make_bfs_visitor( - boost::make_list - (write_property(make_iterator_property_map(name, vertex_id, - name[0]), - cout_char, on_examine_vertex()), - write_property(make_iterator_property_map(distance.begin(), - vertex_id, - distance[0]), - cout_int, on_examine_vertex()), - print_edge(make_iterator_property_map(name, vertex_id, - name[0]), - std::cout, on_examine_edge()), - print_endl(std::cout, on_finish_vertex()))), - get(vertex_color, G)); - - std::cout << "about to call dijkstra's" << std::endl; - - parent[vertex(a, G)] = vertex(a, G); - boost::dijkstra_shortest_paths - (G, vertex(a, G), - distance_map(make_iterator_property_map(distance.begin(), vertex_id, - distance[0])). - predecessor_map(make_iterator_property_map(parent.begin(), vertex_id, - parent[0])). - visitor(make_dijkstra_visitor(copy_graph(G_copy, on_examine_edge())))); - - cout << endl; - cout << "Result:" << endl; - boost::breadth_first_search - (G, vertex(a, G), - visitor(make_bfs_visitor( - boost::make_list - (write_property(make_iterator_property_map(name, vertex_id, - name[0]), - cout_char, on_examine_vertex()), - write_property(make_iterator_property_map(distance.begin(), - vertex_id, - distance[0]), - cout_int, on_examine_vertex()), - print_edge(make_iterator_property_map(name, vertex_id, - name[0]), - std::cout, on_examine_edge()), - print_endl(std::cout, on_finish_vertex()))))); - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/dave.expected b/Utilities/BGL/boost/graph/example/dave.expected deleted file mode 100644 index 65efe7b4b06c4b57d764bc198e6fd2c4a799275d..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/dave.expected +++ /dev/null @@ -1,24 +0,0 @@ -a --> c d -b --> a d -c --> f -d --> c e f -e --> b g -f --> e g -g --> -Starting graph: -a 2147483647 (a,c) (a,d) -c 2147483647 (c,f) -d 2147483647 (d,c) (d,e) (d,f) -f 2147483647 (f,e) (f,g) -e 2147483647 (e,b) (e,g) -g 2147483647 -b 2147483647 (b,a) (b,d) - -Result: -a 0 (a,c) (a,d) -c 3 (c,f) -d 4 (d,c) (d,e) (d,f) -f 9 (f,e) (f,g) -e 4 (e,b) (e,g) -g 7 -b 14 (b,a) (b,d) diff --git a/Utilities/BGL/boost/graph/example/default-constructor.cpp b/Utilities/BGL/boost/graph/example/default-constructor.cpp deleted file mode 100644 index 9d9f41a2dd1eb7797c2904084bb5925aeadc08b1..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/default-constructor.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <fstream> -#include <boost/graph/adjacency_list.hpp> - -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; - 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 - add_vertex(g); - size_type u, v; - while (in >> u) // Read in pairs of integers as edges - if (in >> v) - add_edge(u, v, g); - else - break; -} - - -int -main() -{ - typedef 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("makefile-dependencies.dat"); - read_graph_file(file_in, g); - - assert(num_vertices(g) == 15); - assert(num_edges(g) == 19); - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/default-constructor2.cpp b/Utilities/BGL/boost/graph/example/default-constructor2.cpp deleted file mode 100644 index 173f10bfdb122fcb827cba176e07259c5263393c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/default-constructor2.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <fstream> -#include <boost/graph/adjacency_list.hpp> - -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; - size_type n_vertices; - in >> n_vertices; // read in number of vertices - std::vector < Vertex > vertex_set(n_vertices); - for (size_type i = 0; i < n_vertices; ++i) - vertex_set[i] = add_vertex(g); - - size_type u, v; - while (in >> u) - if (in >> v) - add_edge(vertex_set[u], vertex_set[v], g); - else - break; -} - - -int -main() -{ - typedef 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("makefile-dependencies.dat"); - read_graph_file(file_in, g); - - assert(num_vertices(g) == 15); - assert(num_edges(g) == 19); - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/dfs-example.cpp b/Utilities/BGL/boost/graph/example/dfs-example.cpp deleted file mode 100644 index 017053de7b47b98014ea9512bab1f05f98ee883d..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/dfs-example.cpp +++ /dev/null @@ -1,94 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/depth_first_search.hpp> -#include <boost/pending/integer_range.hpp> -#include <boost/pending/indirect_cmp.hpp> - -#include <iostream> - -using namespace boost; -template < typename TimeMap > class dfs_time_visitor:public default_dfs_visitor { - typedef typename property_traits < TimeMap >::value_type T; -public: - dfs_time_visitor(TimeMap dmap, TimeMap fmap, T & t) -: m_dtimemap(dmap), m_ftimemap(fmap), m_time(t) { - } - template < typename Vertex, typename Graph > - void discover_vertex(Vertex u, const Graph & g) const - { - put(m_dtimemap, u, m_time++); - } - template < typename Vertex, typename Graph > - void finish_vertex(Vertex u, const Graph & g) const - { - put(m_ftimemap, u, m_time++); - } - TimeMap m_dtimemap; - TimeMap m_ftimemap; - T & m_time; -}; - - -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; - // Set up the vertex names - enum - { u, v, w, x, y, z, N }; - char name[] = { 'u', 'v', 'w', 'x', 'y', 'z' }; - // Specify the edges in the graph - typedef std::pair < int, int >E; - 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 - graph_t g(N); - for (std::size_t j = 0; j < sizeof(edge_array) / sizeof(E); ++j) - add_edge(edge_array[j].first, edge_array[j].second, g); -#else - graph_t g(edge_array, edge_array + sizeof(edge_array) / sizeof(E), N); -#endif - - // Typedefs - typedef boost::graph_traits < graph_t >::vertex_descriptor Vertex; - typedef size_type* Iiter; - - // discover time and finish time properties - std::vector < size_type > dtime(num_vertices(g)); - std::vector < size_type > ftime(num_vertices(g)); - size_type t = 0; - dfs_time_visitor < size_type * >vis(&dtime[0], &ftime[0], t); - - depth_first_search(g, visitor(vis)); - - // use std::sort to order the vertices by their discover time - std::vector < size_type > discover_order(N); - integer_range < size_type > r(0, N); - std::copy(r.begin(), r.end(), discover_order.begin()); - std::sort(discover_order.begin(), discover_order.end(), - indirect_cmp < Iiter, std::less < size_type > >(&dtime[0])); - std::cout << "order of discovery: "; - int i; - for (i = 0; i < N; ++i) - std::cout << name[discover_order[i]] << " "; - - std::vector < size_type > finish_order(N); - std::copy(r.begin(), r.end(), finish_order.begin()); - std::sort(finish_order.begin(), finish_order.end(), - indirect_cmp < Iiter, std::less < size_type > >(&ftime[0])); - std::cout << std::endl << "order of finish: "; - for (i = 0; i < N; ++i) - std::cout << name[finish_order[i]] << " "; - std::cout << std::endl; - - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/dfs-parenthesis.cpp b/Utilities/BGL/boost/graph/example/dfs-parenthesis.cpp deleted file mode 100644 index e342641758c2f17ebbec1c2de64fa57c037f64d8..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/dfs-parenthesis.cpp +++ /dev/null @@ -1,47 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/graph/graphviz.hpp> -#include <boost/graph/depth_first_search.hpp> - -char name[] = "abcdefghij"; - -struct parenthesis_visitor : public boost::default_dfs_visitor -{ - template <class Vertex, class Graph> void - start_vertex(Vertex v, const Graph &) - { - std::cout << ' '; - } - template <class Vertex, class Graph> void - discover_vertex(Vertex v, const Graph &) - { - std::cout << "(" << name[v] << ' '; - } - template <class Vertex, class Graph> void - finish_vertex(Vertex v, const Graph &) - { - std::cout << ' ' << name[v] << ")"; - } -}; - -int -main() -{ - using namespace boost; - GraphvizGraph g; - read_graphviz("figs/dfs-example.dot", g); - graph_traits < GraphvizGraph >::edge_iterator e, e_end; - for (tie(e, e_end) = edges(g); e != e_end; ++e) - std::cout << '(' << name[source(*e, g)] << ' ' - << name[target(*e, g)] << ')' << std::endl; - parenthesis_visitor - paren_vis; - depth_first_search(g, visitor(paren_vis)); - std::cout << std::endl; - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/dfs.cpp b/Utilities/BGL/boost/graph/example/dfs.cpp deleted file mode 100644 index 9dd13da8cb8ce04f8b57a6bc1198fe6dbb43d1f7..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/dfs.cpp +++ /dev/null @@ -1,114 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <assert.h> -#include <iostream> - -#include <vector> -#include <algorithm> -#include <utility> - - -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/depth_first_search.hpp> -#include <boost/graph/visitors.hpp> - -/* - This calculates the discover finishing time. - - Sample Output - - Tree edge: 0 --> 2 - Tree edge: 2 --> 1 - Back edge: 1 --> 1 - Tree edge: 1 --> 3 - Back edge: 3 --> 1 - Tree edge: 3 --> 4 - Back edge: 4 --> 0 - Back edge: 4 --> 1 - Forward or cross edge: 2 --> 3 - 1 10 - 3 8 - 2 9 - 4 7 - 5 6 - - */ - -using namespace boost; -using namespace std; - - -template <class VisitorList> -struct edge_categorizer : public dfs_visitor<VisitorList> { - typedef dfs_visitor<VisitorList> Base; - - edge_categorizer(const VisitorList& v = null_visitor()) : Base(v) { } - - template <class Edge, class Graph> - void tree_edge(Edge e, Graph& G) { - cout << "Tree edge: " << source(e, G) << - " --> " << target(e, G) << endl; - Base::tree_edge(e, G); - } - template <class Edge, class Graph> - void back_edge(Edge e, Graph& G) { - cout << "Back edge: " << source(e, G) - << " --> " << target(e, G) << endl; - Base::back_edge(e, G); - } - template <class Edge, class Graph> - void forward_or_cross_edge(Edge e, Graph& G) { - cout << "Forward or cross edge: " << source(e, G) - << " --> " << target(e, G) << endl; - Base::forward_or_cross_edge(e, G); - } -}; -template <class VisitorList> -edge_categorizer<VisitorList> -categorize_edges(const VisitorList& v) { - return edge_categorizer<VisitorList>(v); -} - -int -main(int , char* []) -{ - - using namespace boost; - - typedef adjacency_list<> Graph; - - Graph G(5); - add_edge(0, 2, G); - add_edge(1, 1, G); - add_edge(1, 3, G); - add_edge(2, 1, G); - add_edge(2, 3, G); - add_edge(3, 1, G); - add_edge(3, 4, G); - add_edge(4, 0, G); - add_edge(4, 1, G); - - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::vertices_size_type size_type; - - std::vector<size_type> d(num_vertices(G)); - std::vector<size_type> f(num_vertices(G)); - int t = 0; - depth_first_search(G, visitor(categorize_edges( - make_pair(stamp_times(&d[0], t, on_discover_vertex()), - stamp_times(&f[0], t, on_finish_vertex()))))); - - std::vector<size_type>::iterator i, j; - for (i = d.begin(), j = f.begin(); i != d.end(); ++i, ++j) - cout << *i << " " << *j << endl; - - return 0; -} - diff --git a/Utilities/BGL/boost/graph/example/dfs.expected b/Utilities/BGL/boost/graph/example/dfs.expected deleted file mode 100644 index 84aa0c456bed62d40c7ab1014a835cca8cc45573..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/dfs.expected +++ /dev/null @@ -1,14 +0,0 @@ -Tree edge: 0 --> 2 -Tree edge: 2 --> 1 -Back edge: 1 --> 1 -Tree edge: 1 --> 3 -Back edge: 3 --> 1 -Tree edge: 3 --> 4 -Back edge: 4 --> 0 -Back edge: 4 --> 1 -Forward or cross edge: 2 --> 3 -1 10 -3 8 -2 9 -4 7 -5 6 diff --git a/Utilities/BGL/boost/graph/example/dfs_basics.expected b/Utilities/BGL/boost/graph/example/dfs_basics.expected deleted file mode 100644 index a9e90d7009c5524b9a6864f1cd26177d14111d3a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/dfs_basics.expected +++ /dev/null @@ -1,2 +0,0 @@ -order of discovery: u v y x w z -order of finish: x y v u z w diff --git a/Utilities/BGL/boost/graph/example/dfs_parenthesis.cpp b/Utilities/BGL/boost/graph/example/dfs_parenthesis.cpp deleted file mode 100644 index 5bf04c41230a94c8b766a4301aba050bde8acb58..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/dfs_parenthesis.cpp +++ /dev/null @@ -1,76 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -// -// Sample output -// DFS parenthesis: -// (0(2(3(4(11)4)3)2)0) - -#include <boost/config.hpp> -#include <assert.h> -#include <iostream> - -#include <vector> -#include <algorithm> -#include <utility> - -#include "boost/graph/visitors.hpp" -#include "boost/graph/adjacency_list.hpp" -#include "boost/graph/breadth_first_search.hpp" -#include "boost/graph/depth_first_search.hpp" - -using namespace boost; -using namespace std; - -struct open_paren : public base_visitor<open_paren> { - typedef on_discover_vertex event_filter; - template <class Vertex, class Graph> - void operator()(Vertex v, Graph&) { - std::cout << "(" << v; - } -}; -struct close_paren : public base_visitor<close_paren> { - typedef on_finish_vertex event_filter; - template <class Vertex, class Graph> - void operator()(Vertex v, Graph&) { - std::cout << v << ")"; - } -}; - - -int -main(int, char*[]) -{ - - using namespace boost; - - typedef adjacency_list<> Graph; - typedef std::pair<int,int> E; - 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 - Graph G(5); - for (std::size_t j = 0; j < sizeof(edge_array) / sizeof(E); ++j) - add_edge(edge_array[j].first, edge_array[j].second, G); -#else - Graph G(edge_array, edge_array + sizeof(edge_array)/sizeof(E), 5); -#endif - - typedef boost::graph_traits<Graph>::vertex_descriptor Vertex; - typedef boost::graph_traits<Graph>::vertices_size_type size_type; - - std::cout << "DFS parenthesis:" << std::endl; - depth_first_search(G, visitor(make_dfs_visitor(std::make_pair(open_paren(), - close_paren())))); - std::cout << std::endl; - return 0; -} - diff --git a/Utilities/BGL/boost/graph/example/dfs_parenthesis.expected b/Utilities/BGL/boost/graph/example/dfs_parenthesis.expected deleted file mode 100644 index 9d71af7324fed955674fc59ea427ce2020b7fefb..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/dfs_parenthesis.expected +++ /dev/null @@ -1,2 +0,0 @@ -DFS parenthesis: -(0(2(1(3(44)3)1)2)0) diff --git a/Utilities/BGL/boost/graph/example/dijkstra-example-listS.cpp b/Utilities/BGL/boost/graph/example/dijkstra-example-listS.cpp deleted file mode 100644 index 775bcc2e6ad34fb2e3e791c51ab193c3c8c67648..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/dijkstra-example-listS.cpp +++ /dev/null @@ -1,118 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <fstream> - -#include <boost/graph/graph_traits.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/dijkstra_shortest_paths.hpp> - -using namespace boost; - -int -main(int, char *[]) -{ - typedef adjacency_list_traits<listS, listS, - directedS>::vertex_descriptor vertex_descriptor; - typedef 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 graph_traits<graph_t>::edge_descriptor edge_descriptor; - typedef std::pair<int, int> Edge; - - const int num_nodes = 5; - enum nodes { A, B, C, D, E }; - Edge edge_array[] = { Edge(A, C), Edge(B, B), Edge(B, D), Edge(B, E), - Edge(C, B), Edge(C, D), Edge(D, E), Edge(E, A), Edge(E, B) - }; - int weights[] = { 1, 2, 1, 2, 7, 3, 1, 1, 1 }; - int num_arcs = sizeof(edge_array) / sizeof(Edge); - graph_traits<graph_t>::vertex_iterator i, iend; - -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - graph_t g(num_nodes); - property_map<graph_t, edge_weight_t>::type weightmap = get(edge_weight, g); - - std::vector<vertex_descriptor> msvc_vertices; - for (tie(i, iend) = vertices(g); i != iend; ++i) - msvc_vertices.push_back(*i); - - for (std::size_t j = 0; j < num_arcs; ++j) { - edge_descriptor e; bool inserted; - tie(e, inserted) = add_edge(msvc_vertices[edge_array[j].first], - msvc_vertices[edge_array[j].second], g); - weightmap[e] = weights[j]; - } - -#else - graph_t g(edge_array, edge_array + num_arcs, weights, num_nodes); - property_map<graph_t, edge_weight_t>::type weightmap = get(edge_weight, g); -#endif - - // Manually intialize the vertex index and name maps - property_map<graph_t, vertex_index_t>::type indexmap = get(vertex_index, g); - property_map<graph_t, vertex_name_t>::type name = get(vertex_name, g); - int c = 0; - for (tie(i, iend) = vertices(g); i != iend; ++i, ++c) { - indexmap[*i] = c; - name[*i] = 'A' + c; - } - - vertex_descriptor s = vertex(A, g); - - property_map<graph_t, vertex_distance_t>::type - d = get(vertex_distance, g); - property_map<graph_t, vertex_predecessor_t>::type - p = get(vertex_predecessor, g); -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ has trouble with the named parameters mechanism - property_map<graph_t, vertex_index_t>::type indexmap = get(vertex_index, g); - dijkstra_shortest_paths(g, s, p, d, weightmap, indexmap, - std::less<int>(), closed_plus<int>(), - (std::numeric_limits<int>::max)(), 0, - default_dijkstra_visitor()); -#else - dijkstra_shortest_paths(g, s, predecessor_map(p).distance_map(d)); -#endif - - std::cout << "distances and parents:" << std::endl; - graph_traits < graph_t >::vertex_iterator vi, vend; - for (tie(vi, vend) = vertices(g); vi != vend; ++vi) { - std::cout << "distance(" << name[*vi] << ") = " << d[*vi] << ", "; - std::cout << "parent(" << name[*vi] << ") = " << name[p[*vi]] << std:: - endl; - } - std::cout << std::endl; - - std::ofstream dot_file("figs/dijkstra-eg.dot"); - dot_file << "digraph D {\n" - << " rankdir=LR\n" - << " size=\"4,3\"\n" - << " ratio=\"fill\"\n" - << " edge[style=\"bold\"]\n" << " node[shape=\"circle\"]\n"; - - graph_traits < graph_t >::edge_iterator ei, ei_end; - for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { - graph_traits < graph_t >::edge_descriptor e = *ei; - graph_traits < graph_t >::vertex_descriptor - u = source(e, g), v = target(e, g); - dot_file << name[u] << " -> " << name[v] - << "[label=\"" << get(weightmap, e) << "\""; - if (p[v] == u) - dot_file << ", color=\"black\""; - else - dot_file << ", color=\"grey\""; - dot_file << "]"; - } - dot_file << "}"; - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/dijkstra-example.cpp b/Utilities/BGL/boost/graph/example/dijkstra-example.cpp deleted file mode 100644 index f1a34d5a1ef28963d29cffc816cc89189f6f47e9..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/dijkstra-example.cpp +++ /dev/null @@ -1,94 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <fstream> - -#include <boost/graph/graph_traits.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/dijkstra_shortest_paths.hpp> - -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 graph_traits < graph_t >::edge_descriptor edge_descriptor; - typedef std::pair<int, int> Edge; - - const int num_nodes = 5; - enum nodes { A, B, C, D, E }; - char name[] = "ABCDE"; - Edge edge_array[] = { Edge(A, C), Edge(B, B), Edge(B, D), Edge(B, E), - Edge(C, B), Edge(C, D), Edge(D, E), Edge(E, A), Edge(E, B) - }; - int weights[] = { 1, 2, 1, 2, 7, 3, 1, 1, 1 }; - int num_arcs = sizeof(edge_array) / sizeof(Edge); -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - graph_t g(num_nodes); - property_map<graph_t, edge_weight_t>::type weightmap = get(edge_weight, g); - for (std::size_t j = 0; j < num_arcs; ++j) { - edge_descriptor e; bool inserted; - tie(e, inserted) = add_edge(edge_array[j].first, edge_array[j].second, g); - weightmap[e] = weights[j]; - } -#else - graph_t g(edge_array, edge_array + num_arcs, weights, num_nodes); - property_map<graph_t, edge_weight_t>::type weightmap = get(edge_weight, g); -#endif - std::vector<vertex_descriptor> p(num_vertices(g)); - std::vector<int> d(num_vertices(g)); - vertex_descriptor s = vertex(A, g); - -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ has trouble with the named parameters mechanism - property_map<graph_t, vertex_index_t>::type indexmap = get(vertex_index, g); - dijkstra_shortest_paths(g, s, &p[0], &d[0], weightmap, indexmap, - std::less<int>(), closed_plus<int>(), - (std::numeric_limits<int>::max)(), 0, - default_dijkstra_visitor()); -#else - dijkstra_shortest_paths(g, s, predecessor_map(&p[0]).distance_map(&d[0])); -#endif - - std::cout << "distances and parents:" << std::endl; - graph_traits < graph_t >::vertex_iterator vi, vend; - for (tie(vi, vend) = vertices(g); vi != vend; ++vi) { - std::cout << "distance(" << name[*vi] << ") = " << d[*vi] << ", "; - std::cout << "parent(" << name[*vi] << ") = " << name[p[*vi]] << std:: - endl; - } - std::cout << std::endl; - - std::ofstream dot_file("figs/dijkstra-eg.dot"); - - dot_file << "digraph D {\n" - << " rankdir=LR\n" - << " size=\"4,3\"\n" - << " ratio=\"fill\"\n" - << " edge[style=\"bold\"]\n" << " node[shape=\"circle\"]\n"; - - graph_traits < graph_t >::edge_iterator ei, ei_end; - for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { - graph_traits < graph_t >::edge_descriptor e = *ei; - graph_traits < graph_t >::vertex_descriptor - u = source(e, g), v = target(e, g); - dot_file << name[u] << " -> " << name[v] - << "[label=\"" << get(weightmap, e) << "\""; - if (p[v] == u) - dot_file << ", color=\"black\""; - else - dot_file << ", color=\"grey\""; - dot_file << "]"; - } - dot_file << "}"; - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/dijkstra.expected b/Utilities/BGL/boost/graph/example/dijkstra.expected deleted file mode 100644 index 0f73cbdf8e110e01e3ee5c0cb43e9a91cac955a0..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/dijkstra.expected +++ /dev/null @@ -1,13 +0,0 @@ -distances from start vertex: -distance(0) = 0 -distance(1) = 6 -distance(2) = 1 -distance(3) = 4 -distance(4) = 5 - -shortest paths tree -0 --> 2 -1 --> -2 --> 3 -3 --> 4 -4 --> 1 diff --git a/Utilities/BGL/boost/graph/example/edge-connectivity.cpp b/Utilities/BGL/boost/graph/example/edge-connectivity.cpp deleted file mode 100644 index 87cc00a8b6d7dcd9c29781919bea59be04afe43f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/edge-connectivity.cpp +++ /dev/null @@ -1,176 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <algorithm> -#include <utility> -#include <boost/graph/edmunds_karp_max_flow.hpp> -#include <boost/graph/push_relabel_max_flow.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graphviz.hpp> - -namespace boost -{ - template < typename Graph > - std::pair < typename graph_traits < Graph >::vertex_descriptor, - typename graph_traits < Graph >::degree_size_type > - min_degree_vertex(Graph & g) - { - typename graph_traits < Graph >::vertex_descriptor p; - typedef typename graph_traits < Graph >::degree_size_type size_type; - size_type delta = (std::numeric_limits < size_type >::max)(); - typename graph_traits < Graph >::vertex_iterator i, iend; - for (tie(i, iend) = vertices(g); i != iend; ++i) - if (degree(*i, g) < delta) - { - delta = degree(*i, g); - p = *i; - } - return std::make_pair(p, delta); - } - - template < typename Graph, typename OutputIterator > - void neighbors(const Graph & g, - typename graph_traits < Graph >::vertex_descriptor u, - OutputIterator result) - { - typename graph_traits < Graph >::adjacency_iterator ai, aend; - for (tie(ai, aend) = adjacent_vertices(u, g); ai != aend; ++ai) - *result++ = *ai; - } - template < typename Graph, typename VertexIterator, - typename OutputIterator > void neighbors(const Graph & g, - VertexIterator first, - VertexIterator last, - OutputIterator result) - { - for (; first != last; ++first) - neighbors(g, *first, result); - } - - 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, - property < edge_capacity_t, degree_size_type, - property < edge_residual_capacity_t, degree_size_type, - property < edge_reverse_t, edge_descriptor > > > > FlowGraph; - - vertex_descriptor u, v, p, k; - edge_descriptor e1, e2; - bool inserted; - typename graph_traits < VertexListGraph >::vertex_iterator vi, vi_end; - degree_size_type delta, alpha_star, alpha_S_k; - std::set < vertex_descriptor > S, neighbor_S; - std::vector < vertex_descriptor > S_star, nonneighbor_S; - std::vector < default_color_type > color(num_vertices(g)); - std::vector < edge_descriptor > pred(num_vertices(g)); - - FlowGraph flow_g(num_vertices(g)); - typename property_map < FlowGraph, edge_capacity_t >::type - cap = get(edge_capacity, flow_g); - typename property_map < FlowGraph, edge_residual_capacity_t >::type - res_cap = get(edge_residual_capacity, flow_g); - typename property_map < FlowGraph, edge_reverse_t >::type - rev_edge = get(edge_reverse, flow_g); - - typename graph_traits < VertexListGraph >::edge_iterator ei, ei_end; - for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { - u = source(*ei, g), v = target(*ei, g); - tie(e1, inserted) = add_edge(u, v, flow_g); - cap[e1] = 1; - tie(e2, inserted) = add_edge(v, u, flow_g); - cap[e2] = 1; - rev_edge[e1] = e2; - rev_edge[e2] = e1; - } - - tie(p, delta) = min_degree_vertex(g); - S_star.push_back(p); - alpha_star = delta; - S.insert(p); - neighbor_S.insert(p); - neighbors(g, S.begin(), S.end(), - std::inserter(neighbor_S, neighbor_S.begin())); - std::set_difference(vertices(g).first, vertices(g).second, - neighbor_S.begin(), neighbor_S.end(), - std::back_inserter(nonneighbor_S)); - - while (!nonneighbor_S.empty()) { - k = nonneighbor_S.front(); - alpha_S_k = edmunds_karp_max_flow - (flow_g, p, k, cap, res_cap, rev_edge, &color[0], &pred[0]); - if (alpha_S_k < alpha_star) { - alpha_star = alpha_S_k; - S_star.clear(); - for (tie(vi, vi_end) = vertices(flow_g); vi != vi_end; ++vi) - if (color[*vi] != Color::white()) - S_star.push_back(*vi); - } - S.insert(k); - neighbor_S.insert(k); - neighbors(g, k, std::inserter(neighbor_S, neighbor_S.begin())); - nonneighbor_S.clear(); - std::set_difference(vertices(g).first, vertices(g).second, - neighbor_S.begin(), neighbor_S.end(), - std::back_inserter(nonneighbor_S)); - } - - std::vector < bool > in_S_star(num_vertices(g), false); - typename std::vector < vertex_descriptor >::iterator si; - for (si = S_star.begin(); si != S_star.end(); ++si) - in_S_star[*si] = true; - degree_size_type c = 0; - for (si = S_star.begin(); si != S_star.end(); ++si) { - typename graph_traits < VertexListGraph >::out_edge_iterator ei, ei_end; - for (tie(ei, ei_end) = out_edges(*si, g); ei != ei_end; ++ei) - if (!in_S_star[target(*ei, g)]) { - *disconnecting_set++ = *ei; - ++c; - } - } - - return c; - } - -} - -int -main() -{ - using namespace boost; - GraphvizGraph g; - read_graphviz("figs/edge-connectivity.dot", g); - - typedef graph_traits < GraphvizGraph >::edge_descriptor edge_descriptor; - typedef graph_traits < GraphvizGraph >::degree_size_type degree_size_type; - std::vector < edge_descriptor > disconnecting_set; - degree_size_type c = - edge_connectivity(g, std::back_inserter(disconnecting_set)); - - std::cout << "The edge connectivity is " << c << "." << std::endl; - - property_map < GraphvizGraph, vertex_attribute_t >::type - attr_map = get(vertex_attribute, g); - - std::cout << "The disconnecting set is {"; - for (std::vector < edge_descriptor >::iterator i = - disconnecting_set.begin(); i != disconnecting_set.end(); ++i) - std:: - cout << "(" << attr_map[source(*i, g)]["label"] << "," << - attr_map[target(*i, g)]["label"] << ") "; - std::cout << "}." << std::endl; - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/edge-function.cpp b/Utilities/BGL/boost/graph/example/edge-function.cpp deleted file mode 100644 index 48a0667b36474bbc70584d2f3b75c0d7905fb2ad..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/edge-function.cpp +++ /dev/null @@ -1,139 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <fstream> -#include <string> -#include <boost/graph/adjacency_list.hpp> - -using namespace boost; - -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; - size_type n_vertices; - typename graph_traits < Graph >::vertex_descriptor u; - typename property_traits < VertexNamePropertyMap >::value_type name; - - graph_in >> n_vertices; // read in number of vertices - for (size_type i = 0; i < n_vertices; ++i) { // Add n vertices to the graph - u = add_vertex(g); - name_in >> name; - put(name_map, u, name); // ** Attach name property to vertex u ** - } - size_type src, targ; - while (graph_in >> src) // Read in edges - if (graph_in >> targ) - add_edge(src, targ, g); // add an edge to the graph - else - break; -} - -template < typename Graph, typename VertexNameMap > void -output_adjacent_vertices(std::ostream & out, - typename graph_traits < Graph >::vertex_descriptor u, - const Graph & g, VertexNameMap name_map) -{ - typename graph_traits < Graph >::adjacency_iterator vi, vi_end; - out << get(name_map, u) << " -> { "; - for (tie(vi, vi_end) = adjacent_vertices(u, g); vi != vi_end; ++vi) - out << get(name_map, *vi) << " "; - out << "}" << std::endl; -} - -template < typename NameMap > class name_equals_t { -public: - name_equals_t(const std::string & n, NameMap map) - : m_name(n), m_name_map(map) - { - } - template < typename Vertex > bool operator()(Vertex u) const - { - return get(m_name_map, u) == m_name; - } -private: - std::string m_name; - NameMap m_name_map; -}; - -// object generator function -template < typename NameMap > - inline name_equals_t < NameMap > -name_equals(const std::string & str, NameMap name) -{ - return name_equals_t < NameMap > (str, name); -} - - -int -main() -{ - typedef 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 = "makefile-dependencies.dat"; - const char* target_file_name = "makefile-target-names.dat"; - - std::ifstream file_in(dep_file_name), name_in(target_file_name); - if (!file_in) { - std::cerr << "** Error: could not open file " << dep_file_name - << std::endl; - return -1; - } - if (!name_in) { - std::cerr << "** Error: could not open file " << target_file_name - << std::endl; - return -1; - } - - // Obtain internal property map from the graph - property_map < graph_type, vertex_name_t >::type name_map = - get(vertex_name, g); - read_graph_file(file_in, name_in, g, name_map); - - graph_traits < graph_type >::vertex_descriptor yow, zag, bar; - // Get vertex name property map from the graph - typedef property_map < graph_type, vertex_name_t >::type name_map_t; - name_map_t name = get(vertex_name, g); - // Get iterators for the vertex set - graph_traits < graph_type >::vertex_iterator i, end; - tie(i, end) = vertices(g); - // Find yow.h - name_equals_t < name_map_t > predicate1("yow.h", name); - yow = *std::find_if(i, end, predicate1); - // Find zag.o - name_equals_t < name_map_t > predicate2("zag.o", name); - zag = *std::find_if(i, end, predicate2); - // Find bar.o - name_equals_t < name_map_t > predicate3("bar.o", name); - bar = *std::find_if(i, end, predicate3); - - graph_traits < graph_type >::edge_descriptor e1, e2; - bool exists; - - // Get the edge connecting yow.h to zag.o - tie(e1, exists) = edge(yow, zag, g); - assert(exists == true); - assert(source(e1, g) == yow); - assert(target(e1, g) == zag); - - // Discover that there is no edge connecting zag.o to bar.o - tie(e2, exists) = edge(zag, bar, g); - assert(exists == false); - - assert(num_vertices(g) == 15); - assert(num_edges(g) == 19); - - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/edge-iter-constructor.cpp b/Utilities/BGL/boost/graph/example/edge-iter-constructor.cpp deleted file mode 100644 index d9f616aa6c55823da6005f70f631d55ceb005525..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/edge-iter-constructor.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <fstream> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graph_utility.hpp> - -using namespace boost; - -template < typename T > - std::istream & operator >> (std::istream & in, std::pair < T, T > &p) { - in >> p.first >> p.second; - return in; -} - - -int -main() -{ - typedef 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("makefile-dependencies.dat"); - typedef graph_traits < graph_type >::vertices_size_type size_type; - size_type n_vertices; - file_in >> n_vertices; // read in number of vertices - - graph_type - g(n_vertices); // create graph with n vertices - - // Read in edges - graph_traits < graph_type >::vertices_size_type u, v; - while (file_in >> u) - if (file_in >> v) - add_edge(u, v, g); - else - break; - - assert(num_vertices(g) == 15); - assert(num_edges(g) == 19); - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/edge_basics.cpp b/Utilities/BGL/boost/graph/example/edge_basics.cpp deleted file mode 100644 index 0d1d1152d476241fe48f3f26e2b8bbb680d1ae16..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/edge_basics.cpp +++ /dev/null @@ -1,88 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#include <boost/config.hpp> -#include <iostream> -#include <algorithm> -#include <boost/graph/adjacency_list.hpp> - -using namespace std; -using namespace boost; - - -/* - Edge Basics - - This example demonstrates the GGCL Edge interface - - There is not much to the Edge interface. Basically just two - functions to access the source and target vertex: - - source(e) - target(e) - - and one associated type for the vertex type: - - edge_traits<Edge>::vertex_type - - Sample output: - - (0,1) (0,2) (0,3) (0,4) (2,0) (2,4) (3,0) (3,1) - - */ - - - -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; - void operator()(Edge e) const - { - //begin - // Get the associated vertex type out of the edge using the - // edge_traits class - // Use the source() and target() functions to access the vertices - // that belong to Edge e - Vertex src = source(e, G); - Vertex targ = target(e, G); - - // print out the vertex id's just because - cout << "(" << src << "," << targ << ") "; - //end - } - - Graph& G; -}; - - -int -main() -{ - typedef adjacency_list<> MyGraph; - - typedef pair<int,int> Pair; - 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) }; - - // Construct a graph using the edge_array (passing in pointers - // (iterators) to the beginning and end of the array), and - // specifying the number of vertices as 5 - MyGraph G(5); - for (int i=0; i<8; ++i) - add_edge(edge_array[i].first, edge_array[i].second, G); - - // Use the STL for_each algorithm to "exercise" all of the edges in - // the graph - for_each(edges(G).first, edges(G).second, exercise_edge<MyGraph>(G)); - cout << endl; - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/edge_basics.expected b/Utilities/BGL/boost/graph/example/edge_basics.expected deleted file mode 100644 index 684dc15f1a192a789382d1cda0baf941c1402644..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/edge_basics.expected +++ /dev/null @@ -1 +0,0 @@ -(0,1) (0,2) (0,3) (0,4) (2,0) (2,4) (3,0) (3,1) diff --git a/Utilities/BGL/boost/graph/example/edge_connectivity.cpp b/Utilities/BGL/boost/graph/example/edge_connectivity.cpp deleted file mode 100644 index 1e7535a28d109296e6e24debb0cdbfb9bf31732d..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/edge_connectivity.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//======================================================================= -// Copyright 2000 University of Notre Dame. -// Authors: Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - - -#include <boost/config.hpp> -#include <set> -#include <iostream> -#include <iterator> -#include <algorithm> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/edge_connectivity.hpp> - -using namespace boost; - -int -main() -{ - const int N = 8; - typedef adjacency_list<vecS, vecS, undirectedS> UndirectedGraph; - UndirectedGraph g(N); - - add_edge(0, 1, g); - add_edge(0, 2, g); - add_edge(0, 3, g); - add_edge(1, 2, g); - add_edge(1, 3, g); - add_edge(2, 3, g); - add_edge(3, 4, g); - add_edge(3, 7, g); - add_edge(4, 5, g); - add_edge(4, 6, g); - add_edge(4, 7, g); - add_edge(5, 6, g); - 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; - std::vector<edge_descriptor> disconnecting_set; - - degree_size_type c = edge_connectivity(g, std::back_inserter(disconnecting_set)); - - std::cout << "The edge connectivity is " << c << "." << std::endl; - std::cout << "The disconnecting set is {"; - - std::copy(disconnecting_set.begin(), disconnecting_set.end(), - std::ostream_iterator<edge_descriptor>(std::cout, " ")); - std::cout << "}." << std::endl; - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/edge_iterator_constructor.cpp b/Utilities/BGL/boost/graph/example/edge_iterator_constructor.cpp deleted file mode 100644 index 2fb6c3b36ba099f53e412acfe5a3a7c2ba0ba3a9..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/edge_iterator_constructor.cpp +++ /dev/null @@ -1,119 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -/* - Sample data (edge_iterator_constructor.dat): - 5 - 10 - 0 1 - 1 2 - 1 3 - 2 4 - 3 4 - 1 0 - 2 1 - 3 1 - 4 2 - 4 3 - - Sample output: - - 0 --> 1 - 1 --> 2 3 0 - 2 --> 4 1 - 3 --> 4 1 - 4 --> 2 3 - - */ - -#include <boost/config.hpp> -#include <utility> -#include <iostream> -#include <fstream> - -#include <iterator> -#include <boost/graph/graph_utility.hpp> -#include <boost/graph/adjacency_list.hpp> - -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; - - edge_stream_iterator() : m_stream(0), m_end_marker(false) {} - edge_stream_iterator(std::istream& s) : m_stream(&s) { m_read(); } - reference operator*() const { return m_edge; } - edge_stream_iterator& operator++() { - m_read(); - return *this; - } - edge_stream_iterator operator++(int) { - edge_stream_iterator tmp = *this; - m_read(); - return tmp; - } -protected: - std::istream* m_stream; - value_type m_edge; - bool m_end_marker; - void m_read() { - m_end_marker = (*m_stream) ? true : false; - if (m_end_marker) { - *m_stream >> m_edge.first >> m_edge.second; - } - m_end_marker = (*m_stream) ? true : false; - } - friend bool operator==(const edge_stream_iterator& x, - const edge_stream_iterator& y); - -}; -bool operator==(const edge_stream_iterator& x, - const edge_stream_iterator& y) -{ - return (x.m_stream == y.m_stream && x.m_end_marker == y.m_end_marker) - || x.m_end_marker == false && y.m_end_marker == false; -} -bool operator!=(const edge_stream_iterator& x, - const edge_stream_iterator& y) -{ - return !(x == y); -} - - - -int -main() -{ - typedef boost::adjacency_list<> IteratorConstructibleGraph; - typedef boost::graph_traits<IteratorConstructibleGraph> Traits; - Traits::vertices_size_type size_V; - Traits::edges_size_type size_E; - - std::ifstream f("edge_iterator_constructor.dat"); - f >> size_V >> size_E; - - edge_stream_iterator edge_iter(f), end; -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ can't handle the iterator constructor - IteratorConstructibleGraph G(size_V); - while (edge_iter != end) { - int i, j; - boost::tie(i, j) = *edge_iter++; - boost::add_edge(i, j, G); - } -#else - IteratorConstructibleGraph G(edge_iter, end, size_V); -#endif - boost::print_graph(G); - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/edge_iterator_constructor.dat b/Utilities/BGL/boost/graph/example/edge_iterator_constructor.dat deleted file mode 100644 index 4218e3f18629ea7d5b0f8d6878fe5d90aeafd7f4..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/edge_iterator_constructor.dat +++ /dev/null @@ -1,12 +0,0 @@ -5 -10 -0 1 -1 2 -1 3 -2 4 -3 4 -1 0 -2 1 -3 1 -4 2 -4 3 diff --git a/Utilities/BGL/boost/graph/example/edge_property.cpp b/Utilities/BGL/boost/graph/example/edge_property.cpp deleted file mode 100644 index bcd60357ba96e13926eab50abde84a1187f2719e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/edge_property.cpp +++ /dev/null @@ -1,165 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -// -// Sample output: -// -// 0 --(8, 10)--> 1 -// -// 1 --(12, 20)--> 4 --(12, 40)--> 3 -// <--(8,10)-- 0 <--(16,20)-- 2 -// 2 --(16, 20)--> 1 -// <--(16,20)-- 5 -// 3 --(12, 40)--> 6 -// <--(12,40)-- 1 -// 4 --(12, 20)--> 7 -// <--(12,20)-- 1 -// 5 --(16, 20)--> 2 -// <--(16,20)-- 6 -// 6 --(16, 20)--> 5 --(8, 10)--> 8 -// <--(12,20)-- 7 <--(12,40)-- 3 -// 7 --(12, 20)--> 6 -// <--(12,20)-- 4 -// 8 -// <--(8,10)-- 6 -// -// -// 0 --(8, 1)--> 1 -// -// 1 --(12, 2)--> 4 --(12, 3)--> 3 -// <--(8,1)-- 0 <--(16,4)-- 2 -// 2 --(16, 4)--> 1 -// <--(16,7)-- 5 -// 3 --(12, 5)--> 6 -// <--(12,3)-- 1 -// 4 --(12, 6)--> 7 -// <--(12,2)-- 1 -// 5 --(16, 7)--> 2 -// <--(16,8)-- 6 -// 6 --(16, 8)--> 5 -// <--(12,10)-- 7 <--(12,5)-- 3 -// 7 --(12, 10)--> 6 -// <--(12,6)-- 4 -// 8 -// - -#include <boost/config.hpp> -#include <iostream> - -#include <boost/utility.hpp> -#include <boost/property_map.hpp> -#include <boost/graph/adjacency_list.hpp> - - -using namespace boost; -using namespace std; - - -enum edge_myflow_t { edge_myflow }; -enum edge_mycapacity_t { edge_mycapacity }; - -namespace boost { - BOOST_INSTALL_PROPERTY(edge, myflow); - 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; - - typename property_map<Graph, edge_mycapacity_t>::const_type - capacity = get(edge_mycapacity, G); - typename property_map<Graph, edge_myflow_t>::const_type - flow = get(edge_myflow, G); - - Viter ui, uiend; - boost::tie(ui, uiend) = vertices(G); - - for (; ui != uiend; ++ui) { - OutEdgeIter out, out_end; - cout << *ui << "\t"; - - boost::tie(out, out_end) = out_edges(*ui, G); - for(; out != out_end; ++out) - cout << "--(" << capacity[*out] << ", " << flow[*out] << ")--> " - << target(*out,G) << "\t"; - - InEdgeIter in, in_end; - cout << endl << "\t"; - boost::tie(in, in_end) = in_edges(*ui, G); - for(; in != in_end; ++in) - cout << "<--(" << capacity[*in] << "," << flow[*in] << ")-- " - << source(*in,G) << "\t"; - - cout << endl; - } -} - - -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; - - const int num_vertices = 9; - Graph G(num_vertices); - - /* 2<----5 - / ^ - / \ - V \ - 0 ---->1---->3----->6--->8 - \ ^ - \ / - V / - 4----->7 - */ - - add_edge(0, 1, Flow(10, Cap(8)), G); - - add_edge(1, 4, Flow(20, Cap(12)), G); - add_edge(4, 7, Flow(20, Cap(12)), G); - add_edge(7, 6, Flow(20, Cap(12)), G); - - add_edge(1, 3, Flow(40, Cap(12)), G); - add_edge(3, 6, Flow(40, Cap(12)), G); - - add_edge(6, 5, Flow(20, Cap(16)), G); - add_edge(5, 2, Flow(20, Cap(16)), G); - add_edge(2, 1, Flow(20, Cap(16)), G); - - add_edge(6, 8, Flow(10, Cap(8)), G); - - typedef boost::graph_traits<Graph>::edge_descriptor Edge; - - print_network(G); - - property_map<Graph, edge_myflow_t>::type - flow = get(edge_myflow, G); - - boost::graph_traits<Graph>::vertex_iterator v, v_end; - boost::graph_traits<Graph>::out_edge_iterator e, e_end; - int f = 0; - for (tie(v, v_end) = vertices(G); v != v_end; ++v) - for (tie(e, e_end) = out_edges(*v, G); e != e_end; ++e) - flow[*e] = ++f; - cout << endl << endl; - - remove_edge(6, 8, G); - - print_network(G); - - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/edge_property.expected b/Utilities/BGL/boost/graph/example/edge_property.expected deleted file mode 100644 index 6c71be14c267248949841a51c06467a0e9fa1029..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/edge_property.expected +++ /dev/null @@ -1,38 +0,0 @@ -0 --(8, 10)--> 1 - -1 --(12, 20)--> 4 --(12, 40)--> 3 - <--(8,10)-- 0 <--(16,20)-- 2 -2 --(16, 20)--> 1 - <--(16,20)-- 5 -3 --(12, 40)--> 6 - <--(12,40)-- 1 -4 --(12, 20)--> 7 - <--(12,20)-- 1 -5 --(16, 20)--> 2 - <--(16,20)-- 6 -6 --(16, 20)--> 5 --(8, 10)--> 8 - <--(12,20)-- 7 <--(12,40)-- 3 -7 --(12, 20)--> 6 - <--(12,20)-- 4 -8 - <--(8,10)-- 6 - - -0 --(8, 1)--> 1 - -1 --(12, 2)--> 4 --(12, 3)--> 3 - <--(8,1)-- 0 <--(16,4)-- 2 -2 --(16, 4)--> 1 - <--(16,7)-- 5 -3 --(12, 5)--> 6 - <--(12,3)-- 1 -4 --(12, 6)--> 7 - <--(12,2)-- 1 -5 --(16, 7)--> 2 - <--(16,8)-- 6 -6 --(16, 8)--> 5 - <--(12,10)-- 7 <--(12,5)-- 3 -7 --(12, 10)--> 6 - <--(12,6)-- 4 -8 - diff --git a/Utilities/BGL/boost/graph/example/edmunds-karp-eg.cpp b/Utilities/BGL/boost/graph/example/edmunds-karp-eg.cpp deleted file mode 100644 index f6cd199558f58b548fad35e1bcedb76a88afbeb1..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/edmunds-karp-eg.cpp +++ /dev/null @@ -1,90 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <string> -#include <boost/graph/edmunds_karp_max_flow.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/read_dimacs.hpp> -#include <boost/graph/graph_utility.hpp> - -// Use a DIMACS network flow file as stdin. -// edmunds-karp-eg < max_flow.dat -// -// Sample output: -// c The total flow: -// s 13 -// -// c flow values: -// f 0 6 3 -// f 0 1 6 -// f 0 2 4 -// f 1 5 1 -// f 1 0 0 -// f 1 3 5 -// f 2 4 4 -// f 2 3 0 -// f 2 0 0 -// f 3 7 5 -// f 3 2 0 -// f 3 1 0 -// f 4 5 4 -// f 4 6 0 -// f 5 4 0 -// f 5 7 5 -// f 6 7 3 -// f 6 4 0 -// f 7 6 0 -// f 7 5 0 - -int -main() -{ - using namespace boost; - - typedef adjacency_list_traits < vecS, vecS, directedS > Traits; - typedef 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; - - Graph g; - - property_map < Graph, edge_capacity_t >::type - capacity = get(edge_capacity, g); - property_map < Graph, edge_reverse_t >::type rev = get(edge_reverse, g); - property_map < Graph, edge_residual_capacity_t >::type - residual_capacity = get(edge_residual_capacity, g); - - Traits::vertex_descriptor s, t; - read_dimacs_max_flow(g, capacity, rev, s, t); - -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - std::vector<default_color_type> color(num_vertices(g)); - std::vector<Traits::edge_descriptor> pred(num_vertices(g)); - long flow = edmunds_karp_max_flow - (g, s, t, capacity, residual_capacity, rev, &color[0], &pred[0]); -#else - long flow = edmunds_karp_max_flow(g, s, t); -#endif - - std::cout << "c The total flow:" << std::endl; - std::cout << "s " << flow << std::endl << std::endl; - - std::cout << "c flow values:" << std::endl; - graph_traits < Graph >::vertex_iterator u_iter, u_end; - graph_traits < Graph >::out_edge_iterator ei, e_end; - for (tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter) - for (tie(ei, e_end) = out_edges(*u_iter, g); ei != e_end; ++ei) - if (capacity[*ei] > 0) - std::cout << "f " << *u_iter << " " << target(*ei, g) << " " - << (capacity[*ei] - residual_capacity[*ei]) << std::endl; - - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/exterior_properties.cpp b/Utilities/BGL/boost/graph/example/exterior_properties.cpp deleted file mode 100644 index 5e4539795941147857bf9894770fb633a6d49d74..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/exterior_properties.cpp +++ /dev/null @@ -1,115 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -// -// This example is similar to the one in edge_property.cpp. -// The only difference is that this example uses exterior -// property storage instead of interior (properties). -// -// Sample output: -// -// 0 --(10, 8)--> 1 -// -// 1 --(20, 12)--> 4 --(40, 12)--> 3 -// <--(10,8)-- 0 <--(20,16)-- 2 -// 2 --(20, 16)--> 1 -// <--(20,16)-- 5 -// 3 --(40, 12)--> 6 -// <--(40,12)-- 1 -// 4 --(20, 12)--> 7 -// <--(20,12)-- 1 -// 5 --(20, 16)--> 2 -// <--(20,16)-- 6 -// 6 --(20, 16)--> 5 --(10, 8)--> 8 -// <--(20,12)-- 7 <--(40,12)-- 3 -// 7 --(20, 12)--> 6 -// <--(20,12)-- 4 -// 8 -// <--(10,8)-- 6 - - -#include <boost/config.hpp> -#include <iostream> -#include <boost/graph/adjacency_list.hpp> -#include <boost/property_map.hpp> - -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; - - Viter ui, uiend; - for (boost::tie(ui, uiend) = boost::vertices(G); ui != uiend; ++ui) { - OutEdgeIter out, out_end; - std::cout << *ui << "\t"; - - for(boost::tie(out, out_end) = boost::out_edges(*ui, G); out != out_end; ++out) - std::cout << "--(" << boost::get(capacity, *out) << ", " - << boost::get(flow, *out) << ")--> " << boost::target(*out,G) << "\t"; - std::cout << std::endl << "\t"; - - InEdgeIter in, in_end; - for(boost::tie(in, in_end) = boost::in_edges(*ui, G); in != in_end; ++in) - std::cout << "<--(" << boost::get(capacity, *in) << "," << boost::get(flow, *in) << ")-- " - << boost::source(*in, G) << "\t"; - std::cout << std::endl; - } -} - - -int main(int , char* []) { - - typedef boost::adjacency_list<boost::vecS, boost::vecS, - boost::bidirectionalS, boost::no_property, - boost::property<boost::edge_index_t, std::size_t> > Graph; - - const int num_vertices = 9; - Graph G(num_vertices); - - /* 2<----5 - / ^ - / \ - V \ - 0 ---->1---->3----->6--->8 - \ ^ - \ / - V / - 4----->7 - */ - - int capacity[] = { 10, 20, 20, 20, 40, 40, 20, 20, 20, 10 }; - int flow[] = { 8, 12, 12, 12, 12, 12, 16, 16, 16, 8 }; - - // insert edges into the graph, and assign each edge an ID number - // to index into the property arrays - boost::add_edge(0, 1, 0, G); - - boost::add_edge(1, 4, 1, G); - boost::add_edge(4, 7, 2, G); - boost::add_edge(7, 6, 3, G); - - boost::add_edge(1, 3, 4, G); - boost::add_edge(3, 6, 5, G); - - boost::add_edge(6, 5, 6, G); - boost::add_edge(5, 2, 7, G); - boost::add_edge(2, 1, 8, G); - - boost::add_edge(6, 8, 9, G); - - typedef boost::property_map<Graph, boost::edge_index_t>::type EdgeIndexMap; - EdgeIndexMap edge_id = boost::get(boost::edge_index, G); - - typedef boost::iterator_property_map<int*, EdgeIndexMap, int, int&> IterMap; - - print_network(G, IterMap(capacity, edge_id), IterMap(flow, edge_id)); - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/exterior_properties.expected b/Utilities/BGL/boost/graph/example/exterior_properties.expected deleted file mode 100644 index 863e00601911a8a645b089733a68fcc17600ee60..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/exterior_properties.expected +++ /dev/null @@ -1,18 +0,0 @@ -0 --(10, 8)--> 1 - -1 --(20, 12)--> 4 --(40, 12)--> 3 - <--(10,8)-- 0 <--(20,16)-- 2 -2 --(20, 16)--> 1 - <--(20,16)-- 5 -3 --(40, 12)--> 6 - <--(40,12)-- 1 -4 --(20, 12)--> 7 - <--(20,12)-- 1 -5 --(20, 16)--> 2 - <--(20,16)-- 6 -6 --(20, 16)--> 5 --(10, 8)--> 8 - <--(20,12)-- 7 <--(40,12)-- 3 -7 --(20, 12)--> 6 - <--(20,12)-- 4 -8 - <--(10,8)-- 6 diff --git a/Utilities/BGL/boost/graph/example/exterior_property_map.cpp b/Utilities/BGL/boost/graph/example/exterior_property_map.cpp deleted file mode 100644 index 8917c7f7464a48c8e3f88b87ab93bd17a8944edc..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/exterior_property_map.cpp +++ /dev/null @@ -1,94 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#include <boost/config.hpp> -#include <iostream> -#include <algorithm> -#include <string> -#include <boost/graph/adjacency_list.hpp> -#include <boost/property_map.hpp> - -using namespace std; -using namespace boost; - -/* - Exterior Decorator Basics - - An exterior decorator is a way of associating properties with the - vertices or edges of a graph. The "exterior" part means that the - properties are not stored inside the graph object (see - internal_decorator_basics.cc). Instead they are stored - separately, and passed as an extra argument to any - algorithm they are needed in. There are several standard - decorator types such a color and weight that are used - in the GGCL algorithms. - - The main responsibility of a decorator is to provide an operator[] - that maps a vertex (or vertex ID) to the property value for that - vertex. It just so happens that a normal array provides this. In - addition, a decorator must provide access to the property type - through the decorator_traits class. For convenience, GGCL - already defines a decorator_triats class for pointer and - array types. - - Sample Output - - Jeremy owes Rich some money - Jeremy owes Andrew some money - Jeremy owes Jeff some money - Jeremy owes Kinis some money - Andrew owes Jeremy some money - Andrew owes Kinis some money - Jeff owes Jeremy some money - Jeff owes Rich some money - Jeff owes Kinis some money - Kinis owes Jeremy some money - Kinis owes Rich some money - - */ - -template <class EdgeIter, class Graph, class Name> -void who_owes_who(EdgeIter first, EdgeIter last, const Graph& G, - Name name) -{ - while (first != last) { - - cout << name[source(*first,G)] << " owes " - << name[target(*first,G)] << " some money" << endl; - ++first; - } -} - -int -main(int, char*[]) -{ - /* The property will be "names" attached to the vertices */ - - string* names = new string[5]; - names[0] = "Jeremy"; - names[1] = "Rich"; - names[2] = "Andrew"; - names[3] = "Jeff"; - names[4] = "Kinis"; - - typedef adjacency_list<> MyGraphType; - - typedef pair<int,int> Pair; - 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) }; - - MyGraphType G(5); - for (int i=0; i<11; ++i) - add_edge(edge_array[i].first, edge_array[i].second, G); - - who_owes_who(edges(G).first, edges(G).second, G, names); - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/exterior_property_map.expected b/Utilities/BGL/boost/graph/example/exterior_property_map.expected deleted file mode 100644 index 6fb19310fdd7753f8208dd8f07b18b22db1b1d13..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/exterior_property_map.expected +++ /dev/null @@ -1,11 +0,0 @@ -Jeremy owes Rich some money -Jeremy owes Andrew some money -Jeremy owes Jeff some money -Jeremy owes Kinis some money -Andrew owes Jeremy some money -Andrew owes Kinis some money -Jeff owes Jeremy some money -Jeff owes Rich some money -Jeff owes Kinis some money -Kinis owes Jeremy some money -Kinis owes Rich some money diff --git a/Utilities/BGL/boost/graph/example/family-tree-eg.cpp b/Utilities/BGL/boost/graph/example/family-tree-eg.cpp deleted file mode 100644 index ab2b0bccb58941389d89647b0270b64d66232e5b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/family-tree-eg.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <vector> -#include <string> -#include <boost/graph/adjacency_list.hpp> -#include <boost/tuple/tuple.hpp> -enum family -{ Jeanie, Debbie, Rick, John, Amanda, Margaret, Benjamin, N }; -int -main() -{ - using namespace boost; - const char *name[] = { "Jeanie", "Debbie", "Rick", "John", "Amanda", - "Margaret", "Benjamin" - }; - - adjacency_list <> g(N); - add_edge(Jeanie, Debbie, g); - add_edge(Jeanie, Rick, g); - add_edge(Jeanie, John, g); - add_edge(Debbie, Amanda, g); - add_edge(Rick, Margaret, g); - add_edge(John, Benjamin, g); - - graph_traits < adjacency_list <> >::vertex_iterator i, end; - graph_traits < adjacency_list <> >::adjacency_iterator ai, a_end; - property_map < adjacency_list <>, vertex_index_t >::type - index_map = get(vertex_index, g); - - for (tie(i, end) = vertices(g); i != end; ++i) { - std::cout << name[get(index_map, *i)]; - tie(ai, a_end) = adjacent_vertices(*i, g); - if (ai == a_end) - std::cout << " has no children"; - else - std::cout << " is the parent of "; - for (; ai != a_end; ++ai) { - std::cout << name[get(index_map, *ai)]; - if (boost::next(ai) != a_end) - std::cout << ", "; - } - std::cout << std::endl; - } - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/family_tree.expected b/Utilities/BGL/boost/graph/example/family_tree.expected deleted file mode 100644 index b3e6d61a7b2e1f0d524d6fa36a5be112abb2fa9d..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/family_tree.expected +++ /dev/null @@ -1,7 +0,0 @@ -Jeanie is the parent of Debbie Rick John -Debbie is the parent of Amanda -Rick is the parent of Margaret -John is the parent of Benjamin -Amanda has no children -Margaret has no children -Benjamin has no children diff --git a/Utilities/BGL/boost/graph/example/fibonacci_heap.cpp b/Utilities/BGL/boost/graph/example/fibonacci_heap.cpp deleted file mode 100644 index 3dbdc5c9e0f4099555f01021e9721a6452b1a8e7..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/fibonacci_heap.cpp +++ /dev/null @@ -1,70 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <vector> -#include <boost/graph/random.hpp> -#include <boost/random/mersenne_twister.hpp> -#include <algorithm> -#include <boost/pending/fibonacci_heap.hpp> -#include <boost/graph/graph_utility.hpp> -#include <boost/pending/indirect_cmp.hpp> - -using namespace boost; - -int -main() -{ - typedef indirect_cmp<float*,std::less<float> > ICmp; - int i; - boost::mt19937 gen; - for (int N = 2; N < 200; ++N) { - uniform_int<> distrib(0, N-1); - variate_generator<boost::mt19937&, uniform_int<> > rand_gen(gen, distrib); - for (int t = 0; t < 10; ++t) { - std::vector<float> v, w(N); - - ICmp cmp(&w[0], std::less<float>()); - fibonacci_heap<int, ICmp> Q(N, cmp); - - for (int c = 0; c < w.size(); ++c) - w[c] = c; - std::random_shuffle(w.begin(), w.end()); - - for (i = 0; i < N; ++i) - Q.push(i); - - for (i = 0; i < N; ++i) { - int u = rand_gen(); - float r = rand_gen(); r /= 2.0; - w[u] = w[u] - r; - Q.update(u); - } - - for (i = 0; i < N; ++i) { - v.push_back(w[Q.top()]); - Q.pop(); - } - std::sort(w.begin(), w.end()); - - if (! std::equal(v.begin(), v.end(), w.begin())) { - std::cout << std::endl << "heap sorted: "; - std::copy(v.begin(), v.end(), - std::ostream_iterator<float>(std::cout," ")); - std::cout << std::endl << "correct: "; - std::copy(w.begin(), w.end(), - std::ostream_iterator<float>(std::cout," ")); - std::cout << std::endl; - return -1; - } - } - } - std::cout << "fibonacci heap passed test" << std::endl; - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/fibonacci_heap.expected b/Utilities/BGL/boost/graph/example/fibonacci_heap.expected deleted file mode 100644 index a11d7ad1d0323cfb216a957f2275aaa8f91bc437..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/fibonacci_heap.expected +++ /dev/null @@ -1 +0,0 @@ -fibonacci heap passed test diff --git a/Utilities/BGL/boost/graph/example/figs/cc-internet.dot b/Utilities/BGL/boost/graph/example/figs/cc-internet.dot deleted file mode 100644 index a49fda738bcab80056d43211dca7ed831a29a1f7..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/figs/cc-internet.dot +++ /dev/null @@ -1,67 +0,0 @@ -graph G { -rankdir="LR"; -size="5.625,7.75"; -ratio="fill"; -subgraph cluster0 { -color="white" -"engr-fe21.gw.nd.edu" -"radole.lcs.mit.edu" -"shub-e27.gw.nd.edu" -"ihtfp.mit.edu" -"core1-ord1-oc48.ord2.above.net" -"albnxg1.ip.tele.dk" -} -subgraph cluster1 { -color="white" -"nycmny1-cr1.bbnplanet.net" -"ccn-nerif35.Berkeley.EDU" -"rip.Berkeley.EDU" -"chicago1-nbr1.bbnplanet.net" -"ccngw-ner-cc.Berkeley.EDU" -"above-bbn-45Mbps.ord.above.net" -} -subgraph cluster2 { -color="white" -"gw-dkuug.oeb.tdk.ne" -"vabi1-gige-1-1.google.com" -} -subgraph cluster3 { -color="white" -"boston1-br1.bbnplanet.net" -"cambridge1-nbr2.bbnplanet.net" -"helios.ee.lbl.gov" -"lilac-dmc.Berkeley.EDU" -"teledk.bbnplanet.net" -"albnxg1.ip.tele.dk" -} - -edge[style="bold"]; - -"engr-fe21.gw.nd.edu" -- "shub-e27.gw.nd.edu" -"shub-e27.gw.nd.edu" -- "chicago1-nbr1.bbnplanet.net" -"shub-e27.gw.nd.edu" -- "core1-ord1-oc48.ord2.above.net" -"chicago1-nbr1.bbnplanet.net" -- "above-bbn-45Mbps.ord.above.net" -"above-bbn-45Mbps.ord.above.net" -- "engr-fe21.gw.nd.edu" -"above-bbn-45Mbps.ord.above.net" -- "core1-ord1-oc48.ord2.above.net" -"core1-ord1-oc48.ord2.above.net" -- "vabi1-gige-1-1.google.com" -"vabi1-gige-1-1.google.com" -- "chicago1-nbr1.bbnplanet.net" - -"cambridge1-nbr2.bbnplanet.net" -- "boston1-br1.bbnplanet.net" -"ihtfp.mit.edu" -- "boston1-br1.bbnplanet.net" -"cambridge1-nbr2.bbnplanet.net" -- "radole.lcs.mit.edu" -"ihtfp.mit.edu" -- "radole.lcs.mit.edu" - -"helios.ee.lbl.gov" -- "lilac-dmc.Berkeley.EDU" -"lilac-dmc.Berkeley.EDU" -- "ccngw-ner-cc.Berkeley.EDU" -"ccngw-ner-cc.Berkeley.EDU" -- "ccn-nerif35.Berkeley.EDU" -"ccn-nerif35.Berkeley.EDU" -- "rip.Berkeley.EDU" -"helios.ee.lbl.gov" -- "ccn-nerif35.Berkeley.EDU" -"lilac-dmc.Berkeley.EDU" -- "rip.Berkeley.EDU" - -"nycmny1-cr1.bbnplanet.net" -- "teledk.bbnplanet.net" -"teledk.bbnplanet.net" -- "albnxg1.ip.tele.dk" -"albnxg1.ip.tele.dk" -- "gw-dkuug.oeb.tdk.ne" -"nycmny1-cr1.bbnplanet.net" -- "gw-dkuug.oeb.tdk.ne" -"nycmny1-cr1.bbnplanet.net" -- "albnxg1.ip.tele.dk" - -} diff --git a/Utilities/BGL/boost/graph/example/figs/dfs-example.dot b/Utilities/BGL/boost/graph/example/figs/dfs-example.dot deleted file mode 100644 index 06e2663954be8d6bd84b0a1aa65d54bc4508276a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/figs/dfs-example.dot +++ /dev/null @@ -1,28 +0,0 @@ -graph G { - size="3,3" - ratio="fill" - node[shape="circle"] - edge[style="bold"] - a; - b; - c; - d; - e; - f; - g; - h; - i; - j; - - c -- a[label="1"] - a -- b[color="gray",style="bold",weight=0] - f -- c[label="2"] - g -- f[label="3"] - f -- h[label="7"] - g -- d[label="4"] - b -- e[label="6"] - b -- d[label="5"] - e -- d[color="gray",style="bold",weight=0] - - i -- j[label="8"] -} diff --git a/Utilities/BGL/boost/graph/example/figs/edge-connectivity.dot b/Utilities/BGL/boost/graph/example/figs/edge-connectivity.dot deleted file mode 100644 index f9dbadabe9d2972d283ab9409ebb35e4356896c1..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/figs/edge-connectivity.dot +++ /dev/null @@ -1,21 +0,0 @@ -graph G { - rankdir="LR" - size="5,3" - ratio="fill" - node[shape="circle"] - A B C D E F G H - A -- B - A -- C - A -- D - B -- C - B -- D - C -- D - D -- E - D -- H - E -- F - E -- G - E -- H - F -- G - F -- H - G -- H -} diff --git a/Utilities/BGL/boost/graph/example/figs/ospf-graph.dot b/Utilities/BGL/boost/graph/example/figs/ospf-graph.dot deleted file mode 100644 index d4fcee7ad12495fb18d08134254fa2f0430bce19..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/figs/ospf-graph.dot +++ /dev/null @@ -1,96 +0,0 @@ -digraph G { - ratio="fill" - size="4,6" - edge[style="bold"] - - RT1 - RT2 - RT3 - RT4 - RT5 - RT6 - RT7 - RT8 - RT9 - RT10 - RT11 - RT12 - - N1 - N2 - N3 - N4 - N6 - N7 - N8 - N9 - N10 - N11 - N12 - N13 - N14 - N15 - H1 - - RT1 -> N1[label="3"] - RT1 -> N3[label="1"] - - RT2 -> N2[label="3"] - RT2 -> N3[label="1"] - - RT3 -> RT6[label="8"] - RT3 -> N3[label="1"] - RT3 -> N4[label="2"] - - RT4 -> N3[label="1"] - RT4 -> RT5[label="8"] - - RT5 -> RT4[label="8"] - RT5 -> RT6[label="7"] - RT5 -> RT7[label="6"] - RT5 -> N12[label="8"] - RT5 -> N13[label="8"] - RT5 -> N14[label="8"] - - RT6 -> RT3[label="6"] - RT6 -> RT5[label="6"] - RT6 -> RT10[label="7"] - - RT7 -> RT5[label="6"] - RT7 -> N6[label="1"] - RT7 -> N12[label="2"] - RT7 -> N15[label="9"] - - RT8 -> N6[label="1"] - RT8 -> N7[label="4"] - - RT9 -> N9[label="1"] - RT9 -> N11[label="3"] - - RT10 -> RT6[label="5"] - RT10 -> N6[label="1"] - RT10 -> N8[label="3"] - - RT11 -> N8[label="2"] - RT11 -> N9[label="1"] - - RT12 -> N9[label="1"] - RT12 -> N10[label="2"] - RT12 -> H1[label="10"] - - N3 -> RT1[label="0"] - N3 -> RT2[label="0"] - N3 -> RT3[label="0"] - N3 -> RT4[label="0"] - - N6 -> RT7[label="0"] - N6 -> RT8[label="0"] - N6 -> RT10[label="0"] - - N8 -> RT10[label="0"] - N8 -> RT11[label="0"] - - N9 -> RT9[label="0"] - N9 -> RT11[label="0"] - N9 -> RT12[label="0"] -} diff --git a/Utilities/BGL/boost/graph/example/figs/scc.dot b/Utilities/BGL/boost/graph/example/figs/scc.dot deleted file mode 100644 index 66d0fc84488fa128a8d6771e7df8bc1e3c9826ff..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/figs/scc.dot +++ /dev/null @@ -1,33 +0,0 @@ -digraph SCC { - size="3,4" - ratio="fill" - edge[style="bold"] - "www.boost.org" - "www.yahoogroups.com" - "weather.yahoo.com" - "nytimes.com" - "www.boston.com" - "sourceforge.net" - "www.hp.com" - "anubis.dkuug.dk" - "www.lsc.nd.edu" - "www.lam-mpi.org" - - "www.boost.org" -> "www.yahoogroups.com" - "www.boost.org" -> "sourceforge.net" - "www.boost.org" -> "anubis.dkuug.dk" - "www.yahoogroups.com" -> "weather.yahoo.com" - "www.yahoogroups.com" -> "www.boost.org" - "weather.yahoo.com" -> "nytimes.com" - "weather.yahoo.com" -> "www.yahoogroups.com" - "nytimes.com" -> "www.boston.com" - "www.boston.com" -> "nytimes.com" - "sourceforge.net" -> "www.hp.com" - "www.hp.com" -> "sourceforge.net" - "www.hp.com" -> "nytimes.com" - "anubis.dkuug.dk" -> "www.lsc.nd.edu" - "www.lsc.nd.edu" -> "anubis.dkuug.dk" - "www.lsc.nd.edu" -> "www.lam-mpi.org" - "www.lsc.nd.edu" -> "www.boston.com" - "www.lsc.nd.edu" -> "weather.yahoo.com" -} diff --git a/Utilities/BGL/boost/graph/example/figs/telephone-network.dot b/Utilities/BGL/boost/graph/example/figs/telephone-network.dot deleted file mode 100644 index 4187d5127f22f904d944cbc3838cdad602a90994..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/figs/telephone-network.dot +++ /dev/null @@ -1,42 +0,0 @@ -graph G { - size="5,5.3" - ratio="fill" - edge[style="bold"] - Nobel - McKellar - "Parry Sound" - "Horseshoe Lake" - Rosseau - Mactier - "Bent River" - Dunchurch - Magnetawan - Kearny - "Glen Orchard" - Sprucedale - Novar - Huntsville - Bracebridge - - Nobel -- McKellar[label="9", weight="9"] - Nobel -- "Parry Sound"[label="3", weight="3"] - McKellar -- Dunchurch[label="11", weight="11"] - Dunchurch -- Magnetawan[label="12", weight="12"] - McKellar -- Magnetawan[label="30", weight="30"] - Magnetawan -- Kearny[label="20", weight="20"] - Magnetawan -- Sprucedale[label="20", weight="20"] - Kearny -- Sprucedale[label="13", weight="13"] - Sprucedale -- Novar[label="18", weight="18"] - Sprucedale -- Huntsville[label="15", weight="15"] - Kearny -- Novar[label="8", weight="11"] - Novar -- Huntsville[label="5", weight="5"] - Huntsville -- Bracebridge[label="30", weight="30"] - Huntsville -- "Bent River"[label="30", weight="30"] - Rosseau -- "Bent River"[label="8", weight="8"] - Rosseau -- "Horseshoe Lake"[label="8", weight="8"] - Mactier -- "Horseshoe Lake"[label="14", weight="14"] - "Parry Sound" -- "Horseshoe Lake"[label="10", weight="10"] - "Parry Sound" -- Dunchurch[label="20", weight="20"] - Mactier -- "Glen Orchard"[label="9", weight="9"] - "Glen Orchard" -- Bracebridge[label="15", weight="15"] -} diff --git a/Utilities/BGL/boost/graph/example/file_dependencies.cpp b/Utilities/BGL/boost/graph/example/file_dependencies.cpp deleted file mode 100644 index 78a684a16cf9c9a569708c2cec6ca1f136dd4c61..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/file_dependencies.cpp +++ /dev/null @@ -1,207 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -/* - - Paul Moore's request: - - As an example of a practical problem which is not restricted to graph - "experts", consider file dependencies. It's basically graph construction, - plus topological sort, but it might make a nice "tutorial" example. Build a - dependency graph of files, then use the algorithms to do things like - - 1. Produce a full recompilation order (topological sort, by modified date) - 2. Produce a "parallel" recompilation order (same as above, but group files - which can be built in parallel) - 3. Change analysis (if I change file x, which others need recompiling) - 4. Dependency changes (if I add a dependency between file x and file y, what - are the effects) - -*/ - -#include <boost/config.hpp> // put this first to suppress some VC++ warnings - -#include <iostream> -#include <iterator> -#include <algorithm> -#include <time.h> - -#include <boost/utility.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/topological_sort.hpp> -#include <boost/graph/depth_first_search.hpp> -#include <boost/graph/dijkstra_shortest_paths.hpp> -#include <boost/graph/visitors.hpp> - -using namespace std; -using namespace boost; - -enum files_e { dax_h, yow_h, boz_h, zow_h, foo_cpp, - foo_o, bar_cpp, bar_o, libfoobar_a, - zig_cpp, zig_o, zag_cpp, zag_o, - libzigzag_a, killerapp, N }; -const char* name[] = { "dax.h", "yow.h", "boz.h", "zow.h", "foo.cpp", - "foo.o", "bar.cpp", "bar.o", "libfoobar.a", - "zig.cpp", "zig.o", "zag.cpp", "zag.o", - "libzigzag.a", "killerapp" }; - - -struct print_visitor : public bfs_visitor<> { - template <class Vertex, class Graph> - void discover_vertex(Vertex v, Graph&) { - cout << name[v] << " "; - } -}; - - -struct cycle_detector : public dfs_visitor<> -{ - cycle_detector(bool& has_cycle) - : m_has_cycle(has_cycle) { } - - template <class Edge, class Graph> - void back_edge(Edge, Graph&) { m_has_cycle = true; } -protected: - bool& m_has_cycle; -}; - - - - -int main(int,char*[]) -{ - - typedef pair<int,int> Edge; - 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), - Edge(zow_h, foo_cpp), - Edge(foo_cpp, foo_o), - Edge(foo_o, libfoobar_a), - Edge(bar_cpp, bar_o), - Edge(bar_o, libfoobar_a), - Edge(libfoobar_a, libzigzag_a), - Edge(zig_cpp, zig_o), - Edge(zig_o, libzigzag_a), - Edge(zag_cpp, zag_o), - Edge(zag_o, libzigzag_a), - Edge(libzigzag_a, killerapp) - }; - const std::size_t nedges = sizeof(used_by)/sizeof(Edge); - int weights[nedges]; - std::fill(weights, weights + nedges, 1); - - typedef adjacency_list<vecS, vecS, directedS, - property<vertex_color_t, default_color_type>, - property<edge_weight_t, int> - > Graph; -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ can't handle the iterator constructor - Graph g(N); - property_map<Graph, edge_weight_t>::type weightmap = get(edge_weight, g); - for (std::size_t j = 0; j < nedges; ++j) { - graph_traits<Graph>::edge_descriptor e; bool inserted; - tie(e, inserted) = add_edge(used_by[j].first, used_by[j].second, g); - weightmap[e] = weights[j]; - } -#else - Graph g(used_by, used_by + nedges, weights, N); -#endif - typedef graph_traits<Graph>::vertex_descriptor Vertex; - - // Determine ordering for a full recompilation - { - typedef list<Vertex> MakeOrder; - MakeOrder make_order; - topological_sort(g, std::front_inserter(make_order)); - - cout << "make ordering: "; - for (MakeOrder::iterator i = make_order.begin(); - i != make_order.end(); ++i) - cout << name[*i] << " "; - cout << endl; - } - cout << endl; - - // Recompilation order with files that can be compiled in parallel - // grouped together - { - // Set up the necessary graph properties. - vector<int> time(N); - typedef vector<int>::iterator Time; - property_map<Graph, edge_weight_t>::type weight = get(edge_weight, g); - - // Calculate the in_degree for each vertex. - vector<int> in_degree(N, 0); - graph_traits<Graph>::vertex_iterator i, iend; - graph_traits<Graph>::out_edge_iterator j, jend; - for (tie(i, iend) = vertices(g); i != iend; ++i) - for (tie(j, jend) = out_edges(*i,g); j != jend; ++j) - in_degree[target(*j,g)] += 1; - - std::greater<int> compare; - closed_plus<int> combine; - - // Run best-first-search from each vertex with zero in-degree. - for (tie(i, iend) = vertices(g); i != iend; ++i) { - if (in_degree[*i] == 0) { - std::vector<graph_traits<Graph>::vertex_descriptor> - pred(num_vertices(g)); - property_map<Graph, vertex_index_t>::type - indexmap = get(vertex_index, g); - dijkstra_shortest_paths_no_init - (g, *i, &pred[0], &time[0], weight, indexmap, - compare, combine, 0, // Since we are using > instead of >, we - (std::numeric_limits<int>::max)(), // flip 0 and inf. - default_dijkstra_visitor()); - } - } - - cout << "parallel make ordering, " << endl - << "vertices with same group number can be made in parallel" << endl; - for (tie(i,iend) = vertices(g); i != iend; ++i) - cout << "time_slot[" << name[*i] << "] = " << time[*i] << endl; - } - cout << endl; - - // if I change yow.h what files need to be re-made? - { - cout << "A change to yow.h will cause what to be re-made?" << endl; - print_visitor vis; - breadth_first_search(g, vertex(yow_h, g), visitor(vis)); - cout << endl; - } - cout << endl; - - // are there any cycles in the graph? - { - bool has_cycle = false; - cycle_detector vis(has_cycle); - depth_first_search(g, visitor(vis)); - cout << "The graph has a cycle? " << has_cycle << endl; - } - cout << endl; - - // add a dependency going from bar.cpp to dax.h - { - cout << "adding edge bar_cpp -> dax_h" << endl; - add_edge(bar_cpp, dax_h, g); - } - cout << endl; - - // are there any cycles in the graph? - { - bool has_cycle = false; - cycle_detector vis(has_cycle); - depth_first_search(g, visitor(vis)); - cout << "The graph has a cycle now? " << has_cycle << endl; - } - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/file_dependencies.expected b/Utilities/BGL/boost/graph/example/file_dependencies.expected deleted file mode 100644 index 9f004a7acc4166a50ea4ebff1d504544efc54d04..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/file_dependencies.expected +++ /dev/null @@ -1,28 +0,0 @@ -make ordering: zow.h boz.h zig.cpp zig.o dax.h yow.h zag.cpp zag.o bar.cpp bar.o foo.cpp foo.o libfoobar.a libzigzag.a killerapp - -parallel make ordering, -vertices with same group number can be made in parallel -time_slot[dax.h] = 0 -time_slot[yow.h] = 1 -time_slot[boz.h] = 0 -time_slot[zow.h] = 0 -time_slot[foo.cpp] = 1 -time_slot[foo.o] = 2 -time_slot[bar.cpp] = 2 -time_slot[bar.o] = 3 -time_slot[libfoobar.a] = 4 -time_slot[zig.cpp] = 1 -time_slot[zig.o] = 2 -time_slot[zag.cpp] = 2 -time_slot[zag.o] = 3 -time_slot[libzigzag.a] = 5 -time_slot[killerapp] = 6 - -A change to yow.h will cause what to be re-made? -yow.h bar.cpp zag.cpp bar.o zag.o libfoobar.a libzigzag.a killerapp - -The graph has a cycle? 0 - -adding edge bar_cpp -> dax_h - -The graph has a cycle now? 1 diff --git a/Utilities/BGL/boost/graph/example/filtered-copy-example.cpp b/Utilities/BGL/boost/graph/example/filtered-copy-example.cpp deleted file mode 100644 index f1ee142b7af8d5f376e77b3fc9dccbbde09de03c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/filtered-copy-example.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <boost/graph/copy.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/filtered_graph.hpp> -#include <boost/graph/graph_utility.hpp> - -template <typename Graph> -struct non_zero_degree { - non_zero_degree() { } // has to have a default constructor! - - non_zero_degree(const Graph& g) : g(&g) { } - - bool operator()(typename boost::graph_traits<Graph>::vertex_descriptor v) const - { - return degree(v, *g) != 0; - } - const Graph* g; -}; - -int -main() -{ - using namespace boost; - typedef int weight_t; - typedef adjacency_list < vecS, vecS, bidirectionalS, - property < vertex_name_t, char > > graph_t; - - enum { a, b, c, d, e, f, g, N }; - graph_t G(N); - property_map < graph_t, vertex_name_t >::type - name_map = get(vertex_name, G); - char name = 'a'; - graph_traits < graph_t >::vertex_iterator v, v_end; - for (tie(v, v_end) = vertices(G); v != v_end; ++v, ++name) - name_map[*v] = name; - - typedef std::pair < int, int >E; - 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) - add_edge(edges[i].first, edges[i].second, G); - - print_graph(G, name_map); - std::cout << std::endl; - - clear_vertex(b, G); - clear_vertex(d, G); - - graph_t G_copy; - copy_graph(make_filtered_graph(G, keep_all(), non_zero_degree<graph_t>(G)), G_copy); - - print_graph(G_copy, get(vertex_name, G_copy)); - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/filtered_graph.cpp b/Utilities/BGL/boost/graph/example/filtered_graph.cpp deleted file mode 100644 index e325b5f83313fdd6fe58875e90c73e6890134bc1..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/filtered_graph.cpp +++ /dev/null @@ -1,69 +0,0 @@ -//======================================================================= -// Copyright 2001 University of Notre Dame. -// Author: Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -/* - Sample output: - - filtered edge set: (A,B) (C,D) (D,B) - filtered out-edges: - A --> B - B --> - C --> D - D --> B - E --> - */ - -#include <boost/config.hpp> -#include <iostream> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/filtered_graph.hpp> -#include <boost/graph/graph_utility.hpp> - -template <typename EdgeWeightMap> -struct positive_edge_weight { - positive_edge_weight() { } - positive_edge_weight(EdgeWeightMap weight) : m_weight(weight) { } - template <typename Edge> - bool operator()(const Edge& e) const { - return 0 < boost::get(m_weight, e); - } - EdgeWeightMap m_weight; -}; - - -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; - - enum { A, B, C, D, E, N }; - const char* name = "ABCDE"; - Graph g(N); - add_edge(A, B, 2, g); - add_edge(A, C, 0, g); - add_edge(C, D, 1, g); - add_edge(C, E, 0, g); - add_edge(D, B, 3, g); - add_edge(E, C, 0, g); - - positive_edge_weight<EdgeWeightMap> filter(get(edge_weight, g)); - filtered_graph<Graph, positive_edge_weight<EdgeWeightMap> > - fg(g, filter); - - std::cout << "filtered edge set: "; - print_edges(fg, name); - - std::cout << "filtered out-edges:" << std::endl; - print_graph(fg, name); - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/filtered_graph.expected b/Utilities/BGL/boost/graph/example/filtered_graph.expected deleted file mode 100644 index d2a8e504a8f1aa92d50e1af11b47a6949660117a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/filtered_graph.expected +++ /dev/null @@ -1,7 +0,0 @@ -filtered edge set: (A,B) (C,D) (D,B) -filtered out-edges: -A --> B -B --> -C --> D -D --> B -E --> diff --git a/Utilities/BGL/boost/graph/example/filtered_graph_edge_range.cpp b/Utilities/BGL/boost/graph/example/filtered_graph_edge_range.cpp deleted file mode 100644 index 6a00789db4d753c5a6ddd60e5e3d260a875efa90..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/filtered_graph_edge_range.cpp +++ /dev/null @@ -1,79 +0,0 @@ -//======================================================================= -// Copyright 2001 University of Notre Dame. -// Author: Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -/* - Sample output: - - filtered edge set: (A,B) (C,D) (D,B) - filtered out-edges: - A --> B - B --> - C --> D - D --> B - E --> - */ - -#include <boost/config.hpp> -#include <iostream> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/filtered_graph.hpp> -#include <boost/graph/graph_utility.hpp> - -template <typename EdgeWeightMap> -struct positive_edge_weight { - positive_edge_weight() { } - positive_edge_weight(EdgeWeightMap weight) : m_weight(weight) { } - template <typename Edge> - bool operator()(const Edge& e) const { - return 0 < boost::get(m_weight, e); - } - EdgeWeightMap m_weight; -}; - - -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; - - enum { A, B, C, D, E, N }; - const char* name = "ABCDE"; - Graph g(N); - add_edge(A, B, 2, g); - add_edge(A, C, 0, g); - add_edge(C, D, 1, g); - add_edge(C, D, 0, g); - add_edge(C, D, 3, g); - add_edge(C, E, 0, g); - add_edge(D, B, 3, g); - add_edge(E, C, 0, g); - - EdgeWeightMap weight = get(edge_weight, g); - - std::cout << "unfiltered edge_range(C,D)\n"; - graph_traits<Graph>::out_edge_iterator f, l; - for (tie(f, l) = edge_range(C, D, g); f != l; ++f) - std::cout << name[source(*f, g)] << " --" << weight[*f] - << "-> " << name[target(*f, g)] << "\n"; - - positive_edge_weight<EdgeWeightMap> filter(weight); - typedef filtered_graph<Graph, positive_edge_weight<EdgeWeightMap> > FGraph; - FGraph fg(g, filter); - - std::cout << "filtered edge_range(C,D)\n"; - graph_traits<FGraph>::out_edge_iterator first, last; - for (tie(first, last) = edge_range(C, D, fg); first != last; ++first) - std::cout << name[source(*first, fg)] << " --" << weight[*first] - << "-> " << name[target(*first, fg)] << "\n"; - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/filtered_vec_as_graph.cpp b/Utilities/BGL/boost/graph/example/filtered_vec_as_graph.cpp deleted file mode 100644 index 2d976a0efb7865cfdead96a792a35e68e9d18ae2..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/filtered_vec_as_graph.cpp +++ /dev/null @@ -1,59 +0,0 @@ -//======================================================================= -// Copyright 2001 University of Notre Dame. -// Author: Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -/* - Sample output: - - filtered out-edges: - A --> - B --> - C --> E - D --> E - E --> - */ - -#include <boost/config.hpp> -#include <iostream> -#include <boost/graph/vector_as_graph.hpp> -#include <boost/graph/filtered_graph.hpp> -#include <boost/graph/graph_utility.hpp> - -struct constant_target { - constant_target() { } - constant_target(int t) : target(t) { } - bool operator()(const std::pair<int,int>& e) const { - return e.second == target; - } - int target; -}; - - -int main() -{ - using namespace boost; - - enum { A, B, C, D, E, N }; - const char* name = "ABCDE"; - typedef std::vector < std::list < int > > Graph; - Graph g(N); - g[A].push_back(B); - g[A].push_back(C); - g[C].push_back(D); - g[C].push_back(E); - g[D].push_back(E); - g[E].push_back(C); - - constant_target filter(E); - filtered_graph<Graph, constant_target> fg(g, filter); - - std::cout << "filtered out-edges:" << std::endl; - print_graph(fg, name); - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/fr_layout.cpp b/Utilities/BGL/boost/graph/example/fr_layout.cpp deleted file mode 100644 index aa0612a84b5332736c00c198066a0e5a6f9299c9..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/fr_layout.cpp +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright 2004 The Trustees of Indiana University. - -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Authors: Douglas Gregor -// Andrew Lumsdaine -#include <boost/graph/fruchterman_reingold.hpp> -#include <boost/graph/random_layout.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/simple_point.hpp> -#include <boost/lexical_cast.hpp> -#include <string> -#include <iostream> -#include <map> -#include <vector> -#include <boost/random/linear_congruential.hpp> -#include <boost/progress.hpp> -#include <boost/shared_ptr.hpp> - -using namespace boost; - -void usage() -{ - std::cerr << "Usage: fr_layout [options] <width> <height>\n" - << "Arguments:\n" - << "\t<width>\tWidth of the display area (floating point)\n" - << "\t<Height>\tHeight of the display area (floating point)\n\n" - << "Options:\n" - << "\t--iterations n\tNumber of iterations to execute.\n" - << "\t\t\tThe default value is 100.\n" - << "Input:\n" - << " Input is read from standard input as a list of edges, one per line.\n" - << " Each edge contains two string labels (the endpoints) separated by a space.\n\n" - << "Output:\n" - << " Vertices and their positions are written to standard output with the label,\n x-position, and y-position of a vertex on each line, separated by spaces.\n"; -} - -typedef adjacency_list<listS, vecS, undirectedS, - property<vertex_name_t, std::string> > Graph; - -typedef graph_traits<Graph>::vertex_descriptor Vertex; - -typedef std::map<std::string, Vertex> NameToVertex; - -Vertex get_vertex(const std::string& name, Graph& g, NameToVertex& names) -{ - NameToVertex::iterator i = names.find(name); - if (i == names.end()) - i = names.insert(std::make_pair(name, add_vertex(name, g))).first; - return i->second; -} - -class progress_cooling : public linear_cooling<double> -{ - typedef linear_cooling<double> inherited; - - public: - explicit progress_cooling(std::size_t iterations) : inherited(iterations) - { - display.reset(new progress_display(iterations + 1, std::cerr)); - } - - double operator()() - { - ++(*display); - return inherited::operator()(); - } - - private: - shared_ptr<boost::progress_display> display; -}; - -int main(int argc, char* argv[]) -{ - int iterations = 100; - - if (argc < 3) { usage(); return -1; } - - double width = 0; - double height = 0; - - for (int arg_idx = 1; arg_idx < argc; ++arg_idx) { - std::string arg = argv[arg_idx]; - if (arg == "--iterations") { - ++arg_idx; - if (arg_idx >= argc) { usage(); return -1; } - iterations = lexical_cast<int>(argv[arg_idx]); - } else { - if (width == 0.0) width = lexical_cast<double>(arg); - else if (height == 0.0) height = lexical_cast<double>(arg); - else { - usage(); - return -1; - } - } - } - - if (width == 0.0 || height == 0.0) { - usage(); - return -1; - } - - Graph g; - NameToVertex names; - - std::string source, target; - while (std::cin >> source >> target) { - add_edge(get_vertex(source, g, names), get_vertex(target, g, names), g); - } - - typedef std::vector<simple_point<double> > PositionVec; - PositionVec position_vec(num_vertices(g)); - typedef iterator_property_map<PositionVec::iterator, - property_map<Graph, vertex_index_t>::type> - PositionMap; - PositionMap position(position_vec.begin(), get(vertex_index, g)); - - minstd_rand gen; - random_graph_layout(g, position, -width/2, width/2, -height/2, height/2, gen); - fruchterman_reingold_force_directed_layout - (g, position, width, height, - cooling(progress_cooling(iterations))); - - graph_traits<Graph>::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { - std::cout << get(vertex_name, g, *vi) << '\t' - << position[*vi].x << '\t' << position[*vi].y << std::endl; - } - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/gerdemann.cpp b/Utilities/BGL/boost/graph/example/gerdemann.cpp deleted file mode 100644 index d4b9fbafc11024e8b1f2a81025c7c5042db31a13..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/gerdemann.cpp +++ /dev/null @@ -1,150 +0,0 @@ -// -*- c++ -*- -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> - -#include <boost/graph/adjacency_list.hpp> - -/* - Thanks to Dale Gerdemann for this example, which inspired some - changes to adjacency_list to make this work properly. - */ - -/* - Sample output: - - 0 --c--> 1 --j--> 1 --c--> 2 --x--> 2 - 1 --c--> 2 --d--> 3 - 2 --t--> 4 - 3 --h--> 4 - 4 - - merging vertex 1 into vertex 0 - - 0 --c--> 0 --j--> 0 --c--> 1 --x--> 1 --d--> 2 - 1 --t--> 3 - 2 --h--> 3 - 3 - */ - -// merge_vertex(u,v,g): -// incoming/outgoing edges for v become incoming/outgoing edges for u -// v is deleted -template <class Graph, class GetEdgeProperties> -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; - typename Traits::edge_descriptor e; - typename Traits::out_edge_iterator out_i, out_end; - for (tie(out_i, out_end) = out_edges(v, g); out_i != out_end; ++out_i) { - e = *out_i; - typename Traits::vertex_descriptor targ = target(e, g); - add_edge(u, targ, getp(e), g); - } - typename Traits::in_edge_iterator in_i, in_end; - for (tie(in_i, in_end) = in_edges(v, g); in_i != in_end; ++in_i) { - e = *in_i; - typename Traits::vertex_descriptor src = source(e, g); - add_edge(src, u, getp(e), g); - } - clear_vertex(v, g); - remove_vertex(v, g); -} - -template <class StoredEdge> -struct order_by_name - : public std::binary_function<StoredEdge,StoredEdge,bool> -{ - bool operator()(const StoredEdge& e1, const StoredEdge& e2) const { - // Using std::pair operator< as an easy way to get lexicographical - // compare over tuples. - return std::make_pair(e1.get_target(), boost::get(boost::edge_name, e1)) - < std::make_pair(e2.get_target(), boost::get(boost::edge_name, e2)); - } -}; -struct ordered_set_by_nameS { }; - -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -namespace boost { - template <class ValueType> - struct container_gen<ordered_set_by_nameS, ValueType> { - typedef std::set<ValueType, order_by_name<ValueType> > type; - }; - template <> - struct parallel_edge_traits<ordered_set_by_nameS> { - typedef allow_parallel_edge_tag type; - }; -} -#endif - -template <class Graph> -struct get_edge_name { - get_edge_name(const Graph& g_) : g(g_) { } - - template <class Edge> - boost::property<boost::edge_name_t, char> operator()(Edge e) const { - return boost::property<boost::edge_name_t, char>(boost::get(boost::edge_name, g, e)); - } - const Graph& g; -}; - -int -main() -{ -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - 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; - - graph_type g; - - add_edge(0, 1, EdgeProperty('j'), g); - add_edge(0, 2, EdgeProperty('c'), g); - add_edge(0, 2, EdgeProperty('x'), g); - add_edge(1, 3, EdgeProperty('d'), g); - add_edge(1, 2, EdgeProperty('c'), g); - add_edge(1, 3, EdgeProperty('d'), g); - add_edge(2, 4, EdgeProperty('t'), g); - add_edge(3, 4, EdgeProperty('h'), g); - add_edge(0, 1, EdgeProperty('c'), g); - - property_map<graph_type, vertex_index_t>::type id = get(vertex_index, g); - property_map<graph_type, edge_name_t>::type name = get(edge_name, g); - - graph_traits<graph_type>::vertex_iterator i, end; - graph_traits<graph_type>::out_edge_iterator ei, edge_end; - - for (boost::tie(i, end) = vertices(g); i != end; ++i) { - std::cout << id[*i] << " "; - for (boost::tie(ei, edge_end) = out_edges(*i, g); ei != edge_end; ++ei) - std::cout << " --" << name[*ei] << "--> " << id[target(*ei, g)] << " "; - std::cout << std::endl; - } - std::cout << std::endl; - - std::cout << "merging vertex 1 into vertex 0" << std::endl << std::endl; - merge_vertex(0, 1, g, get_edge_name<graph_type>(g)); - - for (boost::tie(i, end) = vertices(g); i != end; ++i) { - std::cout << id[*i] << " "; - for (boost::tie(ei, edge_end) = out_edges(*i, g); ei != edge_end; ++ei) - std::cout << " --" << name[*ei] << "--> " << id[target(*ei, g)] << " "; - std::cout << std::endl; - } - std::cout << std::endl; -#endif - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/gerdemann.expected b/Utilities/BGL/boost/graph/example/gerdemann.expected deleted file mode 100644 index bc5bdda65f2b5633154fe5aba72fc0548d9cb00e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/gerdemann.expected +++ /dev/null @@ -1,13 +0,0 @@ -0 --c--> 1 --j--> 1 --c--> 2 --x--> 2 -1 --c--> 2 --d--> 3 -2 --t--> 4 -3 --h--> 4 -4 - -merging vertex 1 into vertex 0 - -0 --c--> 0 --j--> 0 --c--> 1 --x--> 1 --d--> 2 -1 --t--> 3 -2 --h--> 3 -3 - diff --git a/Utilities/BGL/boost/graph/example/girth.cpp b/Utilities/BGL/boost/graph/example/girth.cpp deleted file mode 100644 index 9c9cc23cc22fd1e9823737269052e2954794f06b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/girth.cpp +++ /dev/null @@ -1,160 +0,0 @@ -//======================================================================= -// Copyright 2002 Indiana University. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -/* - Adapted from the GIRTH program of the Stanford GraphBase. - - Sample output: - - This program explores the girth and diameter of Ramanujan graphs. - The bipartite graphs have q^3-q vertices, and the non-bipartite - graphs have half that number. Each vertex has degree p+1. - Both p and q should be odd prime numbers; - or you can try p = 2 with q = 17 or 43. - - Choose a branching factor, p: 2 - Ok, now choose the cube root of graph size, q: 17 - Starting at any given vertex, there are - 3 vertices at distance 1, - 6 vertices at distance 2, - 12 vertices at distance 3, - 24 vertices at distance 4, - 46 vertices at distance 5, - 90 vertices at distance 6, - 169 vertices at distance 7, - 290 vertices at distance 8, - 497 vertices at distance 9, - 634 vertices at distance 10, - 521 vertices at distance 11, - 138 vertices at distance 12, - 13 vertices at distance 13, - 3 vertices at distance 14, - 1 vertices at distance 15. - So the diameter is 15, and the girth is 9. - - */ - -#include <boost/config.hpp> -#include <vector> -#include <list> -#include <iostream> -#include <boost/limits.hpp> -#include <boost/graph/stanford_graph.hpp> -#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; - -std::vector<std::size_t> distance_list; - -typedef boost::v_property<long> dist_t; -boost::property_map<Graph*, dist_t>::type d_map; - -typedef boost::u_property<vertex_descriptor> pred_t; -boost::property_map<Graph*, pred_t>::type p_map; - -typedef boost::w_property<long> color_t; -boost::property_map<Graph*, color_t>::type c_map; - -class diameter_and_girth_visitor : public boost::bfs_visitor<> -{ -public: - diameter_and_girth_visitor(std::size_t& k_, std::size_t& girth_) - : k(k_), girth(girth_) { } - - void tree_edge(edge_descriptor e, Graph* g) { - vertex_descriptor u = source(e, g), v = target(e, g); - k = d_map[u] + 1; - d_map[v] = k; - ++distance_list[k]; - p_map[v] = u; - } - void non_tree_edge(edge_descriptor e, Graph* g) { - vertex_descriptor u = source(e, g), v = target(e, g); - k = d_map[u] + 1; - if (d_map[v] + k < girth && v != p_map[u]) - girth = d_map[v]+ k; - } -private: - std::size_t& k; - std::size_t& girth; -}; - - -int -main() -{ - std::cout << - "This program explores the girth and diameter of Ramanujan graphs." - << std::endl; - std::cout << - "The bipartite graphs have q^3-q vertices, and the non-bipartite" - << std::endl; - std::cout << - "graphs have half that number. Each vertex has degree p+1." - << std::endl; - std::cout << "Both p and q should be odd prime numbers;" << std::endl; - std::cout << " or you can try p = 2 with q = 17 or 43." << std::endl; - - while (1) { - - std::cout << std::endl - << "Choose a branching factor, p: "; - long p = 0, q = 0; - std::cin >> p; - if (p == 0) - break; - std::cout << "Ok, now choose the cube root of graph size, q: "; - std::cin >> q; - if (q == 0) - break; - - Graph* g; - g = raman(p, q, 0L, 0L); - if (g == 0) { - std::cerr << " Sorry, I couldn't make that graph (error code " - << panic_code << ")" << std::endl; - continue; - } - distance_list.clear(); - distance_list.resize(boost::num_vertices(g), 0); - - // obtain property maps - d_map = get(dist_t(), g); - p_map = get(pred_t(), g); - c_map = get(color_t(), g); - - vertex_iterator i, end; - for (boost::tie(i, end) = boost::vertices(g); i != end; ++i) - d_map[*i] = 0; - - std::size_t k = 0; - std::size_t girth = (std::numeric_limits<std::size_t>::max)(); - diameter_and_girth_visitor vis(k, girth); - - vertex_descriptor s = *boost::vertices(g).first; - - boost::breadth_first_search(g, s, visitor(vis).color_map(c_map)); - - std::cout << "Starting at any given vertex, there are" << std::endl; - - for (long d = 1; distance_list[d] != 0; ++d) - std::cout << distance_list[d] << " vertices at distance " << d - << (distance_list[d+1] != 0 ? "," : ".") << std::endl; - - std::cout << "So the diameter is " << k - 1 - << ", and the girth is " << girth - << "." << std::endl; - } // end while - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/graph-assoc-types.cpp b/Utilities/BGL/boost/graph/example/graph-assoc-types.cpp deleted file mode 100644 index 8838cffb874d5012a4f502b76c6f0722d842cea9..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/graph-assoc-types.cpp +++ /dev/null @@ -1,104 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/graph/graph_traits.hpp> -#include <boost/graph/adjacency_list.hpp> - -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; - // Access category types - typedef typename graph_traits < Graph >::directed_category Dir; - typedef typename graph_traits < Graph >::edge_parallel_category Par; - // Access iterator types... - // Access size types... - // Now do something useful... -} - -template < typename Graph > void -generic_bar(Graph & g) -{ - // Declare some vertex and edge descriptor variables - typename graph_traits < Graph >::vertex_descriptor u, v; - typename graph_traits < Graph >::edge_descriptor e1, e2; - // Set u and e1 to valid descriptors... - v = u; // Make v a handle to the same vertex as u. - e2 = e1; // Make e2 a handle to the same edge as e1. - assert(u == v); // Do u and v identify the same vertex? Yes - assert(!(u != v)); // Do u and v identify different vertices? No - assert(e1 == e2); // Do e1 and e2 identify the same edge? Yes - assert(!(e1 != e2)); // Do e1 and e2 identify different edges? No -} - -// This version of foo gets called when g is directed -template < typename Graph > void -foo_dispatch(Graph & g, boost::directed_tag) -{ - //... -} - -// This version of foo gets called when g is undirected -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; - foo_dispatch(g, Cat()); -} - -template < typename Digraph > 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; - std::pair<edge_t, bool> e1, e2; - e1 = edge(u, v, digraph); - e2 = edge(v, u, digraph); - assert(e1.first != e2.first); -} -template < typename Undigraph > 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; - std::pair<edge_t, bool> e1, e2; - e1 = edge(u, v, undigraph); - e2 = edge(v, u, undigraph); - assert(e1.first == e2.first); -} - - -int -main() -{ - - boost::adjacency_list < vecS, vecS, directedS > g(2); - add_edge(0, 1, g); - add_edge(1, 0, g); - generic_foo(g); - generic_bar(g); - foo(g); - foo(g, vertex(0, g), vertex(1, g)); - - boost::adjacency_list < vecS, vecS, undirectedS > ug(2); - add_edge(0, 1, g); - bar(ug, vertex(0, g), vertex(1, g)); - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/graph-property-iter-eg.cpp b/Utilities/BGL/boost/graph/example/graph-property-iter-eg.cpp deleted file mode 100644 index f471b0e061f6c853047cb0fb3d8798a809959d1e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/graph-property-iter-eg.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#include <boost/config.hpp> -#include <string> -#include <iostream> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/property_iter_range.hpp> - -int -main() -{ - using namespace boost; - typedef adjacency_list < listS, vecS, directedS, - property < vertex_name_t, std::string > >graph_t; - graph_t g(3); - - const char *vertex_names[] = { "Kubrick", "Clark", "Hal" }; - int i = 0; - graph_property_iter_range < graph_t, vertex_name_t >::iterator v, v_end; - for (tie(v, v_end) = get_property_iter_range(g, vertex_name); - v != v_end; ++v, ++i) - *v = vertex_names[i]; - - tie(v, v_end) = get_property_iter_range(g, vertex_name); - std::copy(v, v_end, std::ostream_iterator < std::string > (std::cout, " ")); - std::cout << std::endl; - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/graph.cpp b/Utilities/BGL/boost/graph/example/graph.cpp deleted file mode 100644 index 035b0d71e7245fdf580ba12122856b82b67eb18b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/graph.cpp +++ /dev/null @@ -1,155 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <vector> -#include <utility> -#include <algorithm> - -#include <boost/graph/adjacency_list.hpp> - -using namespace boost; -using namespace std; - -typedef 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; - -template <class Graph> -void print(Graph& g) { - typename Graph::vertex_iterator i, end; - typename Graph::out_edge_iterator ei, edge_end; - for(boost::tie(i,end) = vertices(g); i != end; ++i) { - cout << *i << " --> "; - for (boost::tie(ei,edge_end) = out_edges(*i, g); ei != edge_end; ++ei) - cout << target(*ei, g) << " "; - cout << endl; - } -} - -std::size_t myrand(std::size_t N) { - std::size_t ret = rand() % N; - // cout << "N = " << N << " rand = " << ret << endl; - return ret; -} - -template <class Graph> -bool check_edge(Graph& g, std::size_t a, std::size_t b) { - typedef typename Graph::vertex_descriptor Vertex; - typename Graph::adjacency_iterator vi, viend, found; - boost::tie(vi, viend) = adjacent_vertices(vertex(a,g), g); - - found = find(vi, viend, vertex(b, g)); - if ( found == viend ) - return false; - - return true; -} - -int main(int, char*[]) -{ - std::size_t N = 5; - - Graph g(N); - int i; - - bool is_failed = false; - - for (i=0; i<6; ++i) { - std::size_t a = myrand(N), b = myrand(N); - while ( a == b ) b = myrand(N); - cout << "edge edge (" << a << "," << b <<")" << endl; - //add edges - add_edge(a, b, g); - is_failed = is_failed || (! check_edge(g, a, b) ); - } - - if ( is_failed ) - cerr << " Failed."<< endl; - else - cerr << " Passed."<< endl; - - print(g); - - //remove_edge - for (i = 0; i<2; ++i) { - std::size_t a = myrand(N), b = myrand(N); - while ( a == b ) b = myrand(N); - cout << "remove edge (" << a << "," << b <<")" << endl; - remove_edge(a, b, g); - is_failed = is_failed || check_edge(g, a, b); - } - if ( is_failed ) - cerr << " Failed."<< endl; - else - cerr << " Passed."<< endl; - - print(g); - - //add_vertex - is_failed = false; - std::size_t old_N = N; - std::size_t vid = add_vertex(g); - std::size_t vidp1 = add_vertex(g); - - N = num_vertices(g); - if ( (N - 2) != old_N ) - cerr << " Failed."<< endl; - else - cerr << " Passed."<< endl; - - is_failed = false; - for (i=0; i<2; ++i) { - std::size_t a = myrand(N), b = myrand(N); - while ( a == vid ) a = myrand(N); - while ( b == vidp1 ) b = myrand(N); - cout << "add edge (" << vid << "," << a <<")" << endl; - cout << "add edge (" << vid << "," << vidp1 <<")" << endl; - add_edge(vid, a, g); - add_edge(b, vidp1, g); - is_failed = is_failed || ! check_edge(g, vid, a); - is_failed = is_failed || ! check_edge(g, b, vidp1); - } - if ( is_failed ) - cerr << " Failed."<< endl; - else - cerr << " Passed."<< endl; - print(g); - - // clear_vertex - std::size_t c = myrand(N); - is_failed = false; - clear_vertex(c, g); - - if ( out_degree(c, g) != 0 ) - is_failed = true; - - cout << "Removing vertex " << c << endl; - remove_vertex(c, g); - - old_N = N; - N = num_vertices(g); - - if ( (N + 1) != old_N ) - is_failed = true; - - if ( is_failed ) - cerr << " Failed."<< endl; - else - cerr << " Passed."<< endl; - - print(g); - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/graph_as_tree.cpp b/Utilities/BGL/boost/graph/example/graph_as_tree.cpp deleted file mode 100644 index 4201d3698390defdd28de3228572608432d6fd4b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/graph_as_tree.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//======================================================================= -// Copyright 2002 Indiana University. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#include <boost/graph/graph_as_tree.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/cstdlib.hpp> - -class tree_printer { -public: - template <typename Node, typename Tree> - void preorder(Node, Tree&) { - std::cout << "("; - } - template <typename Node, typename Tree> - void inorder(Node n, Tree& t) - { - std::cout << get(boost::vertex_name, t)[n]; - } - template <typename Node, typename Tree> - void postorder(Node, Tree&) { - std::cout << ")"; - } - -}; - -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; - - graph_t g; - - vertex_t a = add_vertex(g), - b = add_vertex(g), - c = add_vertex(g); - - add_edge(a, b, g); - add_edge(a, c, g); - - typedef property_map<graph_t, vertex_name_t>::type vertex_name_map_t; - vertex_name_map_t name = get(vertex_name, g); - name[a] = "A"; - 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; - std::vector<vertex_t> parent(num_vertices(g)); - typedef graph_as_tree<graph_t, parent_map_t> tree_t; - tree_t t(g, a, make_iterator_property_map(parent.begin(), - get(vertex_index, g))); - - tree_printer vis; - traverse_tree(a, t, vis); - - return exit_success; -} diff --git a/Utilities/BGL/boost/graph/example/graph_property.cpp b/Utilities/BGL/boost/graph/example/graph_property.cpp deleted file mode 100644 index ceb71c47f55c4c998e4c57021594e11bad768fa9..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/graph_property.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// (C) Copyright Jeremy Siek 2004 -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include <string> -#include <iostream> -#include <boost/cstdlib.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/subgraph.hpp> - -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; - - 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; - - subgraph_t sg; - get_property(sg, graph_name) = "subgraph"; - - std::cout << "name: " << get_property(sg, graph_name) << std::endl; - - return exit_success; -} diff --git a/Utilities/BGL/boost/graph/example/graphviz.cpp b/Utilities/BGL/boost/graph/example/graphviz.cpp deleted file mode 100644 index e3ac9b8f28cf77f427b46f9488934dd5c2c24439..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/graphviz.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2005 Trustees of Indiana University - -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Author: Douglas Gregor -#include <boost/graph/graphviz.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/test/minimal.hpp> -#include <string> -#include <fstream> -#include <boost/graph/iteration_macros.hpp> - -using namespace boost; - -typedef boost::adjacency_list<vecS, vecS, directedS, - property<vertex_name_t, std::string>, - property<edge_weight_t, double> > Digraph; - -typedef boost::adjacency_list<vecS, vecS, undirectedS, - property<vertex_name_t, std::string>, - property<edge_weight_t, double> > Graph; - -void test_graph_read_write(const std::string& filename) -{ - std::ifstream in(filename.c_str()); - BOOST_REQUIRE(in); - - Graph g; - dynamic_properties dp; - dp.property("id", get(vertex_name, g)); - dp.property("weight", get(edge_weight, g)); - BOOST_CHECK(read_graphviz(in, g, dp, "id")); - - BOOST_CHECK(num_vertices(g) == 4); - BOOST_CHECK(num_edges(g) == 4); - - typedef graph_traits<Graph>::vertex_descriptor Vertex; - - std::map<std::string, Vertex> name_to_vertex; - BGL_FORALL_VERTICES(v, g, Graph) - name_to_vertex[get(vertex_name, g, v)] = v; - - // Check vertices - BOOST_CHECK(name_to_vertex.find("0") != name_to_vertex.end()); - BOOST_CHECK(name_to_vertex.find("1") != name_to_vertex.end()); - BOOST_CHECK(name_to_vertex.find("foo") != name_to_vertex.end()); - BOOST_CHECK(name_to_vertex.find("bar") != name_to_vertex.end()); - - // Check edges - BOOST_CHECK(edge(name_to_vertex["0"], name_to_vertex["1"], g).second); - BOOST_CHECK(edge(name_to_vertex["1"], name_to_vertex["foo"], g).second); - BOOST_CHECK(edge(name_to_vertex["foo"], name_to_vertex["bar"], g).second); - BOOST_CHECK(edge(name_to_vertex["1"], name_to_vertex["bar"], g).second); - - BOOST_CHECK(get(edge_weight, g, - edge(name_to_vertex["0"], name_to_vertex["1"], g).first) - == 3.14159); - BOOST_CHECK(get(edge_weight, g, - edge(name_to_vertex["1"], name_to_vertex["foo"], g).first) - == 2.71828); - BOOST_CHECK(get(edge_weight, g, - edge(name_to_vertex["foo"], name_to_vertex["bar"], g).first) - == 10.0); - BOOST_CHECK(get(edge_weight, g, - edge(name_to_vertex["1"], name_to_vertex["bar"], g).first) - == 10.0); - - // Write out the graph - write_graphviz(std::cout, g, dp, std::string("id")); -} - -int test_main(int, char*[]) -{ - test_graph_read_write("graphviz_example.dot"); - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/graphviz_example.dot b/Utilities/BGL/boost/graph/example/graphviz_example.dot deleted file mode 100644 index 775824795aed24e3db90a7e4624f7ca61400c661..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/graphviz_example.dot +++ /dev/null @@ -1,7 +0,0 @@ -graph foo { - edge [weight="10"]; - 0 -- 1 [weight="3.14159"]; - 1 -- foo [weight="2.71828"]; - foo -- bar; - bar -- 1; -} diff --git a/Utilities/BGL/boost/graph/example/graphviz_test.dot b/Utilities/BGL/boost/graph/example/graphviz_test.dot deleted file mode 100644 index c7eb4b5bdebe48568e8b8581de7cb1d0cfbf522a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/graphviz_test.dot +++ /dev/null @@ -1,39 +0,0 @@ -digraph G { - - subgraph cluster0 { //subgraph<Graph> - node [style=filled color=white]; - style = filled; - bgcolor = lightgrey; - - subgraph inner { //subgraph<Graph> or subgraph of subgraph - node [color = green]; - a1 -> a2 -> a3 - - }; - - a0 -> subgraph inner; - - label = "process #1"; - } - - subgraph cluster1 { - node [style=filled color=white]; - b0 -> b1 -> b2 -> b3; - label = "process #2"; - bgcolor = lightgrey - } - - subgraph cluster1 -> subgraph cluster0 [style=dashed color=red] - - start -> subgraph inner[style=dotted]; - - start -> a0; - start -> b0; - a1 -> b3; - b2 -> a3; - a3 -> end; - b3 -> end; - - start [shape=Mdiamond]; - end [shape=Msquare]; -} diff --git a/Utilities/BGL/boost/graph/example/in_edges.cpp b/Utilities/BGL/boost/graph/example/in_edges.cpp deleted file mode 100644 index cceb5538e03fc3a79a671fbe065281c311734c98..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/in_edges.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <vector> -#include <utility> - -#include <boost/graph/adjacency_list.hpp> - -/* - Sample Output - - 0 <-- - 1 <-- 0 - 2 <-- 1 - 3 <-- 1 - 4 <-- 2 3 - - */ - -int main(int , char* []) -{ - using namespace boost; - using namespace std; - using namespace boost; - - typedef adjacency_list<listS,vecS,bidirectionalS> Graph; - const int num_vertices = 5; - Graph g(num_vertices); - - add_edge(0, 1, g); - add_edge(1, 2, g); - add_edge(1, 3, g); - add_edge(2, 4, g); - add_edge(3, 4, g); - - boost::graph_traits<Graph>::vertex_iterator i, end; - boost::graph_traits<Graph>::in_edge_iterator ei, edge_end; - - for(tie(i,end) = vertices(g); i != end; ++i) { - cout << *i << " <-- "; - for (tie(ei,edge_end) = in_edges(*i, g); ei != edge_end; ++ei) - cout << source(*ei, g) << " "; - cout << endl; - } - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/in_edges.expected b/Utilities/BGL/boost/graph/example/in_edges.expected deleted file mode 100644 index b7ed0a68ef364a33493bd34ba3ef78426269fa20..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/in_edges.expected +++ /dev/null @@ -1,5 +0,0 @@ -0 <-- -1 <-- 0 -2 <-- 1 -3 <-- 1 -4 <-- 2 3 diff --git a/Utilities/BGL/boost/graph/example/incremental-components-eg.cpp b/Utilities/BGL/boost/graph/example/incremental-components-eg.cpp deleted file mode 100644 index 521963ff843d03d84d83b0e5869637dd3986a087..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/incremental-components-eg.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <vector> -#include <algorithm> -#include <utility> -#include <boost/graph/adjacency_list.hpp> -#include <boost/pending/disjoint_sets.hpp> -#include <boost/graph/incremental_components.hpp> - -int -main(int, char *[]) -{ - using namespace boost; - // Create a graph - typedef adjacency_list < vecS, vecS, undirectedS > Graph; - typedef graph_traits < Graph >::vertex_descriptor Vertex; - const int N = 6; - Graph G(N); - add_edge(0, 1, G); - add_edge(1, 4, G); - // create the disjoint-sets object, which requires rank and parent vertex properties - std::vector < Vertex > rank(num_vertices(G)); - std::vector < Vertex > parent(num_vertices(G)); - typedef graph_traits<Graph>::vertices_size_type* Rank; - typedef Vertex* Parent; - disjoint_sets < Rank, Parent > ds(&rank[0], &parent[0]); - - // determine the connected components, storing the results in the disjoint-sets object - initialize_incremental_components(G, ds); - incremental_components(G, ds); - - // Add a couple more edges and update the disjoint-sets - graph_traits < Graph >::edge_descriptor e; - bool flag; - tie(e, flag) = add_edge(4, 0, G); - ds.union_set(4, 0); - tie(e, flag) = add_edge(2, 5, G); - ds.union_set(2, 5); - - graph_traits < Graph >::vertex_iterator iter, end; - for (tie(iter, end) = vertices(G); iter != end; ++iter) - std::cout << "representative[" << *iter << "] = " << - ds.find_set(*iter) << std::endl;; - std::cout << std::endl; - - typedef component_index < unsigned int >Components; - Components components(parent.begin(), parent.end()); - for (Components::size_type i = 0; i < components.size(); ++i) { - std::cout << "component " << i << " contains: "; - for (Components::value_type::iterator j = components[i].begin(); - j != components[i].end(); ++j) - std::cout << *j << " "; - std::cout << std::endl; - } - - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/incremental_components.cpp b/Utilities/BGL/boost/graph/example/incremental_components.cpp deleted file mode 100644 index 9e235d2cd92fc94308553cf7f6453199eefd761f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/incremental_components.cpp +++ /dev/null @@ -1,108 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <vector> -#include <algorithm> -#include <utility> -#include <boost/graph/graph_utility.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/pending/disjoint_sets.hpp> -#include <boost/graph/incremental_components.hpp> - -/* - - This example shows how to use the disjoint set data structure - to compute the connected components of an undirected, changing - graph. - - Sample output: - - An undirected graph: - 0 <--> 1 4 - 1 <--> 0 4 - 2 <--> 5 - 3 <--> - 4 <--> 1 0 - 5 <--> 2 - - representative[0] = 1 - representative[1] = 1 - representative[2] = 5 - representative[3] = 3 - representative[4] = 1 - representative[5] = 5 - - component 0 contains: 4 1 0 - component 1 contains: 3 - component 2 contains: 5 2 - - */ - -using namespace std; - -int main(int , char* []) -{ - using namespace boost; - typedef adjacency_list <vecS, vecS, undirectedS> Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::vertices_size_type size_type; - - const int N = 6; - Graph G(N); - - std::vector<size_type> rank(num_vertices(G)); - std::vector<Vertex> parent(num_vertices(G)); - typedef size_type* Rank; - typedef Vertex* Parent; - disjoint_sets<Rank, Parent> ds(&rank[0], &parent[0]); - - initialize_incremental_components(G, ds); - incremental_components(G, ds); - - graph_traits<Graph>::edge_descriptor e; - bool flag; - boost::tie(e,flag) = add_edge(0, 1, G); - ds.union_set(0,1); - - boost::tie(e,flag) = add_edge(1, 4, G); - ds.union_set(1,4); - - boost::tie(e,flag) = add_edge(4, 0, G); - ds.union_set(4,0); - - boost::tie(e,flag) = add_edge(2, 5, G); - ds.union_set(2,5); - - cout << "An undirected graph:" << endl; - print_graph(G, get(vertex_index, G)); - cout << endl; - - graph_traits<Graph>::vertex_iterator i,end; - for (boost::tie(i, end) = vertices(G); i != end; ++i) - cout << "representative[" << *i << "] = " << - ds.find_set(*i) << endl;; - cout << endl; - - typedef component_index<unsigned int> Components; - Components components(&parent[0], &parent[0] + parent.size()); - - for (Components::size_type c = 0; c < components.size(); ++c) { - cout << "component " << c << " contains: "; - Components::value_type::iterator - j = components[c].begin(), - jend = components[c].end(); - for ( ; j != jend; ++j) - cout << *j << " "; - cout << endl; - } - - return 0; -} - diff --git a/Utilities/BGL/boost/graph/example/incremental_components.expected b/Utilities/BGL/boost/graph/example/incremental_components.expected deleted file mode 100644 index c1e0b510686b2209ed8929dc94d02cb940eecc04..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/incremental_components.expected +++ /dev/null @@ -1,18 +0,0 @@ -An undirected graph: -0 <--> 1 4 -1 <--> 0 4 -2 <--> 5 -3 <--> -4 <--> 1 0 -5 <--> 2 - -representative[0] = 1 -representative[1] = 1 -representative[2] = 5 -representative[3] = 3 -representative[4] = 1 -representative[5] = 5 - -component 0 contains: 4 1 0 -component 1 contains: 3 -component 2 contains: 5 2 diff --git a/Utilities/BGL/boost/graph/example/interior_pmap_bundled.cpp b/Utilities/BGL/boost/graph/example/interior_pmap_bundled.cpp deleted file mode 100644 index 09cd8dec2d66bcfc15e6177566342c5c316a1847..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/interior_pmap_bundled.cpp +++ /dev/null @@ -1,92 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Copyright 2004 Trustees of Indiana University -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, Douglas Gregor -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#include <boost/config.hpp> -#include <iostream> -#include <algorithm> -#include <boost/graph/adjacency_list.hpp> -#include <boost/property_map.hpp> -#include <string> - -using namespace std; -using namespace boost; - -/* - Interior Property Map Basics - - An interior property map is a way of associating properties - with the vertices or edges of a graph. The "interior" part means - that the properties are stored inside the graph object. This can be - convenient when the need for the properties is somewhat permanent, - and when the properties will be with a graph for the duration of its - lifetime. A "distance from source vertex" property is often of this - kind. - - Sample Output - - Jeremy owes Rich some money - Jeremy owes Andrew some money - Jeremy owes Jeff some money - Jeremy owes Kinis some money - Andrew owes Jeremy some money - Andrew owes Kinis some money - Jeff owes Jeremy some money - Jeff owes Rich some money - Jeff owes Kinis some money - Kinis owes Jeremy some money - Kinis owes Rich some money - - */ - -template <class EdgeIter, class Graph> -void who_owes_who(EdgeIter first, EdgeIter last, const Graph& G) -{ - while (first != last) { - cout << G[source(*first, G)].first_name << " owes " - << G[target(*first, G)].first_name << " some money" << endl; - ++first; - } -} - -struct VertexData -{ - string first_name; -}; - -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; - - typedef pair<int,int> Pair; - 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) }; - - MyGraphType G(5); - for (int i=0; i<11; ++i) - add_edge(edge_array[i].first, edge_array[i].second, G); - - G[0].first_name = "Jeremy"; - G[1].first_name = "Rich"; - G[2].first_name = "Andrew"; - G[3].first_name = "Jeff"; - G[4].first_name = "Doug"; - - who_owes_who(edges(G).first, edges(G).second, G); - } - - cout << endl; - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/interior_property_map.cpp b/Utilities/BGL/boost/graph/example/interior_property_map.cpp deleted file mode 100644 index dde734d93a6c2ff397e338bc6a5ca211ebeb5ead..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/interior_property_map.cpp +++ /dev/null @@ -1,108 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#include <boost/config.hpp> -#include <iostream> -#include <algorithm> -#include <boost/graph/adjacency_list.hpp> -#include <boost/property_map.hpp> -#include <string> - -using namespace std; -using namespace boost; - -/* - Interior Property Map Basics - - An interior property map is a way of associating properties - with the vertices or edges of a graph. The "interior" part means - that the properties are stored inside the graph object. This can be - convenient when the need for the properties is somewhat permanent, - and when the properties will be with a graph for the duration of its - lifetime. A "distance from source vertex" property is often of this - kind. - - Sample Output - - Jeremy owes Rich some money - Jeremy owes Andrew some money - Jeremy owes Jeff some money - Jeremy owes Kinis some money - Andrew owes Jeremy some money - Andrew owes Kinis some money - Jeff owes Jeremy some money - Jeff owes Rich some money - Jeff owes Kinis some money - Kinis owes Jeremy some money - Kinis owes Rich some money - - */ - -// create a tag for our new property - -enum vertex_first_name_t { vertex_first_name }; -namespace boost { - BOOST_INSTALL_PROPERTY(vertex, first_name); -} - -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; - NamePA name = get(vertex_first_name, G); - - typedef typename boost::property_traits<NamePA>::value_type NameType; - - NameType src_name, targ_name; - - while (first != last) { - src_name = boost::get(name, source(*first,G)); - targ_name = boost::get(name, target(*first,G)); - cout << src_name << " owes " - << targ_name << " some money" << endl; - ++first; - } -} - -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; - - typedef pair<int,int> Pair; - 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) }; - - MyGraphType G(5); - for (int i=0; i<11; ++i) - add_edge(edge_array[i].first, edge_array[i].second, G); - - property_map<MyGraphType, vertex_first_name_t>::type name - = get(vertex_first_name, G); - - boost::put(name, 0, "Jeremy"); - boost::put(name, 1, "Rich"); - boost::put(name, 2, "Andrew"); - boost::put(name, 3, "Jeff"); - name[4] = "Kinis"; // you can use operator[] too - - who_owes_who(edges(G).first, edges(G).second, G); - } - - cout << endl; - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/interior_property_map.expected b/Utilities/BGL/boost/graph/example/interior_property_map.expected deleted file mode 100644 index 5148599f0e3c25c012884ee270c3eefc58108111..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/interior_property_map.expected +++ /dev/null @@ -1,12 +0,0 @@ -Jeremy owes Rich some money -Jeremy owes Andrew some money -Jeremy owes Jeff some money -Jeremy owes Kinis some money -Andrew owes Jeremy some money -Andrew owes Kinis some money -Jeff owes Jeremy some money -Jeff owes Rich some money -Jeff owes Kinis some money -Kinis owes Jeremy some money -Kinis owes Rich some money - diff --git a/Utilities/BGL/boost/graph/example/iohb.c b/Utilities/BGL/boost/graph/example/iohb.c deleted file mode 100644 index d0001621db734b191718430a89a5cbc756f40f6d..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/iohb.c +++ /dev/null @@ -1,1610 +0,0 @@ -// (C) Copyright Jeremy Siek 2004 -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -/* -Fri Aug 15 16:29:47 EDT 1997 - - Harwell-Boeing File I/O in C - V. 1.0 - - National Institute of Standards and Technology, MD. - K.A. Remington - -++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - NOTICE - - Permission to use, copy, modify, and distribute this software and - its documentation for any purpose and without fee is hereby granted - provided that the above copyright notice appear in all copies and - that both the copyright notice and this permission notice appear in - supporting documentation. - - Neither the Author nor the Institution (National Institute of Standards - and Technology) make any representations about the suitability of this - software for any purpose. This software is provided "as is" without - expressed or implied warranty. -++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - - --------------------- - INTERFACE DESCRIPTION - --------------------- - --------------- - QUERY FUNCTIONS - --------------- - - FUNCTION: - - int readHB_info(const char *filename, int *M, int *N, int *nz, - char **Type, int *Nrhs) - - DESCRIPTION: - - The readHB_info function opens and reads the header information from - the specified Harwell-Boeing file, and reports back the number of rows - and columns in the stored matrix (M and N), the number of nonzeros in - the matrix (nz), the 3-character matrix type(Type), and the number of - right-hand-sides stored along with the matrix (Nrhs). This function - is designed to retrieve basic size information which can be used to - allocate arrays. - - FUNCTION: - - int readHB_header(FILE* in_file, char* Title, char* Key, char* Type, - int* Nrow, int* Ncol, int* Nnzero, int* Nrhs, - char* Ptrfmt, char* Indfmt, char* Valfmt, char* Rhsfmt, - int* Ptrcrd, int* Indcrd, int* Valcrd, int* Rhscrd, - char *Rhstype) - - DESCRIPTION: - - More detailed than the readHB_info function, readHB_header() reads from - the specified Harwell-Boeing file all of the header information. - - - ------------------------------ - DOUBLE PRECISION I/O FUNCTIONS - ------------------------------ - FUNCTION: - - int readHB_newmat_double(const char *filename, int *M, int *N, *int nz, - int **colptr, int **rowind, double**val) - - int readHB_mat_double(const char *filename, int *colptr, int *rowind, - double*val) - - - DESCRIPTION: - - This function opens and reads the specified file, interpreting its - contents as a sparse matrix stored in the Harwell/Boeing standard - format. (See readHB_aux_double to read auxillary vectors.) - -- Values are interpreted as double precision numbers. -- - - The "mat" function uses _pre-allocated_ vectors to hold the index and - nonzero value information. - - The "newmat" function allocates vectors to hold the index and nonzero - value information, and returns pointers to these vectors along with - matrix dimension and number of nonzeros. - - FUNCTION: - - int readHB_aux_double(const char* filename, const char AuxType, double b[]) - - int readHB_newaux_double(const char* filename, const char AuxType, double** b) - - DESCRIPTION: - - This function opens and reads from the specified file auxillary vector(s). - The char argument Auxtype determines which type of auxillary vector(s) - will be read (if present in the file). - - AuxType = 'F' right-hand-side - AuxType = 'G' initial estimate (Guess) - AuxType = 'X' eXact solution - - If Nrhs > 1, all of the Nrhs vectors of the given type are read and - stored in column-major order in the vector b. - - The "newaux" function allocates a vector to hold the values retrieved. - The "mat" function uses a _pre-allocated_ vector to hold the values. - - FUNCTION: - - int writeHB_mat_double(const char* filename, int M, int N, - int nz, const int colptr[], const int rowind[], - const double val[], int Nrhs, const double rhs[], - const double guess[], const double exact[], - const char* Title, const char* Key, const char* Type, - char* Ptrfmt, char* Indfmt, char* Valfmt, char* Rhsfmt, - const char* Rhstype) - - DESCRIPTION: - - The writeHB_mat_double function opens the named file and writes the specified - matrix and optional auxillary vector(s) to that file in Harwell-Boeing - format. The format arguments (Ptrfmt,Indfmt,Valfmt, and Rhsfmt) are - character strings specifying "Fortran-style" output formats -- as they - would appear in a Harwell-Boeing file. They are used to produce output - which is as close as possible to what would be produced by Fortran code, - but note that "D" and "P" edit descriptors are not supported. - If NULL, the following defaults will be used: - Ptrfmt = Indfmt = "(8I10)" - Valfmt = Rhsfmt = "(4E20.13)" - - ----------------------- - CHARACTER I/O FUNCTIONS - ----------------------- - FUNCTION: - - int readHB_mat_char(const char* filename, int colptr[], int rowind[], - char val[], char* Valfmt) - int readHB_newmat_char(const char* filename, int* M, int* N, int* nonzeros, - int** colptr, int** rowind, char** val, char** Valfmt) - - DESCRIPTION: - - This function opens and reads the specified file, interpreting its - contents as a sparse matrix stored in the Harwell/Boeing standard - format. (See readHB_aux_char to read auxillary vectors.) - -- Values are interpreted as char strings. -- - (Used to translate exact values from the file into a new storage format.) - - The "mat" function uses _pre-allocated_ arrays to hold the index and - nonzero value information. - - The "newmat" function allocates char arrays to hold the index - and nonzero value information, and returns pointers to these arrays - along with matrix dimension and number of nonzeros. - - FUNCTION: - - int readHB_aux_char(const char* filename, const char AuxType, char b[]) - int readHB_newaux_char(const char* filename, const char AuxType, char** b, - char** Rhsfmt) - - DESCRIPTION: - - This function opens and reads from the specified file auxillary vector(s). - The char argument Auxtype determines which type of auxillary vector(s) - will be read (if present in the file). - - AuxType = 'F' right-hand-side - AuxType = 'G' initial estimate (Guess) - AuxType = 'X' eXact solution - - If Nrhs > 1, all of the Nrhs vectors of the given type are read and - stored in column-major order in the vector b. - - The "newaux" function allocates a character array to hold the values - retrieved. - The "mat" function uses a _pre-allocated_ array to hold the values. - - FUNCTION: - - int writeHB_mat_char(const char* filename, int M, int N, - int nz, const int colptr[], const int rowind[], - const char val[], int Nrhs, const char rhs[], - const char guess[], const char exact[], - const char* Title, const char* Key, const char* Type, - char* Ptrfmt, char* Indfmt, char* Valfmt, char* Rhsfmt, - const char* Rhstype) - - DESCRIPTION: - - The writeHB_mat_char function opens the named file and writes the specified - matrix and optional auxillary vector(s) to that file in Harwell-Boeing - format. The format arguments (Ptrfmt,Indfmt,Valfmt, and Rhsfmt) are - character strings specifying "Fortran-style" output formats -- as they - would appear in a Harwell-Boeing file. Valfmt and Rhsfmt must accurately - represent the character representation of the values stored in val[] - and rhs[]. - - If NULL, the following defaults will be used for the integer vectors: - Ptrfmt = Indfmt = "(8I10)" - Valfmt = Rhsfmt = "(4E20.13)" - - -*/ - -/*---------------------------------------------------------------------*/ -/* If zero-based indexing is desired, _SP_base should be set to 0 */ -/* This will cause indices read from H-B files to be decremented by 1 */ -/* and indices written to H-B files to be incremented by 1 */ -/* <<< Standard usage is _SP_base = 1 >>> */ -#ifndef _SP_base -#define _SP_base 1 -#endif -/*---------------------------------------------------------------------*/ - -#include "iohb.h" -#include<stdio.h> -#include<stdlib.h> -#include<string.h> -#include<math.h> - -char* substr(const char* S, const int pos, const int len); -void upcase(char* S); -void IOHBTerminate(char* message); - -int readHB_info(const char* filename, int* M, int* N, int* nz, char** Type, - int* Nrhs) -{ -/****************************************************************************/ -/* The readHB_info function opens and reads the header information from */ -/* the specified Harwell-Boeing file, and reports back the number of rows */ -/* and columns in the stored matrix (M and N), the number of nonzeros in */ -/* the matrix (nz), and the number of right-hand-sides stored along with */ -/* the matrix (Nrhs). */ -/* */ -/* For a description of the Harwell Boeing standard, see: */ -/* Duff, et al., ACM TOMS Vol.15, No.1, March 1989 */ -/* */ -/* ---------- */ -/* **CAVEAT** */ -/* ---------- */ -/* ** If the input file does not adhere to the H/B format, the ** */ -/* ** results will be unpredictable. ** */ -/* */ -/****************************************************************************/ - FILE *in_file; - int Ptrcrd, Indcrd, Valcrd, Rhscrd; - int Nrow, Ncol, Nnzero; - char* mat_type; - char Title[73], Key[9], Rhstype[4]; - char Ptrfmt[17], Indfmt[17], Valfmt[21], Rhsfmt[21]; - - mat_type = *Type; - if ( mat_type == NULL ) IOHBTerminate("Insufficient memory for mat_typen"); - - if ( (in_file = fopen( filename, "r")) == NULL ) { - fprintf(stderr,"Error: Cannot open file: %s\n",filename); - return 0; - } - - readHB_header(in_file, Title, Key, mat_type, &Nrow, &Ncol, &Nnzero, Nrhs, - Ptrfmt, Indfmt, Valfmt, Rhsfmt, - &Ptrcrd, &Indcrd, &Valcrd, &Rhscrd, Rhstype); - fclose(in_file); - *Type = mat_type; - *(*Type+3) = (char) NULL; - *M = Nrow; - *N = Ncol; - *nz = Nnzero; - if (Rhscrd == 0) {*Nrhs = 0;} - -/* In verbose mode, print some of the header information: */ -/* - if (verbose == 1) - { - printf("Reading from Harwell-Boeing file %s (verbose on)...\n",filename); - printf(" Title: %s\n",Title); - printf(" Key: %s\n",Key); - printf(" The stored matrix is %i by %i with %i nonzeros.\n", - *M, *N, *nz ); - printf(" %i right-hand--side(s) stored.\n",*Nrhs); - } -*/ - - return 1; - -} - - - -int readHB_header(FILE* in_file, char* Title, char* Key, char* Type, - int* Nrow, int* Ncol, int* Nnzero, int* Nrhs, - char* Ptrfmt, char* Indfmt, char* Valfmt, char* Rhsfmt, - int* Ptrcrd, int* Indcrd, int* Valcrd, int* Rhscrd, - char *Rhstype) -{ -/*************************************************************************/ -/* Read header information from the named H/B file... */ -/*************************************************************************/ - int Totcrd,Neltvl,Nrhsix; - char line[BUFSIZ]; - -/* First line: */ - fgets(line, BUFSIZ, in_file); - if ( sscanf(line,"%*s") < 0 ) - IOHBTerminate("iohb.c: Null (or blank) first line of HB file.\n"); - (void) sscanf(line, "%72c%8[^\n]", Title, Key); - *(Key+8) = (char) NULL; - *(Title+72) = (char) NULL; - -/* Second line: */ - fgets(line, BUFSIZ, in_file); - if ( sscanf(line,"%*s") < 0 ) - IOHBTerminate("iohb.c: Null (or blank) second line of HB file.\n"); - if ( sscanf(line,"%i",&Totcrd) != 1) Totcrd = 0; - if ( sscanf(line,"%*i%i",Ptrcrd) != 1) *Ptrcrd = 0; - if ( sscanf(line,"%*i%*i%i",Indcrd) != 1) *Indcrd = 0; - if ( sscanf(line,"%*i%*i%*i%i",Valcrd) != 1) *Valcrd = 0; - if ( sscanf(line,"%*i%*i%*i%*i%i",Rhscrd) != 1) *Rhscrd = 0; - -/* Third line: */ - fgets(line, BUFSIZ, in_file); - if ( sscanf(line,"%*s") < 0 ) - IOHBTerminate("iohb.c: Null (or blank) third line of HB file.\n"); - if ( sscanf(line, "%3c", Type) != 1) - IOHBTerminate("iohb.c: Invalid Type info, line 3 of Harwell-Boeing file.\n"); - upcase(Type); - if ( sscanf(line,"%*3c%i",Nrow) != 1) *Nrow = 0 ; - if ( sscanf(line,"%*3c%*i%i",Ncol) != 1) *Ncol = 0 ; - if ( sscanf(line,"%*3c%*i%*i%i",Nnzero) != 1) *Nnzero = 0 ; - if ( sscanf(line,"%*3c%*i%*i%*i%i",&Neltvl) != 1) Neltvl = 0 ; - -/* Fourth line: */ - fgets(line, BUFSIZ, in_file); - if ( sscanf(line,"%*s") < 0 ) - IOHBTerminate("iohb.c: Null (or blank) fourth line of HB file.\n"); - if ( sscanf(line, "%16c",Ptrfmt) != 1) - IOHBTerminate("iohb.c: Invalid format info, line 4 of Harwell-Boeing file.\n"); - if ( sscanf(line, "%*16c%16c",Indfmt) != 1) - IOHBTerminate("iohb.c: Invalid format info, line 4 of Harwell-Boeing file.\n"); - if ( sscanf(line, "%*16c%*16c%20c",Valfmt) != 1) - IOHBTerminate("iohb.c: Invalid format info, line 4 of Harwell-Boeing file.\n"); - sscanf(line, "%*16c%*16c%*20c%20c",Rhsfmt); - *(Ptrfmt+16) = (char) NULL; - *(Indfmt+16) = (char) NULL; - *(Valfmt+20) = (char) NULL; - *(Rhsfmt+20) = (char) NULL; - -/* (Optional) Fifth line: */ - if (*Rhscrd != 0 ) - { - fgets(line, BUFSIZ, in_file); - if ( sscanf(line,"%*s") < 0 ) - IOHBTerminate("iohb.c: Null (or blank) fifth line of HB file.\n"); - if ( sscanf(line, "%3c", Rhstype) != 1) - IOHBTerminate("iohb.c: Invalid RHS type information, line 5 of Harwell-Boeing file.\n"); - if ( sscanf(line, "%*3c%i", Nrhs) != 1) *Nrhs = 0; - if ( sscanf(line, "%*3c%*i%i", &Nrhsix) != 1) Nrhsix = 0; - } - return 1; -} - - -int readHB_mat_double(const char* filename, int colptr[], int rowind[], - double val[]) -{ -/****************************************************************************/ -/* This function opens and reads the specified file, interpreting its */ -/* contents as a sparse matrix stored in the Harwell/Boeing standard */ -/* format and creating compressed column storage scheme vectors to hold */ -/* the index and nonzero value information. */ -/* */ -/* ---------- */ -/* **CAVEAT** */ -/* ---------- */ -/* Parsing real formats from Fortran is tricky, and this file reader */ -/* does not claim to be foolproof. It has been tested for cases when */ -/* the real values are printed consistently and evenly spaced on each */ -/* line, with Fixed (F), and Exponential (E or D) formats. */ -/* */ -/* ** If the input file does not adhere to the H/B format, the ** */ -/* ** results will be unpredictable. ** */ -/* */ -/****************************************************************************/ - FILE *in_file; - int i,j,ind,col,offset,count,last,Nrhs; - int Ptrcrd, Indcrd, Valcrd, Rhscrd; - int Nrow, Ncol, Nnzero, Nentries; - int Ptrperline, Ptrwidth, Indperline, Indwidth; - int Valperline, Valwidth, Valprec; - int Valflag; /* Indicates 'E','D', or 'F' float format */ - char* ThisElement; - char Title[73], Key[8], Type[4], Rhstype[4]; - char Ptrfmt[17], Indfmt[17], Valfmt[21], Rhsfmt[21]; - char line[BUFSIZ]; - - if ( (in_file = fopen( filename, "r")) == NULL ) { - fprintf(stderr,"Error: Cannot open file: %s\n",filename); - return 0; - } - - readHB_header(in_file, Title, Key, Type, &Nrow, &Ncol, &Nnzero, &Nrhs, - Ptrfmt, Indfmt, Valfmt, Rhsfmt, - &Ptrcrd, &Indcrd, &Valcrd, &Rhscrd, Rhstype); - -/* Parse the array input formats from Line 3 of HB file */ - ParseIfmt(Ptrfmt,&Ptrperline,&Ptrwidth); - ParseIfmt(Indfmt,&Indperline,&Indwidth); - if ( Type[0] != 'P' ) { /* Skip if pattern only */ - ParseRfmt(Valfmt,&Valperline,&Valwidth,&Valprec,&Valflag); - } - -/* Read column pointer array: */ - - offset = 1-_SP_base; /* if base 0 storage is declared (via macro definition), */ - /* then storage entries are offset by 1 */ - - ThisElement = (char *) malloc(Ptrwidth+1); - if ( ThisElement == NULL ) IOHBTerminate("Insufficient memory for ThisElement."); - *(ThisElement+Ptrwidth) = (char) NULL; - count=0; - for (i=0;i<Ptrcrd;i++) - { - fgets(line, BUFSIZ, in_file); - if ( sscanf(line,"%*s") < 0 ) - IOHBTerminate("iohb.c: Null (or blank) line in pointer data region of HB file.\n"); - col = 0; - for (ind = 0;ind<Ptrperline;ind++) - { - if (count > Ncol) break; - strncpy(ThisElement,line+col,Ptrwidth); - /* ThisElement = substr(line,col,Ptrwidth); */ - colptr[count] = atoi(ThisElement)-offset; - count++; col += Ptrwidth; - } - } - free(ThisElement); - -/* Read row index array: */ - - ThisElement = (char *) malloc(Indwidth+1); - if ( ThisElement == NULL ) IOHBTerminate("Insufficient memory for ThisElement."); - *(ThisElement+Indwidth) = (char) NULL; - count = 0; - for (i=0;i<Indcrd;i++) - { - fgets(line, BUFSIZ, in_file); - if ( sscanf(line,"%*s") < 0 ) - IOHBTerminate("iohb.c: Null (or blank) line in index data region of HB file.\n"); - col = 0; - for (ind = 0;ind<Indperline;ind++) - { - if (count == Nnzero) break; - strncpy(ThisElement,line+col,Indwidth); -/* ThisElement = substr(line,col,Indwidth); */ - rowind[count] = atoi(ThisElement)-offset; - count++; col += Indwidth; - } - } - free(ThisElement); - -/* Read array of values: */ - - if ( Type[0] != 'P' ) { /* Skip if pattern only */ - - if ( Type[0] == 'C' ) Nentries = 2*Nnzero; - else Nentries = Nnzero; - - ThisElement = (char *) malloc(Valwidth+1); - if ( ThisElement == NULL ) IOHBTerminate("Insufficient memory for ThisElement."); - *(ThisElement+Valwidth) = (char) NULL; - count = 0; - for (i=0;i<Valcrd;i++) - { - fgets(line, BUFSIZ, in_file); - if ( sscanf(line,"%*s") < 0 ) - IOHBTerminate("iohb.c: Null (or blank) line in value data region of HB file.\n"); - if (Valflag == 'D') { - while( strchr(line,'D') ) *strchr(line,'D') = 'E'; -/* *strchr(Valfmt,'D') = 'E'; */ - } - col = 0; - for (ind = 0;ind<Valperline;ind++) - { - if (count == Nentries) break; - strncpy(ThisElement,line+col,Valwidth); - /*ThisElement = substr(line,col,Valwidth);*/ - if ( Valflag != 'F' && strchr(ThisElement,'E') == NULL ) { - /* insert a char prefix for exp */ - last = strlen(ThisElement); - for (j=last+1;j>=0;j--) { - ThisElement[j] = ThisElement[j-1]; - if ( ThisElement[j] == '+' || ThisElement[j] == '-' ) { - ThisElement[j-1] = Valflag; - break; - } - } - } - val[count] = atof(ThisElement); - count++; col += Valwidth; - } - } - free(ThisElement); - } - - fclose(in_file); - return 1; -} - -int readHB_newmat_double(const char* filename, int* M, int* N, int* nonzeros, - int** colptr, int** rowind, double** val) -{ - int Nrhs; - char *Type; - - readHB_info(filename, M, N, nonzeros, &Type, &Nrhs); - - *colptr = (int *)malloc((*N+1)*sizeof(int)); - if ( *colptr == NULL ) IOHBTerminate("Insufficient memory for colptr.\n"); - *rowind = (int *)malloc(*nonzeros*sizeof(int)); - if ( *rowind == NULL ) IOHBTerminate("Insufficient memory for rowind.\n"); - if ( Type[0] == 'C' ) { -/* - fprintf(stderr, "Warning: Reading complex data from HB file %s.\n",filename); - fprintf(stderr, " Real and imaginary parts will be interlaced in val[].\n"); -*/ - /* Malloc enough space for real AND imaginary parts of val[] */ - *val = (double *)malloc(*nonzeros*sizeof(double)*2); - if ( *val == NULL ) IOHBTerminate("Insufficient memory for val.\n"); - } else { - if ( Type[0] != 'P' ) { - /* Malloc enough space for real array val[] */ - *val = (double *)malloc(*nonzeros*sizeof(double)); - if ( *val == NULL ) IOHBTerminate("Insufficient memory for val.\n"); - } - } /* No val[] space needed if pattern only */ - return readHB_mat_double(filename, *colptr, *rowind, *val); - -} - -int readHB_aux_double(const char* filename, const char AuxType, double b[]) -{ -/****************************************************************************/ -/* This function opens and reads the specified file, placing auxillary */ -/* vector(s) of the given type (if available) in b. */ -/* Return value is the number of vectors successfully read. */ -/* */ -/* AuxType = 'F' full right-hand-side vector(s) */ -/* AuxType = 'G' initial Guess vector(s) */ -/* AuxType = 'X' eXact solution vector(s) */ -/* */ -/* ---------- */ -/* **CAVEAT** */ -/* ---------- */ -/* Parsing real formats from Fortran is tricky, and this file reader */ -/* does not claim to be foolproof. It has been tested for cases when */ -/* the real values are printed consistently and evenly spaced on each */ -/* line, with Fixed (F), and Exponential (E or D) formats. */ -/* */ -/* ** If the input file does not adhere to the H/B format, the ** */ -/* ** results will be unpredictable. ** */ -/* */ -/****************************************************************************/ - FILE *in_file; - int i,j,n,maxcol,start,stride,col,last,linel; - int Ptrcrd, Indcrd, Valcrd, Rhscrd; - int Nrow, Ncol, Nnzero, Nentries; - int Nrhs, nvecs, rhsi; - int Rhsperline, Rhswidth, Rhsprec; - int Rhsflag; - char *ThisElement; - char Title[73], Key[9], Type[4], Rhstype[4]; - char Ptrfmt[17], Indfmt[17], Valfmt[21], Rhsfmt[21]; - char line[BUFSIZ]; - - if ((in_file = fopen( filename, "r")) == NULL) { - fprintf(stderr,"Error: Cannot open file: %s\n",filename); - return 0; - } - - readHB_header(in_file, Title, Key, Type, &Nrow, &Ncol, &Nnzero, &Nrhs, - Ptrfmt, Indfmt, Valfmt, Rhsfmt, - &Ptrcrd, &Indcrd, &Valcrd, &Rhscrd, Rhstype); - - if (Nrhs <= 0) - { - fprintf(stderr, "Warn: Attempt to read auxillary vector(s) when none are present.\n"); - return 0; - } - if (Rhstype[0] != 'F' ) - { - fprintf(stderr,"Warn: Attempt to read auxillary vector(s) which are not stored in Full form.\n"); - fprintf(stderr," Rhs must be specified as full. \n"); - return 0; - } - -/* If reading complex data, allow for interleaved real and imaginary values. */ - if ( Type[0] == 'C' ) { - Nentries = 2*Nrow; - } else { - Nentries = Nrow; - } - - nvecs = 1; - - if ( Rhstype[1] == 'G' ) nvecs++; - if ( Rhstype[2] == 'X' ) nvecs++; - - if ( AuxType == 'G' && Rhstype[1] != 'G' ) { - fprintf(stderr, "Warn: Attempt to read auxillary Guess vector(s) when none are present.\n"); - return 0; - } - if ( AuxType == 'X' && Rhstype[2] != 'X' ) { - fprintf(stderr, "Warn: Attempt to read auxillary eXact solution vector(s) when none are present.\n"); - return 0; - } - - ParseRfmt(Rhsfmt, &Rhsperline, &Rhswidth, &Rhsprec,&Rhsflag); - maxcol = Rhsperline*Rhswidth; - -/* Lines to skip before starting to read RHS values... */ - n = Ptrcrd + Indcrd + Valcrd; - - for (i = 0; i < n; i++) - fgets(line, BUFSIZ, in_file); - -/* start - number of initial aux vector entries to skip */ -/* to reach first vector requested */ -/* stride - number of aux vector entries to skip between */ -/* requested vectors */ - if ( AuxType == 'F' ) start = 0; - else if ( AuxType == 'G' ) start = Nentries; - else start = (nvecs-1)*Nentries; - stride = (nvecs-1)*Nentries; - - fgets(line, BUFSIZ, in_file); - linel= strchr(line,'\n')-line; - col = 0; -/* Skip to initial offset */ - - for (i=0;i<start;i++) { - if ( col >= ( maxcol<linel?maxcol:linel ) ) { - fgets(line, BUFSIZ, in_file); - linel= strchr(line,'\n')-line; - col = 0; - } - col += Rhswidth; - } - if (Rhsflag == 'D') { - while( strchr(line,'D') ) *strchr(line,'D') = 'E'; - } - -/* Read a vector of desired type, then skip to next */ -/* repeating to fill Nrhs vectors */ - - ThisElement = (char *) malloc(Rhswidth+1); - if ( ThisElement == NULL ) IOHBTerminate("Insufficient memory for ThisElement."); - *(ThisElement+Rhswidth) = (char) NULL; - for (rhsi=0;rhsi<Nrhs;rhsi++) { - - for (i=0;i<Nentries;i++) { - if ( col >= ( maxcol<linel?maxcol:linel ) ) { - fgets(line, BUFSIZ, in_file); - linel= strchr(line,'\n')-line; - if (Rhsflag == 'D') { - while( strchr(line,'D') ) *strchr(line,'D') = 'E'; - } - col = 0; - } - strncpy(ThisElement,line+col,Rhswidth); - /*ThisElement = substr(line, col, Rhswidth);*/ - if ( Rhsflag != 'F' && strchr(ThisElement,'E') == NULL ) { - /* insert a char prefix for exp */ - last = strlen(ThisElement); - for (j=last+1;j>=0;j--) { - ThisElement[j] = ThisElement[j-1]; - if ( ThisElement[j] == '+' || ThisElement[j] == '-' ) { - ThisElement[j-1] = Rhsflag; - break; - } - } - } - b[i] = atof(ThisElement); - col += Rhswidth; - } - -/* Skip any interleaved Guess/eXact vectors */ - - for (i=0;i<stride;i++) { - if ( col >= ( maxcol<linel?maxcol:linel ) ) { - fgets(line, BUFSIZ, in_file); - linel= strchr(line,'\n')-line; - col = 0; - } - col += Rhswidth; - } - - } - free(ThisElement); - - - fclose(in_file); - return Nrhs; -} - -int readHB_newaux_double(const char* filename, const char AuxType, double** b) -{ - int Nrhs,M,N,nonzeros; - char *Type; - - readHB_info(filename, &M, &N, &nonzeros, &Type, &Nrhs); - if ( Nrhs <= 0 ) { - fprintf(stderr,"Warn: Requested read of aux vector(s) when none are present.\n"); - return 0; - } else { - if ( Type[0] == 'C' ) { - fprintf(stderr, "Warning: Reading complex aux vector(s) from HB file %s.",filename); - fprintf(stderr, " Real and imaginary parts will be interlaced in b[]."); - *b = (double *)malloc(M*Nrhs*sizeof(double)*2); - if ( *b == NULL ) IOHBTerminate("Insufficient memory for rhs.\n"); - return readHB_aux_double(filename, AuxType, *b); - } else { - *b = (double *)malloc(M*Nrhs*sizeof(double)); - if ( *b == NULL ) IOHBTerminate("Insufficient memory for rhs.\n"); - return readHB_aux_double(filename, AuxType, *b); - } - } -} - -int writeHB_mat_double(const char* filename, int M, int N, - int nz, const int colptr[], const int rowind[], - const double val[], int Nrhs, const double rhs[], - const double guess[], const double exact[], - const char* Title, const char* Key, const char* Type, - char* Ptrfmt, char* Indfmt, char* Valfmt, char* Rhsfmt, - const char* Rhstype) -{ -/****************************************************************************/ -/* The writeHB function opens the named file and writes the specified */ -/* matrix and optional right-hand-side(s) to that file in Harwell-Boeing */ -/* format. */ -/* */ -/* For a description of the Harwell Boeing standard, see: */ -/* Duff, et al., ACM TOMS Vol.15, No.1, March 1989 */ -/* */ -/****************************************************************************/ - FILE *out_file; - int i,j,entry,offset,acount,linemod; - int totcrd, ptrcrd, indcrd, valcrd, rhscrd; - int nvalentries, nrhsentries; - int Ptrperline, Ptrwidth, Indperline, Indwidth; - int Rhsperline, Rhswidth, Rhsprec; - int Rhsflag; - int Valperline, Valwidth, Valprec; - int Valflag; /* Indicates 'E','D', or 'F' float format */ - char pformat[16],iformat[16],vformat[19],rformat[19]; - - if ( Type[0] == 'C' ) { - nvalentries = 2*nz; - nrhsentries = 2*M; - } else { - nvalentries = nz; - nrhsentries = M; - } - - if ( filename != NULL ) { - if ( (out_file = fopen( filename, "w")) == NULL ) { - fprintf(stderr,"Error: Cannot open file: %s\n",filename); - return 0; - } - } else out_file = stdout; - - if ( Ptrfmt == NULL ) Ptrfmt = "(8I10)"; - ParseIfmt(Ptrfmt,&Ptrperline,&Ptrwidth); - sprintf(pformat,"%%%dd",Ptrwidth); - ptrcrd = (N+1)/Ptrperline; - if ( (N+1)%Ptrperline != 0) ptrcrd++; - - if ( Indfmt == NULL ) Indfmt = Ptrfmt; - ParseIfmt(Indfmt,&Indperline,&Indwidth); - sprintf(iformat,"%%%dd",Indwidth); - indcrd = nz/Indperline; - if ( nz%Indperline != 0) indcrd++; - - if ( Type[0] != 'P' ) { /* Skip if pattern only */ - if ( Valfmt == NULL ) Valfmt = "(4E20.13)"; - ParseRfmt(Valfmt,&Valperline,&Valwidth,&Valprec,&Valflag); - if (Valflag == 'D') *strchr(Valfmt,'D') = 'E'; - if (Valflag == 'F') - sprintf(vformat,"%% %d.%df",Valwidth,Valprec); - else - sprintf(vformat,"%% %d.%dE",Valwidth,Valprec); - valcrd = nvalentries/Valperline; - if ( nvalentries%Valperline != 0) valcrd++; - } else valcrd = 0; - - if ( Nrhs > 0 ) { - if ( Rhsfmt == NULL ) Rhsfmt = Valfmt; - ParseRfmt(Rhsfmt,&Rhsperline,&Rhswidth,&Rhsprec, &Rhsflag); - if (Rhsflag == 'F') - sprintf(rformat,"%% %d.%df",Rhswidth,Rhsprec); - else - sprintf(rformat,"%% %d.%dE",Rhswidth,Rhsprec); - if (Rhsflag == 'D') *strchr(Rhsfmt,'D') = 'E'; - rhscrd = nrhsentries/Rhsperline; - if ( nrhsentries%Rhsperline != 0) rhscrd++; - if ( Rhstype[1] == 'G' ) rhscrd+=rhscrd; - if ( Rhstype[2] == 'X' ) rhscrd+=rhscrd; - rhscrd*=Nrhs; - } else rhscrd = 0; - - totcrd = 4+ptrcrd+indcrd+valcrd+rhscrd; - - -/* Print header information: */ - - fprintf(out_file,"%-72s%-8s\n%14d%14d%14d%14d%14d\n",Title, Key, totcrd, - ptrcrd, indcrd, valcrd, rhscrd); - fprintf(out_file,"%3s%11s%14d%14d%14d\n",Type," ", M, N, nz); - fprintf(out_file,"%-16s%-16s%-20s", Ptrfmt, Indfmt, Valfmt); - if ( Nrhs != 0 ) { -/* Print Rhsfmt on fourth line and */ -/* optional fifth header line for auxillary vector information: */ - fprintf(out_file,"%-20s\n%-14s%d\n",Rhsfmt,Rhstype,Nrhs); - } else fprintf(out_file,"\n"); - - offset = 1-_SP_base; /* if base 0 storage is declared (via macro definition), */ - /* then storage entries are offset by 1 */ - -/* Print column pointers: */ - for (i=0;i<N+1;i++) - { - entry = colptr[i]+offset; - fprintf(out_file,pformat,entry); - if ( (i+1)%Ptrperline == 0 ) fprintf(out_file,"\n"); - } - - if ( (N+1) % Ptrperline != 0 ) fprintf(out_file,"\n"); - -/* Print row indices: */ - for (i=0;i<nz;i++) - { - entry = rowind[i]+offset; - fprintf(out_file,iformat,entry); - if ( (i+1)%Indperline == 0 ) fprintf(out_file,"\n"); - } - - if ( nz % Indperline != 0 ) fprintf(out_file,"\n"); - -/* Print values: */ - - if ( Type[0] != 'P' ) { /* Skip if pattern only */ - - for (i=0;i<nvalentries;i++) - { - fprintf(out_file,vformat,val[i]); - if ( (i+1)%Valperline == 0 ) fprintf(out_file,"\n"); - } - - if ( nvalentries % Valperline != 0 ) fprintf(out_file,"\n"); - -/* If available, print right hand sides, - guess vectors and exact solution vectors: */ - acount = 1; - linemod = 0; - if ( Nrhs > 0 ) { - for (i=0;i<Nrhs;i++) - { - for ( j=0;j<nrhsentries;j++ ) { - fprintf(out_file,rformat,rhs[j]); - if ( acount++%Rhsperline == linemod ) fprintf(out_file,"\n"); - } - if ( acount%Rhsperline != linemod ) { - fprintf(out_file,"\n"); - linemod = (acount-1)%Rhsperline; - } - rhs += nrhsentries; - if ( Rhstype[1] == 'G' ) { - for ( j=0;j<nrhsentries;j++ ) { - fprintf(out_file,rformat,guess[j]); - if ( acount++%Rhsperline == linemod ) fprintf(out_file,"\n"); - } - if ( acount%Rhsperline != linemod ) { - fprintf(out_file,"\n"); - linemod = (acount-1)%Rhsperline; - } - guess += nrhsentries; - } - if ( Rhstype[2] == 'X' ) { - for ( j=0;j<nrhsentries;j++ ) { - fprintf(out_file,rformat,exact[j]); - if ( acount++%Rhsperline == linemod ) fprintf(out_file,"\n"); - } - if ( acount%Rhsperline != linemod ) { - fprintf(out_file,"\n"); - linemod = (acount-1)%Rhsperline; - } - exact += nrhsentries; - } - } - } - - } - - if ( fclose(out_file) != 0){ - fprintf(stderr,"Error closing file in writeHB_mat_double().\n"); - return 0; - } else return 1; - -} - -int readHB_mat_char(const char* filename, int colptr[], int rowind[], - char val[], char* Valfmt) -{ -/****************************************************************************/ -/* This function opens and reads the specified file, interpreting its */ -/* contents as a sparse matrix stored in the Harwell/Boeing standard */ -/* format and creating compressed column storage scheme vectors to hold */ -/* the index and nonzero value information. */ -/* */ -/* ---------- */ -/* **CAVEAT** */ -/* ---------- */ -/* Parsing real formats from Fortran is tricky, and this file reader */ -/* does not claim to be foolproof. It has been tested for cases when */ -/* the real values are printed consistently and evenly spaced on each */ -/* line, with Fixed (F), and Exponential (E or D) formats. */ -/* */ -/* ** If the input file does not adhere to the H/B format, the ** */ -/* ** results will be unpredictable. ** */ -/* */ -/****************************************************************************/ - FILE *in_file; - int i,j,ind,col,offset,count,last; - int Nrow,Ncol,Nnzero,Nentries,Nrhs; - int Ptrcrd, Indcrd, Valcrd, Rhscrd; - int Ptrperline, Ptrwidth, Indperline, Indwidth; - int Valperline, Valwidth, Valprec; - int Valflag; /* Indicates 'E','D', or 'F' float format */ - char* ThisElement; - char line[BUFSIZ]; - char Title[73], Key[8], Type[4], Rhstype[4]; - char Ptrfmt[17], Indfmt[17], Rhsfmt[21]; - - if ( (in_file = fopen( filename, "r")) == NULL ) { - fprintf(stderr,"Error: Cannot open file: %s\n",filename); - return 0; - } - - readHB_header(in_file, Title, Key, Type, &Nrow, &Ncol, &Nnzero, &Nrhs, - Ptrfmt, Indfmt, Valfmt, Rhsfmt, - &Ptrcrd, &Indcrd, &Valcrd, &Rhscrd, Rhstype); - -/* Parse the array input formats from Line 3 of HB file */ - ParseIfmt(Ptrfmt,&Ptrperline,&Ptrwidth); - ParseIfmt(Indfmt,&Indperline,&Indwidth); - if ( Type[0] != 'P' ) { /* Skip if pattern only */ - ParseRfmt(Valfmt,&Valperline,&Valwidth,&Valprec,&Valflag); - if (Valflag == 'D') { - *strchr(Valfmt,'D') = 'E'; - } - } - -/* Read column pointer array: */ - - offset = 1-_SP_base; /* if base 0 storage is declared (via macro definition), */ - /* then storage entries are offset by 1 */ - - ThisElement = (char *) malloc(Ptrwidth+1); - if ( ThisElement == NULL ) IOHBTerminate("Insufficient memory for ThisElement."); - *(ThisElement+Ptrwidth) = (char) NULL; - count=0; - for (i=0;i<Ptrcrd;i++) - { - fgets(line, BUFSIZ, in_file); - if ( sscanf(line,"%*s") < 0 ) - IOHBTerminate("iohb.c: Null (or blank) line in pointer data region of HB file.\n"); - col = 0; - for (ind = 0;ind<Ptrperline;ind++) - { - if (count > Ncol) break; - strncpy(ThisElement,line+col,Ptrwidth); - /*ThisElement = substr(line,col,Ptrwidth);*/ - colptr[count] = atoi(ThisElement)-offset; - count++; col += Ptrwidth; - } - } - free(ThisElement); - -/* Read row index array: */ - - ThisElement = (char *) malloc(Indwidth+1); - if ( ThisElement == NULL ) IOHBTerminate("Insufficient memory for ThisElement."); - *(ThisElement+Indwidth) = (char) NULL; - count = 0; - for (i=0;i<Indcrd;i++) - { - fgets(line, BUFSIZ, in_file); - if ( sscanf(line,"%*s") < 0 ) - IOHBTerminate("iohb.c: Null (or blank) line in index data region of HB file.\n"); - col = 0; - for (ind = 0;ind<Indperline;ind++) - { - if (count == Nnzero) break; - strncpy(ThisElement,line+col,Indwidth); - /*ThisElement = substr(line,col,Indwidth);*/ - rowind[count] = atoi(ThisElement)-offset; - count++; col += Indwidth; - } - } - free(ThisElement); - -/* Read array of values: AS CHARACTERS*/ - - if ( Type[0] != 'P' ) { /* Skip if pattern only */ - - if ( Type[0] == 'C' ) Nentries = 2*Nnzero; - else Nentries = Nnzero; - - ThisElement = (char *) malloc(Valwidth+1); - if ( ThisElement == NULL ) IOHBTerminate("Insufficient memory for ThisElement."); - *(ThisElement+Valwidth) = (char) NULL; - count = 0; - for (i=0;i<Valcrd;i++) - { - fgets(line, BUFSIZ, in_file); - if ( sscanf(line,"%*s") < 0 ) - IOHBTerminate("iohb.c: Null (or blank) line in value data region of HB file.\n"); - if (Valflag == 'D') { - while( strchr(line,'D') ) *strchr(line,'D') = 'E'; - } - col = 0; - for (ind = 0;ind<Valperline;ind++) - { - if (count == Nentries) break; - ThisElement = &val[count*Valwidth]; - strncpy(ThisElement,line+col,Valwidth); - /*strncpy(ThisElement,substr(line,col,Valwidth),Valwidth);*/ - if ( Valflag != 'F' && strchr(ThisElement,'E') == NULL ) { - /* insert a char prefix for exp */ - last = strlen(ThisElement); - for (j=last+1;j>=0;j--) { - ThisElement[j] = ThisElement[j-1]; - if ( ThisElement[j] == '+' || ThisElement[j] == '-' ) { - ThisElement[j-1] = Valflag; - break; - } - } - } - count++; col += Valwidth; - } - } - } - - return 1; -} - -int readHB_newmat_char(const char* filename, int* M, int* N, int* nonzeros, int** colptr, - int** rowind, char** val, char** Valfmt) -{ - FILE *in_file; - int Nrhs; - int Ptrcrd, Indcrd, Valcrd, Rhscrd; - int Valperline, Valwidth, Valprec; - int Valflag; /* Indicates 'E','D', or 'F' float format */ - char Title[73], Key[9], Type[4], Rhstype[4]; - char Ptrfmt[17], Indfmt[17], Rhsfmt[21]; - - if ((in_file = fopen( filename, "r")) == NULL) { - fprintf(stderr,"Error: Cannot open file: %s\n",filename); - return 0; - } - - *Valfmt = (char *)malloc(21*sizeof(char)); - if ( *Valfmt == NULL ) IOHBTerminate("Insufficient memory for Valfmt."); - readHB_header(in_file, Title, Key, Type, M, N, nonzeros, &Nrhs, - Ptrfmt, Indfmt, (*Valfmt), Rhsfmt, - &Ptrcrd, &Indcrd, &Valcrd, &Rhscrd, Rhstype); - fclose(in_file); - ParseRfmt(*Valfmt,&Valperline,&Valwidth,&Valprec,&Valflag); - - *colptr = (int *)malloc((*N+1)*sizeof(int)); - if ( *colptr == NULL ) IOHBTerminate("Insufficient memory for colptr.\n"); - *rowind = (int *)malloc(*nonzeros*sizeof(int)); - if ( *rowind == NULL ) IOHBTerminate("Insufficient memory for rowind.\n"); - if ( Type[0] == 'C' ) { -/* - fprintf(stderr, "Warning: Reading complex data from HB file %s.\n",filename); - fprintf(stderr, " Real and imaginary parts will be interlaced in val[].\n"); -*/ - /* Malloc enough space for real AND imaginary parts of val[] */ - *val = (char *)malloc(*nonzeros*Valwidth*sizeof(char)*2); - if ( *val == NULL ) IOHBTerminate("Insufficient memory for val.\n"); - } else { - if ( Type[0] != 'P' ) { - /* Malloc enough space for real array val[] */ - *val = (char *)malloc(*nonzeros*Valwidth*sizeof(char)); - if ( *val == NULL ) IOHBTerminate("Insufficient memory for val.\n"); - } - } /* No val[] space needed if pattern only */ - return readHB_mat_char(filename, *colptr, *rowind, *val, *Valfmt); - -} - -int readHB_aux_char(const char* filename, const char AuxType, char b[]) -{ -/****************************************************************************/ -/* This function opens and reads the specified file, placing auxilary */ -/* vector(s) of the given type (if available) in b : */ -/* Return value is the number of vectors successfully read. */ -/* */ -/* AuxType = 'F' full right-hand-side vector(s) */ -/* AuxType = 'G' initial Guess vector(s) */ -/* AuxType = 'X' eXact solution vector(s) */ -/* */ -/* ---------- */ -/* **CAVEAT** */ -/* ---------- */ -/* Parsing real formats from Fortran is tricky, and this file reader */ -/* does not claim to be foolproof. It has been tested for cases when */ -/* the real values are printed consistently and evenly spaced on each */ -/* line, with Fixed (F), and Exponential (E or D) formats. */ -/* */ -/* ** If the input file does not adhere to the H/B format, the ** */ -/* ** results will be unpredictable. ** */ -/* */ -/****************************************************************************/ - FILE *in_file; - int i,j,n,maxcol,start,stride,col,last,linel,nvecs,rhsi; - int Nrow, Ncol, Nnzero, Nentries,Nrhs; - int Ptrcrd, Indcrd, Valcrd, Rhscrd; - int Rhsperline, Rhswidth, Rhsprec; - int Rhsflag; - char Title[73], Key[9], Type[4], Rhstype[4]; - char Ptrfmt[17], Indfmt[17], Valfmt[21], Rhsfmt[21]; - char line[BUFSIZ]; - char *ThisElement; - - if ((in_file = fopen( filename, "r")) == NULL) { - fprintf(stderr,"Error: Cannot open file: %s\n",filename); - return 0; - } - - readHB_header(in_file, Title, Key, Type, &Nrow, &Ncol, &Nnzero, &Nrhs, - Ptrfmt, Indfmt, Valfmt, Rhsfmt, - &Ptrcrd, &Indcrd, &Valcrd, &Rhscrd, Rhstype); - - if (Nrhs <= 0) - { - fprintf(stderr, "Warn: Attempt to read auxillary vector(s) when none are present.\n"); - return 0; - } - if (Rhstype[0] != 'F' ) - { - fprintf(stderr,"Warn: Attempt to read auxillary vector(s) which are not stored in Full form.\n"); - fprintf(stderr," Rhs must be specified as full. \n"); - return 0; - } - -/* If reading complex data, allow for interleaved real and imaginary values. */ - if ( Type[0] == 'C' ) { - Nentries = 2*Nrow; - } else { - Nentries = Nrow; - } - - nvecs = 1; - - if ( Rhstype[1] == 'G' ) nvecs++; - if ( Rhstype[2] == 'X' ) nvecs++; - - if ( AuxType == 'G' && Rhstype[1] != 'G' ) { - fprintf(stderr, "Warn: Attempt to read auxillary Guess vector(s) when none are present.\n"); - return 0; - } - if ( AuxType == 'X' && Rhstype[2] != 'X' ) { - fprintf(stderr, "Warn: Attempt to read auxillary eXact solution vector(s) when none are present.\n"); - return 0; - } - - ParseRfmt(Rhsfmt, &Rhsperline, &Rhswidth, &Rhsprec,&Rhsflag); - maxcol = Rhsperline*Rhswidth; - -/* Lines to skip before starting to read RHS values... */ - n = Ptrcrd + Indcrd + Valcrd; - - for (i = 0; i < n; i++) - fgets(line, BUFSIZ, in_file); - -/* start - number of initial aux vector entries to skip */ -/* to reach first vector requested */ -/* stride - number of aux vector entries to skip between */ -/* requested vectors */ - if ( AuxType == 'F' ) start = 0; - else if ( AuxType == 'G' ) start = Nentries; - else start = (nvecs-1)*Nentries; - stride = (nvecs-1)*Nentries; - - fgets(line, BUFSIZ, in_file); - linel= strchr(line,'\n')-line; - if ( sscanf(line,"%*s") < 0 ) - IOHBTerminate("iohb.c: Null (or blank) line in auxillary vector data region of HB file.\n"); - col = 0; -/* Skip to initial offset */ - - for (i=0;i<start;i++) { - col += Rhswidth; - if ( col >= ( maxcol<linel?maxcol:linel ) ) { - fgets(line, BUFSIZ, in_file); - linel= strchr(line,'\n')-line; - if ( sscanf(line,"%*s") < 0 ) - IOHBTerminate("iohb.c: Null (or blank) line in auxillary vector data region of HB file.\n"); - col = 0; - } - } - - if (Rhsflag == 'D') { - while( strchr(line,'D') ) *strchr(line,'D') = 'E'; - } -/* Read a vector of desired type, then skip to next */ -/* repeating to fill Nrhs vectors */ - - for (rhsi=0;rhsi<Nrhs;rhsi++) { - - for (i=0;i<Nentries;i++) { - if ( col >= ( maxcol<linel?maxcol:linel ) ) { - fgets(line, BUFSIZ, in_file); - linel= strchr(line,'\n')-line; - if ( sscanf(line,"%*s") < 0 ) - IOHBTerminate("iohb.c: Null (or blank) line in auxillary vector data region of HB file.\n"); - if (Rhsflag == 'D') { - while( strchr(line,'D') ) *strchr(line,'D') = 'E'; - } - col = 0; - } - ThisElement = &b[i*Rhswidth]; - strncpy(ThisElement,line+col,Rhswidth); - if ( Rhsflag != 'F' && strchr(ThisElement,'E') == NULL ) { - /* insert a char prefix for exp */ - last = strlen(ThisElement); - for (j=last+1;j>=0;j--) { - ThisElement[j] = ThisElement[j-1]; - if ( ThisElement[j] == '+' || ThisElement[j] == '-' ) { - ThisElement[j-1] = Rhsflag; - break; - } - } - } - col += Rhswidth; - } - b+=Nentries*Rhswidth; - -/* Skip any interleaved Guess/eXact vectors */ - - for (i=0;i<stride;i++) { - col += Rhswidth; - if ( col >= ( maxcol<linel?maxcol:linel ) ) { - fgets(line, BUFSIZ, in_file); - linel= strchr(line,'\n')-line; - if ( sscanf(line,"%*s") < 0 ) - IOHBTerminate("iohb.c: Null (or blank) line in auxillary vector data region of HB file.\n"); - col = 0; - } - } - - } - - - fclose(in_file); - return Nrhs; -} - -int readHB_newaux_char(const char* filename, const char AuxType, char** b, char** Rhsfmt) -{ - FILE *in_file; - int Ptrcrd, Indcrd, Valcrd, Rhscrd; - int Nrow,Ncol,Nnzero,Nrhs; - int Rhsperline, Rhswidth, Rhsprec; - int Rhsflag; - char Title[73], Key[9], Type[4], Rhstype[4]; - char Ptrfmt[17], Indfmt[17], Valfmt[21]; - - if ((in_file = fopen( filename, "r")) == NULL) { - fprintf(stderr,"Error: Cannot open file: %s\n",filename); - return 0; - } - - *Rhsfmt = (char *)malloc(21*sizeof(char)); - if ( *Rhsfmt == NULL ) IOHBTerminate("Insufficient memory for Rhsfmt."); - readHB_header(in_file, Title, Key, Type, &Nrow, &Ncol, &Nnzero, &Nrhs, - Ptrfmt, Indfmt, Valfmt, (*Rhsfmt), - &Ptrcrd, &Indcrd, &Valcrd, &Rhscrd, Rhstype); - fclose(in_file); - if ( Nrhs == 0 ) { - fprintf(stderr,"Warn: Requested read of aux vector(s) when none are present.\n"); - return 0; - } else { - ParseRfmt(*Rhsfmt,&Rhsperline,&Rhswidth,&Rhsprec,&Rhsflag); - if ( Type[0] == 'C' ) { - fprintf(stderr, "Warning: Reading complex aux vector(s) from HB file %s.",filename); - fprintf(stderr, " Real and imaginary parts will be interlaced in b[]."); - *b = (char *)malloc(Nrow*Nrhs*Rhswidth*sizeof(char)*2); - if ( *b == NULL ) IOHBTerminate("Insufficient memory for rhs.\n"); - return readHB_aux_char(filename, AuxType, *b); - } else { - *b = (char *)malloc(Nrow*Nrhs*Rhswidth*sizeof(char)); - if ( *b == NULL ) IOHBTerminate("Insufficient memory for rhs.\n"); - return readHB_aux_char(filename, AuxType, *b); - } - } -} - -int writeHB_mat_char(const char* filename, int M, int N, - int nz, const int colptr[], const int rowind[], - const char val[], int Nrhs, const char rhs[], - const char guess[], const char exact[], - const char* Title, const char* Key, const char* Type, - char* Ptrfmt, char* Indfmt, char* Valfmt, char* Rhsfmt, - const char* Rhstype) -{ -/****************************************************************************/ -/* The writeHB function opens the named file and writes the specified */ -/* matrix and optional right-hand-side(s) to that file in Harwell-Boeing */ -/* format. */ -/* */ -/* For a description of the Harwell Boeing standard, see: */ -/* Duff, et al., ACM TOMS Vol.15, No.1, March 1989 */ -/* */ -/****************************************************************************/ - FILE *out_file; - int i,j,acount,linemod,entry,offset; - int totcrd, ptrcrd, indcrd, valcrd, rhscrd; - int nvalentries, nrhsentries; - int Ptrperline, Ptrwidth, Indperline, Indwidth; - int Rhsperline, Rhswidth, Rhsprec; - int Rhsflag; - int Valperline, Valwidth, Valprec; - int Valflag; /* Indicates 'E','D', or 'F' float format */ - char pformat[16],iformat[16],vformat[19],rformat[19]; - - if ( Type[0] == 'C' ) { - nvalentries = 2*nz; - nrhsentries = 2*M; - } else { - nvalentries = nz; - nrhsentries = M; - } - - if ( filename != NULL ) { - if ( (out_file = fopen( filename, "w")) == NULL ) { - fprintf(stderr,"Error: Cannot open file: %s\n",filename); - return 0; - } - } else out_file = stdout; - - if ( Ptrfmt == NULL ) Ptrfmt = "(8I10)"; - ParseIfmt(Ptrfmt,&Ptrperline,&Ptrwidth); - sprintf(pformat,"%%%dd",Ptrwidth); - - if ( Indfmt == NULL ) Indfmt = Ptrfmt; - ParseIfmt(Indfmt,&Indperline,&Indwidth); - sprintf(iformat,"%%%dd",Indwidth); - - if ( Type[0] != 'P' ) { /* Skip if pattern only */ - if ( Valfmt == NULL ) Valfmt = "(4E20.13)"; - ParseRfmt(Valfmt,&Valperline,&Valwidth,&Valprec,&Valflag); - sprintf(vformat,"%%%ds",Valwidth); - } - - ptrcrd = (N+1)/Ptrperline; - if ( (N+1)%Ptrperline != 0) ptrcrd++; - - indcrd = nz/Indperline; - if ( nz%Indperline != 0) indcrd++; - - valcrd = nvalentries/Valperline; - if ( nvalentries%Valperline != 0) valcrd++; - - if ( Nrhs > 0 ) { - if ( Rhsfmt == NULL ) Rhsfmt = Valfmt; - ParseRfmt(Rhsfmt,&Rhsperline,&Rhswidth,&Rhsprec, &Rhsflag); - sprintf(rformat,"%%%ds",Rhswidth); - rhscrd = nrhsentries/Rhsperline; - if ( nrhsentries%Rhsperline != 0) rhscrd++; - if ( Rhstype[1] == 'G' ) rhscrd+=rhscrd; - if ( Rhstype[2] == 'X' ) rhscrd+=rhscrd; - rhscrd*=Nrhs; - } else rhscrd = 0; - - totcrd = 4+ptrcrd+indcrd+valcrd+rhscrd; - - -/* Print header information: */ - - fprintf(out_file,"%-72s%-8s\n%14d%14d%14d%14d%14d\n",Title, Key, totcrd, - ptrcrd, indcrd, valcrd, rhscrd); - fprintf(out_file,"%3s%11s%14d%14d%14d\n",Type," ", M, N, nz); - fprintf(out_file,"%-16s%-16s%-20s", Ptrfmt, Indfmt, Valfmt); - if ( Nrhs != 0 ) { -/* Print Rhsfmt on fourth line and */ -/* optional fifth header line for auxillary vector information: */ - fprintf(out_file,"%-20s\n%-14s%d\n",Rhsfmt,Rhstype,Nrhs); - } else fprintf(out_file,"\n"); - - offset = 1-_SP_base; /* if base 0 storage is declared (via macro definition), */ - /* then storage entries are offset by 1 */ - -/* Print column pointers: */ - for (i=0;i<N+1;i++) - { - entry = colptr[i]+offset; - fprintf(out_file,pformat,entry); - if ( (i+1)%Ptrperline == 0 ) fprintf(out_file,"\n"); - } - - if ( (N+1) % Ptrperline != 0 ) fprintf(out_file,"\n"); - -/* Print row indices: */ - for (i=0;i<nz;i++) - { - entry = rowind[i]+offset; - fprintf(out_file,iformat,entry); - if ( (i+1)%Indperline == 0 ) fprintf(out_file,"\n"); - } - - if ( nz % Indperline != 0 ) fprintf(out_file,"\n"); - -/* Print values: */ - - if ( Type[0] != 'P' ) { /* Skip if pattern only */ - for (i=0;i<nvalentries;i++) - { - fprintf(out_file,vformat,val+i*Valwidth); - if ( (i+1)%Valperline == 0 ) fprintf(out_file,"\n"); - } - - if ( nvalentries % Valperline != 0 ) fprintf(out_file,"\n"); - -/* Print right hand sides: */ - acount = 1; - linemod=0; - if ( Nrhs > 0 ) { - for (j=0;j<Nrhs;j++) { - for (i=0;i<nrhsentries;i++) - { - fprintf(out_file,rformat,rhs+i*Rhswidth); - if ( acount++%Rhsperline == linemod ) fprintf(out_file,"\n"); - } - if ( acount%Rhsperline != linemod ) { - fprintf(out_file,"\n"); - linemod = (acount-1)%Rhsperline; - } - if ( Rhstype[1] == 'G' ) { - for (i=0;i<nrhsentries;i++) - { - fprintf(out_file,rformat,guess+i*Rhswidth); - if ( acount++%Rhsperline == linemod ) fprintf(out_file,"\n"); - } - if ( acount%Rhsperline != linemod ) { - fprintf(out_file,"\n"); - linemod = (acount-1)%Rhsperline; - } - } - if ( Rhstype[2] == 'X' ) { - for (i=0;i<nrhsentries;i++) - { - fprintf(out_file,rformat,exact+i*Rhswidth); - if ( acount++%Rhsperline == linemod ) fprintf(out_file,"\n"); - } - if ( acount%Rhsperline != linemod ) { - fprintf(out_file,"\n"); - linemod = (acount-1)%Rhsperline; - } - } - } - } - - } - - if ( fclose(out_file) != 0){ - fprintf(stderr,"Error closing file in writeHB_mat_char().\n"); - return 0; - } else return 1; - -} - -int ParseIfmt(char* fmt, int* perline, int* width) -{ -/*************************************************/ -/* Parse an *integer* format field to determine */ -/* width and number of elements per line. */ -/*************************************************/ - char *tmp; - if (fmt == NULL ) { - *perline = 0; *width = 0; return 0; - } - upcase(fmt); - tmp = strchr(fmt,'('); - tmp = substr(fmt,tmp - fmt + 1, strchr(fmt,'I') - tmp - 1); - *perline = atoi(tmp); - tmp = strchr(fmt,'I'); - tmp = substr(fmt,tmp - fmt + 1, strchr(fmt,')') - tmp - 1); - return *width = atoi(tmp); -} - -int ParseRfmt(char* fmt, int* perline, int* width, int* prec, int* flag) -{ -/*************************************************/ -/* Parse a *real* format field to determine */ -/* width and number of elements per line. */ -/* Also sets flag indicating 'E' 'F' 'P' or 'D' */ -/* format. */ -/*************************************************/ - char* tmp; - char* tmp2; - char* tmp3; - int len; - - if (fmt == NULL ) { - *perline = 0; - *width = 0; - flag = NULL; - return 0; - } - - upcase(fmt); - if (strchr(fmt,'(') != NULL) fmt = strchr(fmt,'('); - if (strchr(fmt,')') != NULL) { - tmp2 = strchr(fmt,')'); - while ( strchr(tmp2+1,')') != NULL ) { - tmp2 = strchr(tmp2+1,')'); - } - *(tmp2+1) = (int) NULL; - } - if (strchr(fmt,'P') != NULL) /* Remove any scaling factor, which */ - { /* affects output only, not input */ - if (strchr(fmt,'(') != NULL) { - tmp = strchr(fmt,'P'); - if ( *(++tmp) == ',' ) tmp++; - tmp3 = strchr(fmt,'(')+1; - len = tmp-tmp3; - tmp2 = tmp3; - while ( *(tmp2+len) != (int) NULL ) { - *tmp2=*(tmp2+len); - tmp2++; - } - *(strchr(fmt,')')+1) = (int) NULL; - } - } - if (strchr(fmt,'E') != NULL) { - *flag = 'E'; - } else if (strchr(fmt,'D') != NULL) { - *flag = 'D'; - } else if (strchr(fmt,'F') != NULL) { - *flag = 'F'; - } else { - fprintf(stderr,"Real format %s in H/B file not supported.\n",fmt); - return 0; - } - tmp = strchr(fmt,'('); - tmp = substr(fmt,tmp - fmt + 1, strchr(fmt,*flag) - tmp - 1); - *perline = atoi(tmp); - tmp = strchr(fmt,*flag); - if ( strchr(fmt,'.') ) { - *prec = atoi( substr( fmt, strchr(fmt,'.') - fmt + 1, strchr(fmt,')') - strchr(fmt,'.')-1) ); - tmp = substr(fmt,tmp - fmt + 1, strchr(fmt,'.') - tmp - 1); - } else { - tmp = substr(fmt,tmp - fmt + 1, strchr(fmt,')') - tmp - 1); - } - return *width = atoi(tmp); -} - -char* substr(const char* S, const int pos, const int len) -{ - int i; - char *SubS; - if ( pos+len <= strlen(S)) { - SubS = (char *)malloc(len+1); - if ( SubS == NULL ) IOHBTerminate("Insufficient memory for SubS."); - for (i=0;i<len;i++) SubS[i] = S[pos+i]; - SubS[len] = (char) NULL; - } else { - SubS = NULL; - } - return SubS; -} - -#include<ctype.h> -void upcase(char* S) -{ -/* Convert S to uppercase */ - int i,len; - if ( S == NULL ) return; - len = strlen(S); - for (i=0;i< len;i++) - S[i] = toupper(S[i]); -} - -void IOHBTerminate(char* message) -{ - fprintf(stderr,message); - exit(1); -} - diff --git a/Utilities/BGL/boost/graph/example/iohb.h b/Utilities/BGL/boost/graph/example/iohb.h deleted file mode 100644 index 7c1ec21faae5019caa8a03e3c1e449cf1f7479b3..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/iohb.h +++ /dev/null @@ -1,70 +0,0 @@ -// (C) Copyright Jeremy Siek 2004 -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef IOHB_H -#define IOHB_H - -#include<stdio.h> -#include<stdlib.h> - -#ifdef __cplusplus -extern "C" { -#endif - -int readHB_info(const char* filename, int* M, int* N, int* nz, char** Type, - int* Nrhs); - -int readHB_header(FILE* in_file, char* Title, char* Key, char* Type, - int* Nrow, int* Ncol, int* Nnzero, int* Nrhs, - char* Ptrfmt, char* Indfmt, char* Valfmt, char* Rhsfmt, - int* Ptrcrd, int* Indcrd, int* Valcrd, int* Rhscrd, - char *Rhstype); - -int readHB_mat_double(const char* filename, int colptr[], int rowind[], - double val[]); - -int readHB_newmat_double(const char* filename, int* M, int* N, int* nonzeros, - int** colptr, int** rowind, double** val); - -int readHB_aux_double(const char* filename, const char AuxType, double b[]); - -int readHB_newaux_double(const char* filename, const char AuxType, double** b); - -int writeHB_mat_double(const char* filename, int M, int N, - int nz, const int colptr[], const int rowind[], - const double val[], int Nrhs, const double rhs[], - const double guess[], const double exact[], - const char* Title, const char* Key, const char* Type, - char* Ptrfmt, char* Indfmt, char* Valfmt, char* Rhsfmt, - const char* Rhstype); - -int readHB_mat_char(const char* filename, int colptr[], int rowind[], - char val[], char* Valfmt); - -int readHB_newmat_char(const char* filename, int* M, int* N, int* nonzeros, int** colptr, - int** rowind, char** val, char** Valfmt); - -int readHB_aux_char(const char* filename, const char AuxType, char b[]); - -int readHB_newaux_char(const char* filename, const char AuxType, char** b, char** Rhsfmt); - -int writeHB_mat_char(const char* filename, int M, int N, - int nz, const int colptr[], const int rowind[], - const char val[], int Nrhs, const char rhs[], - const char guess[], const char exact[], - const char* Title, const char* Key, const char* Type, - char* Ptrfmt, char* Indfmt, char* Valfmt, char* Rhsfmt, - const char* Rhstype); - -int ParseIfmt(char* fmt, int* perline, int* width); - -int ParseRfmt(char* fmt, int* perline, int* width, int* prec, int* flag); - -void IOHBTerminate(char* message); -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Utilities/BGL/boost/graph/example/isomorphism.cpp b/Utilities/BGL/boost/graph/example/isomorphism.cpp deleted file mode 100644 index 8882f751d8dcd3bd3ad58346b25c2b63b9496f6b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/isomorphism.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// (C) Copyright Jeremy Siek 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include <boost/config.hpp> -#include <iostream> -#include <boost/graph/isomorphism.hpp> -#include <boost/graph/adjacency_list.hpp> - -#include <boost/graph/graph_utility.hpp> - -/* - Sample output: - isomorphic? 1 - f: 9 10 11 0 1 3 2 4 6 8 7 5 - */ - -int -main() -{ - using namespace boost; - - const int n = 12; - - typedef adjacency_list<vecS, listS, undirectedS, - property<vertex_index_t, int> > graph_t; - graph_t g1(n), g2(n); - - std::vector<graph_traits<graph_t>::vertex_descriptor> v1(n), v2(n); - - property_map<graph_t, vertex_index_t>::type - v1_index_map = get(vertex_index, g1), - v2_index_map = get(vertex_index, g2); - - graph_traits<graph_t>::vertex_iterator i, end; - int id = 0; - for (tie(i, end) = vertices(g1); i != end; ++i, ++id) { - put(v1_index_map, *i, id); - v1[id] = *i; - } - id = 0; - for (tie(i, end) = vertices(g2); i != end; ++i, ++id) { - put(v2_index_map, *i, id); - v2[id] = *i; - } - add_edge(v1[0], v1[1], g1); add_edge(v1[1], v1[2], g1); - add_edge(v1[0], v1[2], g1); - add_edge(v1[3], v1[4], g1); add_edge(v1[4], v1[5], g1); - add_edge(v1[5], v1[6], g1); add_edge(v1[6], v1[3], g1); - add_edge(v1[7], v1[8], g1); add_edge(v1[8], v1[9], g1); - add_edge(v1[9], v1[10], g1); - add_edge(v1[10], v1[11], g1); add_edge(v1[11], v1[7], g1); - - add_edge(v2[9], v2[10], g2); add_edge(v2[10], v2[11], g2); - add_edge(v2[11], v2[9], g2); - add_edge(v2[0], v2[1], g2); add_edge(v2[1], v2[3], g2); - add_edge(v2[3], v2[2], g2); add_edge(v2[2], v2[0], g2); - add_edge(v2[4], v2[5], g2); add_edge(v2[5], v2[7], g2); - add_edge(v2[7], v2[8], g2); - add_edge(v2[8], v2[6], g2); add_edge(v2[6], v2[4], g2); - - std::vector<graph_traits<graph_t>::vertex_descriptor> f(n); - -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - bool ret = isomorphism - (g1, g2, make_iterator_property_map(f.begin(), v1_index_map, f[0]), - degree_vertex_invariant(), get(vertex_index, g1), get(vertex_index, g2)); -#else - bool ret = isomorphism - (g1, g2, isomorphism_map - (make_iterator_property_map(f.begin(), v1_index_map, f[0]))); -#endif - std::cout << "isomorphic? " << ret << std::endl; - - std::cout << "f: "; - for (std::size_t v = 0; v != f.size(); ++v) - std::cout << get(get(vertex_index, g2), f[v]) << " "; - std::cout << std::endl; - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/iteration_macros.cpp b/Utilities/BGL/boost/graph/example/iteration_macros.cpp deleted file mode 100644 index 49d5468c9bd9654e1451ebf49299f4743ea8fde2..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/iteration_macros.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//======================================================================= -// Copyright 2001 Indiana University. -// Author: Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - - -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/iteration_macros.hpp> - -enum family { Jeanie, Debbie, Rick, John, Amanda, Margaret, Benjamin, N }; - -int main() -{ - using namespace boost; - const char *name[] = { "Jeanie", "Debbie", "Rick", "John", "Amanda", - "Margaret", "Benjamin" - }; - - adjacency_list <> g(N); - add_edge(Jeanie, Debbie, g); - add_edge(Jeanie, Rick, g); - add_edge(Jeanie, John, g); - add_edge(Debbie, Amanda, g); - add_edge(Rick, Margaret, g); - add_edge(John, Benjamin, g); - - graph_traits<adjacency_list <> >::vertex_iterator i, end; - graph_traits<adjacency_list <> >::adjacency_iterator ai, a_end; - property_map<adjacency_list <>, vertex_index_t>::type - index_map = get(vertex_index, g); - - BGL_FORALL_VERTICES(i, g, adjacency_list<>) { - std::cout << name[get(index_map, i)]; - - if (out_degree(i, g) == 0) - std::cout << " has no children"; - else - std::cout << " is the parent of "; - - BGL_FORALL_ADJACENT(i, j, g, adjacency_list<>) - std::cout << name[get(index_map, j)] << ", "; - std::cout << std::endl; - } - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/iterator-property-map-eg.cpp b/Utilities/BGL/boost/graph/example/iterator-property-map-eg.cpp deleted file mode 100644 index 549a4b9bb7cbcce61e2ec2a6dedf9e7f7d0ecc07..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/iterator-property-map-eg.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <iostream> -#include <boost/property_map.hpp> - -int -main() -{ - using namespace boost; - double x[] = { 0.2, 4.5, 3.2 }; - iterator_property_map < double *, identity_property_map, double, double& > pmap(x); - std::cout << "x[1] = " << get(pmap, 1) << std::endl; - put(pmap, 0, 1.7); - std::cout << "x[0] = " << pmap[0] << std::endl; - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/johnson-eg.cpp b/Utilities/BGL/boost/graph/example/johnson-eg.cpp deleted file mode 100644 index 10c0e46e6d84619c91cfacff82a4dc3c0adac032..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/johnson-eg.cpp +++ /dev/null @@ -1,81 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <fstream> -#include <iostream> -#include <iomanip> -#include <vector> -#include <boost/property_map.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graphviz.hpp> -#include <boost/graph/johnson_all_pairs_shortest.hpp> - -int -main() -{ - using namespace boost; - typedef adjacency_list<vecS, vecS, directedS, no_property, - property< edge_weight_t, int, property< edge_weight2_t, int > > > Graph; - const int V = 5; - typedef std::pair < int, int >Edge; - Edge edge_array[] = - { Edge(0, 1), Edge(0, 4), Edge(0, 2), Edge(1, 3), Edge(1, 4), - Edge(2, 1), Edge(3, 2), Edge(3, 0), Edge(4, 3) - }; - const std::size_t E = sizeof(edge_array) / sizeof(Edge); -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ can't handle the iterator constructor - Graph g(V); - for (std::size_t j = 0; j < E; ++j) - add_edge(edge_array[j].first, edge_array[j].second, g); -#else - Graph g(edge_array, edge_array + E, V); -#endif - - property_map < Graph, edge_weight_t >::type w = get(edge_weight, g); - int weights[] = { 3, -4, 8, 1, 7, 4, -5, 2, 6 }; - int *wp = weights; - - graph_traits < Graph >::edge_iterator e, e_end; - for (boost::tie(e, e_end) = edges(g); e != e_end; ++e) - w[*e] = *wp++; - - std::vector < int >d(V, (std::numeric_limits < int >::max)()); - int D[V][V]; - johnson_all_pairs_shortest_paths(g, D, distance_map(&d[0])); - - std::cout << " "; - for (int k = 0; k < V; ++k) - std::cout << std::setw(5) << k; - std::cout << std::endl; - for (int i = 0; i < V; ++i) { - std::cout << i << " -> "; - for (int j = 0; j < V; ++j) { - if (D[i][j] > 20 || D[i][j] < -20) - std::cout << std::setw(5) << "inf"; - else - std::cout << std::setw(5) << D[i][j]; - } - std::cout << std::endl; - } - - std::ofstream fout("figs/johnson-eg.dot"); - fout << "digraph A {\n" - << " rankdir=LR\n" - << "size=\"5,3\"\n" - << "ratio=\"fill\"\n" - << "edge[style=\"bold\"]\n" << "node[shape=\"circle\"]\n"; - - graph_traits < Graph >::edge_iterator ei, ei_end; - for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) - fout << source(*ei, g) << " -> " << target(*ei, g) - << "[label=" << get(edge_weight, g)[*ei] << "]\n"; - - fout << "}\n"; - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/johnson.expected b/Utilities/BGL/boost/graph/example/johnson.expected deleted file mode 100644 index 55084c127c904f0f6a73a1d827313de4812aec9f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/johnson.expected +++ /dev/null @@ -1,7 +0,0 @@ - 0 1 2 3 4 5 -0 -> 0 0 -1 -5 0 -4 -1 -> inf 0 1 -3 2 -4 -2 -> inf 3 0 -4 1 -1 -3 -> inf 7 4 0 5 3 -4 -> inf 2 -1 -5 0 -2 -5 -> inf 8 5 1 6 0 diff --git a/Utilities/BGL/boost/graph/example/kevin-bacon.cpp b/Utilities/BGL/boost/graph/example/kevin-bacon.cpp deleted file mode 100644 index 2678bb05bcdb31f09b391a6cc1d2e7c6b9d4c59c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/kevin-bacon.cpp +++ /dev/null @@ -1,117 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <fstream> -#include <string> -#include <boost/tokenizer.hpp> -#include <boost/tuple/tuple.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/visitors.hpp> -#include <boost/graph/breadth_first_search.hpp> -#include <map> - -using namespace boost; - -template <typename DistanceMap> -class bacon_number_recorder : public default_bfs_visitor -{ -public: - bacon_number_recorder(DistanceMap dist) : d(dist) { } - - template <typename Edge, typename Graph> - void tree_edge(Edge e, const Graph& g) const - { - typename graph_traits<Graph>::vertex_descriptor - u = source(e, g), v = target(e, g); - d[v] = d[u] + 1; - } -private: - DistanceMap d; -}; - -// Convenience function -template < typename DistanceMap > -bacon_number_recorder<DistanceMap> -record_bacon_number(DistanceMap d) -{ - return bacon_number_recorder < DistanceMap > (d); -} - - -int -main() -{ - std::ifstream datafile("./kevin-bacon.dat"); - if (!datafile) { - std::cerr << "No ./kevin-bacon.dat file" << std::endl; - return EXIT_FAILURE; - } - - typedef adjacency_list < vecS, vecS, undirectedS, property < vertex_name_t, - std::string >, property < edge_name_t, std::string > > Graph; - Graph g; - - typedef property_map < Graph, vertex_name_t >::type actor_name_map_t; - actor_name_map_t actor_name = get(vertex_name, g); - typedef property_map < Graph, edge_name_t >::type movie_name_map_t; - movie_name_map_t connecting_movie = get(edge_name, g); - - typedef graph_traits < Graph >::vertex_descriptor Vertex; - typedef std::map < std::string, Vertex > NameVertexMap; - NameVertexMap actors; - - for (std::string line; std::getline(datafile, line);) { - char_delimiters_separator < char >sep(false, "", ";"); - tokenizer <> line_toks(line, sep); - tokenizer <>::iterator i = line_toks.begin(); - std::string actors_name = *i++; - NameVertexMap::iterator pos; - bool inserted; - Vertex u, v; - tie(pos, inserted) = actors.insert(std::make_pair(actors_name, Vertex())); - if (inserted) { - u = add_vertex(g); - actor_name[u] = actors_name; - pos->second = u; - } else - u = pos->second; - - std::string movie_name = *i++; - - tie(pos, inserted) = actors.insert(std::make_pair(*i, Vertex())); - if (inserted) { - v = add_vertex(g); - actor_name[v] = *i; - pos->second = v; - } else - v = pos->second; - - graph_traits < Graph >::edge_descriptor e; - tie(e, inserted) = add_edge(u, v, g); - if (inserted) - connecting_movie[e] = movie_name; - - } - - std::vector < int >bacon_number(num_vertices(g)); - - Vertex src = actors["Kevin Bacon"]; - bacon_number[src] = 0; - - breadth_first_search(g, src, - visitor(record_bacon_number(&bacon_number[0]))); - - graph_traits < Graph >::vertex_iterator i, end; - for (tie(i, end) = vertices(g); i != end; ++i) { - std::cout << actor_name[*i] << " has a Bacon number of " - << bacon_number[*i] << std::endl; - } - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/kevin-bacon.dat b/Utilities/BGL/boost/graph/example/kevin-bacon.dat deleted file mode 100644 index de17569d170707a06ba330503581e0212e8a3e38..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/kevin-bacon.dat +++ /dev/null @@ -1,50 +0,0 @@ -William Shatner;Loaded Weapon 1 (1993);Denise Richards -Denise Richards;Wild Things (1998);Kevin Bacon -Patrick Stewart;Prince of Egypt, The (1998);Steve Martin -Steve Martin;Novocaine (2000);Kevin Bacon -Gerard Depardieu;Unhook the Stars (1996);Clint Howard -Clint Howard;My Dog Skip (2000);Kevin Bacon -Sean Astin;White Water Summer (1987);Kevin Bacon -Theodore Hesburgh;Rudy (1993);Gerry Becker -Gerry Becker;Sleepers (1996);Kevin Bacon -Henry Fonda;Midway (1976);Robert Wagner -Robert Wagner;Wild Things (1998);Kevin Bacon -Mark Hamill;Slipstream (1989);Bill Paxton -Bill Paxton;Apollo 13 (1995);Kevin Bacon -Harrison Ford;Random Hearts (1999);Steve Altes -Steve Altes;Hollow Man (2000);Kevin Bacon -Alec Guinness;Kafka (1991);Theresa Russell -Theresa Russell;Wild Things (1998);Kevin Bacon -Carrie Fisher;Soapdish (1991);Elisabeth Shue -Elisabeth Shue;Hollow Man (2000);Kevin Bacon -Sean Connery;Rising Sun (1993);Peter Crombie -Peter Crombie;My Dog Skip (2000);Kevin Bacon -Dana Young;Bersaglio mobile (1967);Bebe Drake -Bebe Drake;Report to the Commissioner (1975);William Devane -A. Paliakov;Kutuzov (1944);Nikolai Brilling -Nikolai Brilling;Otello (1955);Kathleen Byron -Kathleen Byron;Saving Private Ryan (1998);Tom Hanks -Tom Hanks;Apollo 13 (1995);Kevin Bacon -Zoya Barantsevich;Slesar i kantzler (1923);Nikolai Panov -Nikolai Panov;Zhenshchina s kinzhalom (1916);Zoia Karabanova -Zoia Karabanova;Song to Remember, A (1945);William Challee -William Challee;Irish Whiskey Rebellion (1972);William Devane -William Devane;Hollow Man (2000);Kevin Bacon -P. Biryukov;Pikovaya dama (1910);Aleksandr Gromov -Aleksandr Gromov;Tikhij Don (1930);Yelena Maksimova -Yelena Maksimova;Bezottsovshchina (1976);Lev Prygunov -Lev Prygunov;Saint, The (1997);Elisabeth Shue -Yelena Chaika;Ostrov zabenya (1917);Viktor Tourjansky -Viktor Tourjansky;Zagrobnaya skitalitsa (1915);Olga Baclanova -Olga Baclanova;Freaks (1932);Angelo Rossitto -Angelo Rossitto;Dark, The (1979);William Devane -Christel Holch;Hvide Slavehandel, Den (1910/I);Aage Schmidt -Aage Schmidt;Begyndte ombord, Det (1937);Valso Holm -Valso Holm;Spion 503 (1958);Max von Sydow -Max von Sydow;Judge Dredd (1995);Diane Lane -Diane Lane;My Dog Skip (2000);Kevin Bacon -Val Kilmer;Saint, The (1997);Elisabeth Shue -Marilyn Monroe;Niagara (1953);George Ives -George Ives;Stir of Echoes (1999);Kevin Bacon -Jacques Perrin;Deserto dei tartari, Il (1976);Vittorio Gassman -Vittorio Gassman;Sleepers (1996);Kevin Bacon diff --git a/Utilities/BGL/boost/graph/example/kevin_bacon.expected b/Utilities/BGL/boost/graph/example/kevin_bacon.expected deleted file mode 100644 index c49f55c63058eae43a865f049adbf5bf6635a3e6..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/kevin_bacon.expected +++ /dev/null @@ -1,101 +0,0 @@ -William Shatner was in Loaded Weapon 1 (1993) with Denise Richards -Denise Richards was in Wild Things (1998) with Kevin Bacon -Patrick Stewart was in Prince of Egypt, The (1998) with Steve Martin -Steve Martin was in Novocaine (2000) with Kevin Bacon -Gerard Depardieu was in Unhook the Stars (1996) with Clint Howard -Clint Howard was in My Dog Skip (2000) with Kevin Bacon -Sean Astin was in White Water Summer (1987) with Kevin Bacon -Theodore Hesburgh was in Rudy (1993) with Gerry Becker -Gerry Becker was in Sleepers (1996) with Kevin Bacon -Henry Fonda was in Midway (1976) with Robert Wagner -Robert Wagner was in Wild Things (1998) with Kevin Bacon -Mark Hamill was in Slipstream (1989) with Bill Paxton -Bill Paxton was in Apollo 13 (1995) with Kevin Bacon -Harrison Ford was in Random Hearts (1999) with Steve Altes -Steve Altes was in Hollow Man (2000) with Kevin Bacon -Alec Guinness was in Kafka (1991) with Theresa Russell -Theresa Russell was in Wild Things (1998) with Kevin Bacon -Carrie Fisher was in Soapdish (1991) with Elisabeth Shue -Elisabeth Shue was in Hollow Man (2000) with Kevin Bacon -Sean Connery was in Rising Sun (1993) with Peter Crombie -Peter Crombie was in My Dog Skip (2000) with Kevin Bacon -Dana Young was in Bersaglio mobile (1967) with Bebe Drake -Bebe Drake was in Report to the Commissioner (1975) with William Devane -A. Paliakov was in Kutuzov (1944) with Nikolai Brilling -Nikolai Brilling was in Otello (1955) with Kathleen Byron -Kathleen Byron was in Saving Private Ryan (1998) with Tom Hanks -Tom Hanks was in Apollo 13 (1995) with Kevin Bacon -Zoya Barantsevich was in Slesar i kantzler (1923) with Nikolai Panov -Nikolai Panov was in Zhenshchina s kinzhalom (1916) with Zoia Karabanova -Zoia Karabanova was in Song to Remember, A (1945) with William Challee -William Challee was in Irish Whiskey Rebellion (1972) with William Devane -William Devane was in Hollow Man (2000) with Kevin Bacon -P. Biryukov was in Pikovaya dama (1910) with Aleksandr Gromov -Aleksandr Gromov was in Tikhij Don (1930) with Yelena Maksimova -Yelena Maksimova was in Bezottsovshchina (1976) with Lev Prygunov -Lev Prygunov was in Saint, The (1997) with Elisabeth Shue -Yelena Chaika was in Ostrov zabenya (1917) with Viktor Tourjansky -Viktor Tourjansky was in Zagrobnaya skitalitsa (1915) with Olga Baclanova -Olga Baclanova was in Freaks (1932) with Angelo Rossitto -Angelo Rossitto was in Dark, The (1979) with William Devane -Christel Holch was in Hvide Slavehandel, Den (1910/I) with Aage Schmidt -Aage Schmidt was in Begyndte ombord, Det (1937) with Valso Holm -Valso Holm was in Spion 503 (1958) with Max von Sydow -Max von Sydow was in Judge Dredd (1995) with Diane Lane -Diane Lane was in My Dog Skip (2000) with Kevin Bacon -Val Kilmer was in Saint, The (1997) with Elisabeth Shue -Marilyn Monroe was in Niagara (1953) with George Ives -George Ives was in Stir of Echoes (1999) with Kevin Bacon -Jacques Perrin was in Deserto dei tartari, Il (1976) with Vittorio Gassman -Vittorio Gassman was in Sleepers (1996) with Kevin Bacon -William Shatner's bacon number is 2 -Denise Richards's bacon number is 1 -Kevin Bacon's bacon number is 0 -Patrick Stewart's bacon number is 2 -Steve Martin's bacon number is 1 -Gerard Depardieu's bacon number is 2 -Clint Howard's bacon number is 1 -Sean Astin's bacon number is 1 -Theodore Hesburgh's bacon number is 2 -Gerry Becker's bacon number is 1 -Henry Fonda's bacon number is 2 -Robert Wagner's bacon number is 1 -Mark Hamill's bacon number is 2 -Bill Paxton's bacon number is 1 -Harrison Ford's bacon number is 2 -Steve Altes's bacon number is 1 -Alec Guinness's bacon number is 2 -Theresa Russell's bacon number is 1 -Carrie Fisher's bacon number is 2 -Elisabeth Shue's bacon number is 1 -Sean Connery's bacon number is 2 -Peter Crombie's bacon number is 1 -Dana Young's bacon number is 3 -Bebe Drake's bacon number is 2 -William Devane's bacon number is 1 -A. Paliakov's bacon number is 4 -Nikolai Brilling's bacon number is 3 -Kathleen Byron's bacon number is 2 -Tom Hanks's bacon number is 1 -Zoya Barantsevich's bacon number is 5 -Nikolai Panov's bacon number is 4 -Zoia Karabanova's bacon number is 3 -William Challee's bacon number is 2 -P. Biryukov's bacon number is 5 -Aleksandr Gromov's bacon number is 4 -Yelena Maksimova's bacon number is 3 -Lev Prygunov's bacon number is 2 -Yelena Chaika's bacon number is 5 -Viktor Tourjansky's bacon number is 4 -Olga Baclanova's bacon number is 3 -Angelo Rossitto's bacon number is 2 -Christel Holch's bacon number is 5 -Aage Schmidt's bacon number is 4 -Valso Holm's bacon number is 3 -Max von Sydow's bacon number is 2 -Diane Lane's bacon number is 1 -Val Kilmer's bacon number is 2 -Marilyn Monroe's bacon number is 2 -George Ives's bacon number is 1 -Jacques Perrin's bacon number is 2 -Vittorio Gassman's bacon number is 1 diff --git a/Utilities/BGL/boost/graph/example/king_ordering.cpp b/Utilities/BGL/boost/graph/example/king_ordering.cpp deleted file mode 100644 index f35dcc48e7b0ee174dbc3b01e5f2181482dc5ce0..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/king_ordering.cpp +++ /dev/null @@ -1,147 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// Doug Gregor, D. Kevin McGrath -// -// This file is part of the Boost Graph Library -// -// You should have received a copy of the License Agreement for the -// Boost Graph Library along with the software; see the file LICENSE. -// If not, contact Office of Research, University of Notre Dame, Notre -// Dame, IN 46556. -// -// Permission to modify the code and to distribute modified code is -// granted, provided the text of this NOTICE is retained, a notice that -// the code was modified is included with the above COPYRIGHT NOTICE and -// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE -// file is distributed with the modified code. -// -// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. -// By way of example, but not limitation, Licensor MAKES NO -// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY -// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS -// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS -// OR OTHER RIGHTS. -//======================================================================= - -#include <boost/config.hpp> -#include <vector> -#include <iostream> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/king_ordering.hpp> -#include <boost/graph/properties.hpp> -#include <boost/graph/bandwidth.hpp> - -/* - Sample Output - original bandwidth: 8 - Reverse Cuthill-McKee ordering starting at: 6 - 8 3 0 9 2 5 1 4 7 6 - bandwidth: 4 - Reverse Cuthill-McKee ordering starting at: 0 - 9 1 4 6 7 2 8 5 3 0 - bandwidth: 4 - Reverse Cuthill-McKee ordering: - 0 8 5 7 3 6 4 2 1 9 - bandwidth: 4 - */ -int main(int , char* []) -{ - using namespace boost; - using namespace std; - typedef 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; - - typedef std::pair<std::size_t, std::size_t> Pair; - Pair edges[14] = { Pair(0,3), //a-d - Pair(0,5), //a-f - Pair(1,2), //b-c - Pair(1,4), //b-e - Pair(1,6), //b-g - Pair(1,9), //b-j - Pair(2,3), //c-d - Pair(2,4), //c-e - Pair(3,5), //d-f - Pair(3,8), //d-i - Pair(4,6), //e-g - Pair(5,6), //f-g - Pair(5,7), //f-h - Pair(6,7) }; //g-h - - Graph G(10); - for (int i = 0; i < 14; ++i) - add_edge(edges[i].first, edges[i].second, G); - - graph_traits<Graph>::vertex_iterator ui, ui_end; - - property_map<Graph,vertex_degree_t>::type deg = get(vertex_degree, G); - for (boost::tie(ui, ui_end) = vertices(G); ui != ui_end; ++ui) - deg[*ui] = degree(*ui, G); - - property_map<Graph, vertex_index_t>::type - index_map = get(vertex_index, G); - - std::cout << "original bandwidth: " << bandwidth(G) << std::endl; - - std::vector<Vertex> inv_perm(num_vertices(G)); - std::vector<size_type> perm(num_vertices(G)); - { - Vertex s = vertex(6, G); - //king_ordering - king_ordering(G, s, inv_perm.rbegin(), get(vertex_color, G), - get(vertex_degree, G)); - cout << "King ordering starting at: " << s << endl; - cout << " "; - for (std::vector<Vertex>::const_iterator i = inv_perm.begin(); - i != inv_perm.end(); ++i) - cout << index_map[*i] << " "; - cout << endl; - - for (size_type c = 0; c != inv_perm.size(); ++c) - perm[index_map[inv_perm[c]]] = c; - std::cout << " bandwidth: " - << bandwidth(G, make_iterator_property_map(&perm[0], index_map, perm[0])) - << std::endl; - } - { - Vertex s = vertex(0, G); - //king_ordering - king_ordering(G, s, inv_perm.rbegin(), get(vertex_color, G), - get(vertex_degree, G)); - cout << "King ordering starting at: " << s << endl; - cout << " "; - for (std::vector<Vertex>::const_iterator i=inv_perm.begin(); - i != inv_perm.end(); ++i) - cout << index_map[*i] << " "; - cout << endl; - - for (size_type c = 0; c != inv_perm.size(); ++c) - perm[index_map[inv_perm[c]]] = c; - std::cout << " bandwidth: " - << bandwidth(G, make_iterator_property_map(&perm[0], index_map, perm[0])) - << std::endl; - } - - { - //king_ordering - king_ordering(G, inv_perm.rbegin(), get(vertex_color, G), - make_degree_map(G)); - - cout << "King ordering:" << endl; - cout << " "; - for (std::vector<Vertex>::const_iterator i=inv_perm.begin(); - i != inv_perm.end(); ++i) - cout << index_map[*i] << " "; - cout << endl; - - for (size_type c = 0; c != inv_perm.size(); ++c) - perm[index_map[inv_perm[c]]] = c; - std::cout << " bandwidth: " - << bandwidth(G, make_iterator_property_map(&perm[0], index_map, perm[0])) - << std::endl; - } - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/knights-tour.cpp b/Utilities/BGL/boost/graph/example/knights-tour.cpp deleted file mode 100644 index 292bdfa23a049170147a4496552a059106306cd5..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/knights-tour.cpp +++ /dev/null @@ -1,342 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <stdlib.h> -#include <iostream> -#include <stack> -#include <queue> -#include <boost/operators.hpp> -#include <boost/graph/breadth_first_search.hpp> -#include <boost/graph/visitors.hpp> -#include <boost/property_map.hpp> - -using namespace boost; - -typedef -std::pair < int, int > - Position; -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) -}; - - -Position -operator + (const Position & p1, const Position & p2) -{ - return Position(p1.first + p2.first, p1.second + p2.second); -} - -struct knights_tour_graph; -struct knight_adjacency_iterator: - public - boost::forward_iterator_helper < - knight_adjacency_iterator, - Position, - std::ptrdiff_t, - Position *, - Position > -{ - knight_adjacency_iterator() - { - } - knight_adjacency_iterator(int ii, Position p, const knights_tour_graph & g) - : - m_pos(p), - m_g(&g), - m_i(ii) - { - valid_position(); - } - Position operator *() const - { - return - m_pos + - knight_jumps[m_i]; - } - void - operator++ () - { - ++m_i; - valid_position(); - } - bool - operator == (const knight_adjacency_iterator & x) const { - return - m_i == - x. - m_i; - } -protected: - void - valid_position(); - Position - m_pos; - const knights_tour_graph * - m_g; - int - m_i; -}; - -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; - knights_tour_graph(int n): - m_board_size(n) - { - } - int - m_board_size; -}; -int -num_vertices(const knights_tour_graph & g) -{ - return g.m_board_size * g.m_board_size; -} - -void -knight_adjacency_iterator::valid_position() -{ - Position new_pos = m_pos + knight_jumps[m_i]; - while (m_i < 8 && (new_pos.first < 0 || new_pos.second < 0 - || new_pos.first >= m_g->m_board_size - || new_pos.second >= m_g->m_board_size)) { - ++m_i; - new_pos = m_pos + knight_jumps[m_i]; - } -} - - -std::pair < knights_tour_graph::adjacency_iterator, - 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; - return std::make_pair(Iter(0, v, g), Iter(8, v, g)); -} - - -struct compare_first -{ - template < typename P > bool operator() (const P & x, const P & y) - { - return x.first < y.first; - } -}; - -template < typename Graph, typename TimePropertyMap > - 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; - std::stack < P > S; - int time_stamp = 0; - - S.push(std::make_pair(time_stamp, src)); - while (!S.empty()) { - Vertex x; - tie(time_stamp, x) = S.top(); - put(time_map, x, time_stamp); - // all vertices have been visited, success! - if (time_stamp == num_vertices(g) - 1) - return true; - - bool deadend = true; - typename graph_traits < Graph >::adjacency_iterator i, end; - for (tie(i, end) = adjacent_vertices(x, g); i != end; ++i) - if (get(time_map, *i) == -1) { - S.push(std::make_pair(time_stamp + 1, *i)); - deadend = false; - } - - if (deadend) { - put(time_map, x, -1); - S.pop(); - tie(time_stamp, x) = S.top(); - while (get(time_map, x) != -1) { // unwind stack to last unexplored vertex - put(time_map, x, -1); - S.pop(); - tie(time_stamp, x) = S.top(); - } - } - - } // while (!S.empty()) - return false; -} - -template < typename Vertex, typename Graph, typename TimePropertyMap > int -number_of_successors(Vertex x, Graph & g, TimePropertyMap time_map) -{ - int s_x = 0; - typename graph_traits < Graph >::adjacency_iterator i, end; - for (tie(i, end) = adjacent_vertices(x, g); i != end; ++i) - if (get(time_map, *i) == -1) - ++s_x; - return s_x; -} - -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; - std::stack < P > S; - int time_stamp = 0; - - S.push(std::make_pair(time_stamp, src)); - while (!S.empty()) { - Vertex x; - tie(time_stamp, x) = S.top(); - put(time_map, x, time_stamp); - // all vertices have been visited, success! - if (time_stamp == num_vertices(g) - 1) - return true; - - // Put adjacent vertices into a local priority queue - std::priority_queue < P, std::vector < P >, compare_first > Q; - typename graph_traits < Graph >::adjacency_iterator i, end; - int num_succ; - for (tie(i, end) = adjacent_vertices(x, g); i != end; ++i) - if (get(time_map, *i) == -1) { - num_succ = number_of_successors(*i, g, time_map); - Q.push(std::make_pair(num_succ, *i)); - } - bool deadend = Q.empty(); - // move vertices from local priority queue to the stack - for (; !Q.empty(); Q.pop()) { - tie(num_succ, x) = Q.top(); - S.push(std::make_pair(time_stamp + 1, x)); - } - if (deadend) { - put(time_map, x, -1); - S.pop(); - tie(time_stamp, x) = S.top(); - while (get(time_map, x) != -1) { // unwind stack to last unexplored vertex - put(time_map, x, -1); - S.pop(); - tie(time_stamp, x) = S.top(); - } - } - - } // while (!S.empty()) - return false; -} - - -struct board_map -{ - typedef int value_type; - typedef Position key_type; - typedef read_write_property_map_tag category; - 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); - friend std::ostream & operator << (std::ostream & os, const board_map & ba); -private: - int *m_board; - int m_size; -}; - -int -get(const board_map & ba, Position p) -{ - return ba.m_board[p.first * ba.m_size + p.second]; -} - -void -put(const board_map & ba, Position p, int v) -{ - ba.m_board[p.first * ba.m_size + p.second] = v; -} - -std::ostream & operator << (std::ostream & os, const board_map & ba) { - for (int i = 0; i < ba.m_size; ++i) { - for (int j = 0; j < ba.m_size; ++j) - os << get(ba, Position(i, j)) << "\t"; - os << std::endl; - } - return os; -} - -int -main(int argc, char *argv[]) -{ - int - N; - if (argc == 2) - N = atoi(argv[1]); - else - N = 8; - - knights_tour_graph - g(N); - int * - board = - new int[num_vertices(g)]; - board_map - chessboard(board, N); - for (int i = 0; i < N; ++i) - for (int j = 0; j < N; ++j) - put(chessboard, Position(i, j), -1); - - bool - ret = - warnsdorff(g, Position(0, 0), chessboard); - - if (ret) - for (int i = 0; i < N; ++i) { - for (int j = 0; j < N; ++j) - std::cout << get(chessboard, Position(i, j)) << "\t"; - std::cout << std::endl; - } else - std::cout << "method failed" << std::endl; - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/knights_tour.expected b/Utilities/BGL/boost/graph/example/knights_tour.expected deleted file mode 100644 index a7f230b463605361702b3d454ebda6da285bf782..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/knights_tour.expected +++ /dev/null @@ -1,8 +0,0 @@ -0 13 28 61 10 15 18 47 -29 36 11 14 27 46 9 16 -12 1 62 37 60 17 48 19 -35 30 59 54 49 26 45 8 -2 55 34 63 38 53 20 25 -31 58 39 52 23 50 7 44 -40 3 56 33 42 5 24 21 -57 32 41 4 51 22 43 6 diff --git a/Utilities/BGL/boost/graph/example/kruskal-example.cpp b/Utilities/BGL/boost/graph/example/kruskal-example.cpp deleted file mode 100644 index 23d360570a88dfed25eeb8f099dd2cbc2a81d049..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/kruskal-example.cpp +++ /dev/null @@ -1,72 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/kruskal_min_spanning_tree.hpp> -#include <iostream> -#include <fstream> - -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 graph_traits < Graph >::vertex_descriptor Vertex; - typedef std::pair<int, int> E; - - 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), E(4, 0), E(4, 1) - }; - int weights[] = { 1, 1, 2, 7, 3, 1, 1, 1 }; - std::size_t num_edges = sizeof(edge_array) / sizeof(E); -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - Graph g(num_nodes); - property_map<Graph, edge_weight_t>::type weightmap = get(edge_weight, g); - for (std::size_t j = 0; j < num_edges; ++j) { - Edge e; bool inserted; - tie(e, inserted) = add_edge(edge_array[j].first, edge_array[j].second, g); - weightmap[e] = weights[j]; - } -#else - Graph g(edge_array, edge_array + num_edges, weights, num_nodes); -#endif - property_map < Graph, edge_weight_t >::type weight = get(edge_weight, g); - std::vector < Edge > spanning_tree; - - kruskal_minimum_spanning_tree(g, std::back_inserter(spanning_tree)); - - std::cout << "Print the edges in the MST:" << std::endl; - for (std::vector < Edge >::iterator ei = spanning_tree.begin(); - ei != spanning_tree.end(); ++ei) { - std::cout << source(*ei, g) << " <--> " << target(*ei, g) - << " with weight of " << weight[*ei] - << std::endl; - } - - std::ofstream fout("figs/kruskal-eg.dot"); - fout << "graph A {\n" - << " rankdir=LR\n" - << " size=\"3,3\"\n" - << " ratio=\"filled\"\n" - << " edge[style=\"bold\"]\n" << " node[shape=\"circle\"]\n"; - graph_traits<Graph>::edge_iterator eiter, eiter_end; - for (tie(eiter, eiter_end) = edges(g); eiter != eiter_end; ++eiter) { - fout << source(*eiter, g) << " -- " << target(*eiter, g); - if (std::find(spanning_tree.begin(), spanning_tree.end(), *eiter) - != spanning_tree.end()) - fout << "[color=\"black\", label=\"" << get(edge_weight, g, *eiter) - << "\"];\n"; - else - fout << "[color=\"gray\", label=\"" << get(edge_weight, g, *eiter) - << "\"];\n"; - } - fout << "}\n"; - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/kruskal-telephone.cpp b/Utilities/BGL/boost/graph/example/kruskal-telephone.cpp deleted file mode 100644 index 1a24e77f337ca3e49a0528d89e1ee96f0a473714..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/kruskal-telephone.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <fstream> -#include <boost/lexical_cast.hpp> -#include <boost/graph/graphviz.hpp> -#include <boost/graph/kruskal_min_spanning_tree.hpp> - -int -main() -{ - using namespace boost; - 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; - Graph g(num_vertices(g_dot)); - property_map < GraphvizGraph, edge_attribute_t >::type - edge_attr_map = get(edge_attribute, g_dot); - graph_traits < GraphvizGraph >::edge_iterator ei, ei_end; - for (tie(ei, ei_end) = edges(g_dot); ei != ei_end; ++ei) { - int weight = lexical_cast < int >(edge_attr_map[*ei]["label"]); - property < edge_weight_t, int >edge_property(weight); - add_edge(source(*ei, g_dot), target(*ei, g_dot), edge_property, g); - } - - std::vector < graph_traits < Graph >::edge_descriptor > mst; - typedef std::vector < graph_traits < Graph >::edge_descriptor >::size_type size_type; - kruskal_minimum_spanning_tree(g, std::back_inserter(mst)); - - property_map < Graph, edge_weight_t >::type weight = get(edge_weight, g); - int total_weight = 0; - for (size_type e = 0; e < mst.size(); ++e) - total_weight += get(weight, mst[e]); - std::cout << "total weight: " << total_weight << std::endl; - - typedef graph_traits < Graph >::vertex_descriptor Vertex; - for (size_type i = 0; i < mst.size(); ++i) { - Vertex u = source(mst[i], g), v = target(mst[i], g); - edge_attr_map[edge(u, v, g_dot).first]["color"] = "black"; - } - std::ofstream out("figs/telephone-mst-kruskal.dot"); - graph_property < GraphvizGraph, graph_edge_attribute_t >::type & - graph_edge_attr_map = get_property(g_dot, graph_edge_attribute); - graph_edge_attr_map["color"] = "gray"; - graph_edge_attr_map["style"] = "bold"; - write_graphviz(out, g_dot); - - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/kruskal.expected b/Utilities/BGL/boost/graph/example/kruskal.expected deleted file mode 100644 index 7fa4320ffb079dfcb0d94c85ace6714656755c46..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/kruskal.expected +++ /dev/null @@ -1,5 +0,0 @@ -Print the edge in MST: -0 <--> 2 with weight of 1 -3 <--> 4 with weight of 1 -4 <--> 0 with weight of 1 -1 <--> 3 with weight of 1 diff --git a/Utilities/BGL/boost/graph/example/last-mod-time.cpp b/Utilities/BGL/boost/graph/example/last-mod-time.cpp deleted file mode 100644 index 4788dd72b278cc2a1af66d565e081c3d846b043e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/last-mod-time.cpp +++ /dev/null @@ -1,91 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <fstream> -#include <string> -#include <unistd.h> -#include <sys/stat.h> -#include <boost/graph/adjacency_list.hpp> - -using namespace boost; - -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; - size_type n_vertices; - typename graph_traits < Graph >::vertex_descriptor u; - typename property_traits < VertexNamePropertyMap >::value_type name; - - graph_in >> n_vertices; // read in number of vertices - for (size_type i = 0; i < n_vertices; ++i) { // Add n vertices to the graph - u = add_vertex(g); - name_in >> name; - put(name_map, u, name); // ** Attach name property to vertex u ** - } - size_type src, targ; - while (graph_in >> src) // Read in edges - if (graph_in >> targ) - add_edge(src, targ, g); // add an edge to the graph - else - break; -} - - -int -main() -{ - typedef 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("makefile-dependencies.dat"), - name_in("makefile-target-names.dat"); - if (!file_in) { - std::cerr << "** Error: could not open file makefile-target-names.dat" - << std::endl; - exit(-1); - } - // Obtain internal property map from the graph - property_map < graph_type, vertex_name_t >::type name_map = - get(vertex_name, g); - read_graph_file(file_in, name_in, g, name_map); - - // 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; - // Create last modified time property map - iter_map_t mod_time_map(last_mod_vec.begin(), get(vertex_index, g)); - - property_map < graph_type, vertex_name_t >::type 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; - std::pair < vertex_iter_t, vertex_iter_t > p; - for (p = vertices(g); p.first != p.second; ++p.first) { - u = *p.first; - if (stat(name[u].c_str(), &stat_buf) != 0) - std::cerr << "error in stat() for file " << name[u] << std::endl; - put(mod_time_map, u, stat_buf.st_mtime); - } - - for (p = vertices(g); p.first != p.second; ++p.first) { - std::cout << name[*p.first] << " was last modified at " - << ctime(&mod_time_map[*p.first]); - } - assert(num_vertices(g) == 15); - assert(num_edges(g) == 19); - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/leda-concept-check.cpp b/Utilities/BGL/boost/graph/example/leda-concept-check.cpp deleted file mode 100644 index 21fc16060d9f3b952bd0139158dcbd10ac4bae04..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/leda-concept-check.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/graph/graph_concepts.hpp> -#include <boost/graph/leda_graph.hpp> - -int -main() -{ - using namespace boost; - typedef leda::GRAPH < int, int >Graph; - function_requires < VertexListGraphConcept < Graph > >(); - function_requires < BidirectionalGraphConcept < Graph > >(); - function_requires < VertexMutableGraphConcept < Graph > >(); - function_requires < EdgeMutableGraphConcept < Graph > >(); - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/leda-graph-eg.cpp b/Utilities/BGL/boost/graph/example/leda-graph-eg.cpp deleted file mode 100644 index 81449a669543d86b291a1e64f74a5c570441b140..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/leda-graph-eg.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/graph/leda_graph.hpp> -#include <iostream> -#undef string // LEDA macro! -int -main() -{ - using namespace boost; - typedef leda::GRAPH < std::string, int >graph_t; - graph_t g; - g.new_node("Philoctetes"); - g.new_node("Heracles"); - g.new_node("Alcmena"); - g.new_node("Eurystheus"); - g.new_node("Amphitryon"); - typedef property_map < graph_t, vertex_all_t >::type NodeMap; - NodeMap node_name_map = get(vertex_all, g); - graph_traits < graph_t >::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) - std::cout << node_name_map[*vi] << std::endl; - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/leda-regression.cfg b/Utilities/BGL/boost/graph/example/leda-regression.cfg deleted file mode 100644 index 5009fc4dd48528be42398e5d703ab55ca581aee4..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/leda-regression.cfg +++ /dev/null @@ -1,10 +0,0 @@ -// Boost Graph Library LEDA examples regression test configuration file -// -// From the boost/status directory, run -// ./regression --tests ../libs/graph/example/leda-regression.cfg -o graph-leda-eg.html -// -// Please keep the entries ordered alphabetically by the test's file name. - -compile libs/graph/example/leda-concept-check.cpp -compile libs/graph/example/leda-graph-eg.cpp -compile libs/graph/example/topo-sort-with-leda.cpp diff --git a/Utilities/BGL/boost/graph/example/loops_dfs.cpp b/Utilities/BGL/boost/graph/example/loops_dfs.cpp deleted file mode 100644 index 66855b8893230b66a8a73e4aa05abb5ea5a87cb3..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/loops_dfs.cpp +++ /dev/null @@ -1,188 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <fstream> -#include <stack> -#include <map> -#include <boost/lexical_cast.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/depth_first_search.hpp> -#include <boost/graph/graphviz.hpp> -#include <boost/graph/copy.hpp> -#include <boost/graph/reverse_graph.hpp> - -using namespace boost; - -template < typename OutputIterator > -class back_edge_recorder : public default_dfs_visitor -{ -public: - back_edge_recorder(OutputIterator out):m_out(out) { } - - template < typename Edge, typename Graph > - void back_edge(Edge e, const Graph &) - { - *m_out++ = e; - } -private: - OutputIterator m_out; -}; - -// object generator function -template < typename OutputIterator > -back_edge_recorder < OutputIterator > -make_back_edge_recorder(OutputIterator out) -{ - return back_edge_recorder < OutputIterator > (out); -} - -template < typename Graph, typename Loops > void -find_loops(typename graph_traits < Graph >::vertex_descriptor entry, - const Graph & g, - Loops & loops) // A container of sets of vertices -{ - function_requires < BidirectionalGraphConcept < Graph > >(); - typedef typename graph_traits < Graph >::edge_descriptor Edge; - typedef typename graph_traits < Graph >::vertex_descriptor Vertex; - std::vector < Edge > back_edges; - std::vector < default_color_type > color_map(num_vertices(g)); - depth_first_visit(g, entry, - make_back_edge_recorder(std::back_inserter(back_edges)), - make_iterator_property_map(color_map.begin(), - get(vertex_index, g), color_map[0])); - - for (std::vector < Edge >::size_type i = 0; i < back_edges.size(); ++i) { - typename Loops::value_type x; - loops.push_back(x); - compute_loop_extent(back_edges[i], g, loops.back()); - } -} - -template < typename Graph, typename Set > void -compute_loop_extent(typename graph_traits < - Graph >::edge_descriptor back_edge, const Graph & g, - Set & loop_set) -{ - function_requires < BidirectionalGraphConcept < Graph > >(); - typedef typename graph_traits < Graph >::vertex_descriptor Vertex; - typedef color_traits < default_color_type > Color; - - Vertex loop_head, loop_tail; - loop_tail = source(back_edge, g); - loop_head = target(back_edge, g); - - std::vector < default_color_type > - reachable_from_head(num_vertices(g), Color::white()); - default_color_type c; - depth_first_visit(g, loop_head, default_dfs_visitor(), - make_iterator_property_map(reachable_from_head.begin(), - get(vertex_index, g), c)); - - std::vector < default_color_type > reachable_to_tail(num_vertices(g)); - reverse_graph < Graph > reverse_g(g); - depth_first_visit(reverse_g, loop_tail, default_dfs_visitor(), - make_iterator_property_map(reachable_to_tail.begin(), - get(vertex_index, g), c)); - - typename graph_traits < Graph >::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) - if (reachable_from_head[*vi] != Color::white() - && reachable_to_tail[*vi] != Color::white()) - loop_set.insert(*vi); -} - - -int -main(int argc, char *argv[]) -{ - if (argc < 3) { - std::cerr << "usage: loops_dfs <in-file> <out-file>" << std::endl; - return -1; - } - GraphvizDigraph g_in; - read_graphviz(argv[1], g_in); - - typedef adjacency_list < vecS, vecS, bidirectionalS, - GraphvizVertexProperty, - GraphvizEdgeProperty, GraphvizGraphProperty > Graph; - typedef graph_traits < Graph >::vertex_descriptor Vertex; - - Graph g; -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ has trouble with the get_property() function - get_property(g, graph_name) = "loops"; -#endif - - copy_graph(g_in, g); - - typedef std::set < Vertex > set_t; - typedef std::list < set_t > list_of_sets_t; - list_of_sets_t loops; - Vertex entry = *vertices(g).first; - - find_loops(entry, g, loops); - - property_map<Graph, vertex_attribute_t>::type vattr_map = get(vertex_attribute, g); - property_map<Graph, edge_attribute_t>::type eattr_map = get(edge_attribute, g); - graph_traits < Graph >::edge_iterator ei, ei_end; - - for (list_of_sets_t::iterator i = loops.begin(); i != loops.end(); ++i) { - std::vector < bool > in_loop(num_vertices(g), false); - for (set_t::iterator j = (*i).begin(); j != (*i).end(); ++j) { - vattr_map[*j]["color"] = "gray"; - in_loop[*j] = true; - } - for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) - if (in_loop[source(*ei, g)] && in_loop[target(*ei, g)]) - eattr_map[*ei]["color"] = "gray"; - } - - std::ofstream loops_out(argv[2]); -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ has trouble with the get_property() functions - loops_out << "digraph loops {\n" - << "size=\"3,3\"\n" - << "ratio=\"fill\"\n" - << "shape=\"box\"\n"; - graph_traits<Graph>::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { - loops_out << *vi << "["; - for (std::map<std::string,std::string>::iterator ai = vattr_map[*vi].begin(); - ai != vattr_map[*vi].end(); ++ai) { - loops_out << ai->first << "=" << ai->second; - if (next(ai) != vattr_map[*vi].end()) - loops_out << ", "; - } - loops_out<< "]"; - } - - for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { - loops_out << source(*ei, g) << " -> " << target(*ei, g) << "["; - std::map<std::string,std::string>& attr_map = eattr_map[*ei]; - for (std::map<std::string,std::string>::iterator eai = attr_map.begin(); - eai != attr_map.end(); ++eai) { - loops_out << eai->first << "=" << eai->second; - if (next(eai) != attr_map.end()) - loops_out << ", "; - } - loops_out<< "]"; - } - loops_out << "}\n"; -#else - get_property(g, graph_graph_attribute)["size"] = "3,3"; - get_property(g, graph_graph_attribute)["ratio"] = "fill"; - get_property(g, graph_vertex_attribute)["shape"] = "box"; - - write_graphviz(loops_out, g, - make_vertex_attributes_writer(g), - make_edge_attributes_writer(g), - make_graph_attributes_writer(g)); -#endif - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/makefile-dependencies.dat b/Utilities/BGL/boost/graph/example/makefile-dependencies.dat deleted file mode 100644 index 8772cefb0728335eed395ae323f8abcdf273cfcc..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/makefile-dependencies.dat +++ /dev/null @@ -1,20 +0,0 @@ -15 -0 5 -0 7 -0 11 -1 5 -1 11 -2 5 -2 9 -2 11 -3 7 -4 5 -5 13 -6 7 -7 13 -8 9 -9 12 -10 11 -11 12 -12 14 -13 12 diff --git a/Utilities/BGL/boost/graph/example/makefile-target-names.dat b/Utilities/BGL/boost/graph/example/makefile-target-names.dat deleted file mode 100644 index 166cbb0e2dcadf5fa1869ff605c52d2234a30adc..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/makefile-target-names.dat +++ /dev/null @@ -1,15 +0,0 @@ -dax.h -yow.h -boz.h -zow.h -bar.cpp -bar.o -foo.cpp -foo.o -zig.cpp -zig.o -zag.cpp -zag.o -libzigzag.a -libfoobar.a -killerapp diff --git a/Utilities/BGL/boost/graph/example/max_flow.cpp b/Utilities/BGL/boost/graph/example/max_flow.cpp deleted file mode 100644 index 16a0c9ed24af7b49e67810425ffc409a5259d26c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/max_flow.cpp +++ /dev/null @@ -1,95 +0,0 @@ -//======================================================================= -// Copyright 2000 University of Notre Dame. -// Authors: Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#include <boost/config.hpp> -#include <iostream> -#include <string> -#include <boost/graph/push_relabel_max_flow.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/read_dimacs.hpp> -#include <boost/graph/graph_utility.hpp> - -// Use a DIMACS network flow file as stdin. -// max_flow < max_flow.dat -// -// Sample output: -// c The total flow: -// s 13 -// -// c flow values: -// f 0 6 3 -// f 0 1 6 -// f 0 2 4 -// f 1 5 1 -// f 1 0 0 -// f 1 3 5 -// f 2 4 4 -// f 2 3 0 -// f 2 0 0 -// f 3 7 5 -// f 3 2 0 -// f 3 1 0 -// f 4 5 4 -// f 4 6 0 -// f 5 4 0 -// f 5 7 5 -// f 6 7 3 -// f 6 4 0 -// f 7 6 0 -// f 7 5 0 - -int -main() -{ - using namespace boost; - - typedef adjacency_list_traits<vecS, vecS, directedS> Traits; - typedef 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; - - Graph g; - - property_map<Graph, edge_capacity_t>::type - capacity = get(edge_capacity, g); - property_map<Graph, edge_reverse_t>::type - rev = get(edge_reverse, g); - property_map<Graph, edge_residual_capacity_t>::type - residual_capacity = get(edge_residual_capacity, g); - - Traits::vertex_descriptor s, t; - read_dimacs_max_flow(g, capacity, rev, s, t); - - long flow; -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // Use non-named parameter version - property_map<Graph, vertex_index_t>::type - indexmap = get(vertex_index, g); - flow = push_relabel_max_flow(g, s, t, capacity, residual_capacity, rev, indexmap); -#else - flow = push_relabel_max_flow(g, s, t); -#endif - - std::cout << "c The total flow:" << std::endl; - std::cout << "s " << flow << std::endl << std::endl; - - std::cout << "c flow values:" << std::endl; - graph_traits<Graph>::vertex_iterator u_iter, u_end; - graph_traits<Graph>::out_edge_iterator ei, e_end; - for (tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter) - for (tie(ei, e_end) = out_edges(*u_iter, g); ei != e_end; ++ei) - if (capacity[*ei] > 0) - std::cout << "f " << *u_iter << " " << target(*ei, g) << " " - << (capacity[*ei] - residual_capacity[*ei]) << std::endl; - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/max_flow.dat b/Utilities/BGL/boost/graph/example/max_flow.dat deleted file mode 100644 index bb979a5b88925950f2fe31a2a579607ee70641e7..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/max_flow.dat +++ /dev/null @@ -1,25 +0,0 @@ -c This file was generated by genrmf. -c The parameters are: a: 2 b: 2 c1: 1 c2: 5 -p max 8 20 -n 1 s -n 8 t -a 1 7 3 -a 1 2 20 -a 1 3 20 -a 2 6 1 -a 2 1 20 -a 2 4 20 -a 3 5 4 -a 3 4 20 -a 3 1 20 -a 4 8 5 -a 4 3 20 -a 4 2 20 -a 5 6 20 -a 5 7 20 -a 6 5 20 -a 6 8 20 -a 7 8 20 -a 7 5 20 -a 8 7 20 -a 8 6 20 diff --git a/Utilities/BGL/boost/graph/example/max_flow.expected b/Utilities/BGL/boost/graph/example/max_flow.expected deleted file mode 100644 index f2bb856075b0d6405ffc24e0a359c376f84f21c9..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/max_flow.expected +++ /dev/null @@ -1,24 +0,0 @@ -c The total flow: -s 13 - -c flow values: -f 0 6 3 -f 0 1 0 -f 0 2 10 -f 1 5 1 -f 1 0 0 -f 1 3 0 -f 2 4 4 -f 2 3 6 -f 2 0 0 -f 3 7 5 -f 3 2 0 -f 3 1 1 -f 4 5 4 -f 4 6 0 -f 5 4 0 -f 5 7 5 -f 6 7 3 -f 6 4 0 -f 7 6 0 -f 7 5 0 diff --git a/Utilities/BGL/boost/graph/example/max_flow2.dat b/Utilities/BGL/boost/graph/example/max_flow2.dat deleted file mode 100644 index d607777d3b7d0e3b2eac792c9685c8c59dfa7add..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/max_flow2.dat +++ /dev/null @@ -1,4 +0,0 @@ -p max 2 1 -n 1 s -n 2 t -a 1 2 5 diff --git a/Utilities/BGL/boost/graph/example/max_flow3.dat b/Utilities/BGL/boost/graph/example/max_flow3.dat deleted file mode 100644 index 1340a4e82cc1abfcc77dccc1057fd96d92f21d3d..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/max_flow3.dat +++ /dev/null @@ -1,46 +0,0 @@ -p max 12 43 -n 10 s -n 11 t -a 1 6 43 -a 1 3 18 -a 1 2 66 -a 1 8 115 -a 2 6 22 -a 2 5 41 -a 2 4 42 -a 2 3 84 -a 2 1 66 -a 2 9 163 -a 3 4 41 -a 3 7 60 -a 3 9 79 -a 3 2 84 -a 3 1 18 -a 4 5 84 -a 4 2 42 -a 4 9 121 -a 4 3 41 -a 4 7 102 -a 5 6 64 -a 5 2 41 -a 5 4 84 -a 6 8 158 -a 6 1 43 -a 6 2 22 -a 6 5 64 -a 6 11 701 -a 7 4 102 -a 7 3 60 -a 8 6 158 -a 8 1 115 -a 9 4 121 -a 9 3 79 -a 9 2 163 -a 10 12 701 -a 12 1 100 -a 12 3 100 -a 12 4 100 -a 12 5 100 -a 12 6 100 -a 12 7 100 -a 12 8 100 diff --git a/Utilities/BGL/boost/graph/example/miles_span.cpp b/Utilities/BGL/boost/graph/example/miles_span.cpp deleted file mode 100644 index e905867323fd35b774d7c454b7e497e7739adff9..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/miles_span.cpp +++ /dev/null @@ -1,108 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -// Sample output: -// -// The graph miles(100,0,0,0,0,10,0) has 405 edges, -// and its minimum spanning tree has length 14467. -// - -#include <boost/config.hpp> -#include <string.h> -#include <stdio.h> -#include <boost/graph/stanford_graph.hpp> -#include <boost/graph/prim_minimum_spanning_tree.hpp> - -// A visitor class for accumulating the total length of the minimum -// spanning tree. The Distance template parameter is for a -// PropertyMap. -template <class Distance> -struct total_length_visitor : public boost::dijkstra_visitor<> { - typedef typename boost::property_traits<Distance>::value_type D; - total_length_visitor(D& len, Distance d) - : _total_length(len), _distance(d) { } - template <class Vertex, class Graph> - inline void finish_vertex(Vertex s, Graph& g) { - _total_length += boost::get(_distance, s); - } - D& _total_length; - Distance _distance; -}; - -int main(int argc, char* argv[]) -{ - using namespace boost; - Graph* g; - - unsigned long n = 100; - unsigned long n_weight = 0; - unsigned long w_weight = 0; - unsigned long p_weight = 0; - unsigned long d = 10; - long s = 0; - unsigned long r = 1; - char* file_name = NULL; - - while(--argc){ - if(sscanf(argv[argc],"-n%lu",&n)==1); - else if(sscanf(argv[argc],"-N%lu",&n_weight)==1); - else if(sscanf(argv[argc],"-W%lu",&w_weight)==1); - else if(sscanf(argv[argc],"-P%lu",&p_weight)==1); - else if(sscanf(argv[argc],"-d%lu",&d)==1); - else if(sscanf(argv[argc],"-r%lu",&r)==1); - else if(sscanf(argv[argc],"-s%ld",&s)==1); - else if(strcmp(argv[argc],"-v")==0) verbose = 1; - else if(strncmp(argv[argc],"-g",2)==0) file_name = argv[argc]+2; - else{ - fprintf(stderr, - "Usage: %s [-nN][-dN][-rN][-sN][-NN][-WN][-PN][-v][-gfoo]\n", - argv[0]); - return -2; - } - } - if (file_name) r = 1; - - while (r--) { - if (file_name) - g = restore_graph(file_name); - else - g = miles(n,n_weight,w_weight,p_weight,0L,d,s); - - if(g == NULL || g->n <= 1) { - fprintf(stderr,"Sorry, can't create the graph! (error code %ld)\n", - panic_code); - return-1; - } - - printf("The graph %s has %ld edges,\n", g->id, g->m / 2); - - long sp_length = 0; - - // Use the "z" utility field for distance. - typedef property_map<Graph*, z_property<long> >::type Distance; - Distance d = get(z_property<long>(), g); - // Use the "w" property for parent - typedef property_map<Graph*, w_property<Vertex*> >::type Parent; - Parent p = get(w_property<Vertex*>(), g); - total_length_visitor<Distance> length_vis(sp_length, d); - - prim_minimum_spanning_tree(g, p, - distance_map(get(z_property<long>(), g)). - weight_map(get(edge_length_t(), g)). - // Use the "y" utility field for color - color_map(get(y_property<long>(), g)). - visitor(length_vis)); - - printf(" and its minimum spanning tree has length %ld.\n", sp_length); - - gb_recycle(g); - s++; - } - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/miles_span.expected b/Utilities/BGL/boost/graph/example/miles_span.expected deleted file mode 100644 index f2ab51101c2b52bb3d4dcba0eead552f6e44f1d2..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/miles_span.expected +++ /dev/null @@ -1,2 +0,0 @@ -The graph miles(100,0,0,0,0,10,0) has 405 edges, - and its minimum spanning tree has length 14467. diff --git a/Utilities/BGL/boost/graph/example/min_max_paths.cpp b/Utilities/BGL/boost/graph/example/min_max_paths.cpp deleted file mode 100644 index d9da0ff49081bd03d0aa2e97e4173352f2dbe3ad..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/min_max_paths.cpp +++ /dev/null @@ -1,102 +0,0 @@ -//======================================================================= -// Copyright 1997-2001 University of Notre Dame. -// Authors: Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> - -#include <boost/graph/graph_traits.hpp> -#include <boost/graph/graph_utility.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/dijkstra_shortest_paths.hpp> -#include <boost/graph/visitors.hpp> -#include <boost/graph/transpose_graph.hpp> - -/* Output: - - distances from start vertex: - distance(a) = 0 - distance(b) = 3 - distance(c) = 1 - distance(d) = 3 - distance(e) = 3 - - min-max paths tree - a --> c - b --> - c --> d - d --> e - e --> b - -*/ - -int -main(int , char* []) -{ - using namespace boost; - - typedef adjacency_list<listS, vecS, directedS, - no_property, property<edge_weight_t, int> > Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - - typedef std::pair<int,int> E; - - const char name[] = "abcdef"; - - const int num_nodes = 6; - E edges[] = { E(0,2), E(1,1), E(1,3), E(1,4), E(2,1), E(2,3), - E(3,4), E(4,0), E(4,1) }; - int weights[] = { 1, 2, 1, 2, 7, 3, 1, 1, 1}; - const int n_edges = sizeof(edges)/sizeof(E); -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ can't handle iterator constructors - Graph G(num_nodes); - property_map<Graph, edge_weight_t>::type weightmap = get(edge_weight, G); - for (std::size_t j = 0; j < sizeof(edges) / sizeof(E); ++j) { - graph_traits<Graph>::edge_descriptor e; bool inserted; - tie(e, inserted) = add_edge(edges[j].first, edges[j].second, G); - weightmap[e] = weights[j]; - } -#else - Graph G(edges, edges + n_edges, weights, num_nodes); - property_map<Graph, edge_weight_t>::type weightmap = get(edge_weight, G); -#endif - - std::vector<Vertex> p(num_vertices(G)); - std::vector<int> d(num_vertices(G)); - - Vertex s = *(vertices(G).first); - -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - dijkstra_shortest_paths - (G, s, &p[0], &d[0], weightmap, get(vertex_index, G), - std::greater<int>(), closed_plus<int>(), (std::numeric_limits<int>::max)(), 0, - default_dijkstra_visitor()); -#else - dijkstra_shortest_paths - (G, s, distance_map(&d[0]). - predecessor_map(&p[0]). - distance_compare(std::greater<int>())); -#endif - - std::cout << "distances from start vertex:" << std::endl; - graph_traits<Graph>::vertex_iterator vi, vend; - for(tie(vi,vend) = vertices(G); vi != vend; ++vi) - std::cout << "distance(" << name[*vi] << ") = " << d[*vi] << std::endl; - std::cout << std::endl; - - std::cout << "min-max paths tree" << std::endl; - adjacency_list<> tree(num_nodes); - - for(tie(vi,vend) = vertices(G); vi != vend; ++vi) - if (*vi != p[*vi]) - add_edge(p[*vi], *vi, tree); - - print_graph(tree, name); - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/minimum_degree_ordering.cpp b/Utilities/BGL/boost/graph/example/minimum_degree_ordering.cpp deleted file mode 100644 index 049895cc8b4b7ff5b83e1ee1c3c9d1c8e6d430f7..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/minimum_degree_ordering.cpp +++ /dev/null @@ -1,181 +0,0 @@ -//-*-c++-*- -//======================================================================= -// Copyright 1997-2001 University of Notre Dame. -// Authors: Lie-Quan Lee -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -/* - This file is to demo how to use minimum_degree_ordering algorithm. - - Important Note: This implementation requires the BGL graph to be - directed. Therefore, nonzero entry (i, j) in a symmetrical matrix - A coresponds to two directed edges (i->j and j->i). - - The bcsstk01.rsa is an example graph in Harwell-Boeing format, - and bcsstk01 is the ordering produced by Liu's MMD implementation. - Link this file with iohb.c to get the harwell-boeing I/O functions. - To run this example, type: - - ./minimum_degree_ordering bcsstk01.rsa bcsstk01 - -*/ - -#include <boost/config.hpp> -#include <fstream> -#include <iostream> -#include "boost/graph/adjacency_list.hpp" -#include "boost/graph/graph_utility.hpp" -#include "boost/graph/minimum_degree_ordering.hpp" -#include "iohb.h" - -//copy and modify from mtl harwell boeing stream -struct harwell_boeing -{ - harwell_boeing(char* filename) { - int Nrhs; - char* Type; - Type = new char[4]; - isComplex = false; - readHB_info(filename, &M, &N, &nonzeros, &Type, &Nrhs); - colptr = (int *)malloc((N+1)*sizeof(int)); - if ( colptr == NULL ) IOHBTerminate("Insufficient memory for colptr.\n"); - rowind = (int *)malloc(nonzeros*sizeof(int)); - if ( rowind == NULL ) IOHBTerminate("Insufficient memory for rowind.\n"); - - if ( Type[0] == 'C' ) { - isComplex = true; - val = (double *)malloc(nonzeros*sizeof(double)*2); - if ( val == NULL ) IOHBTerminate("Insufficient memory for val.\n"); - - } else { - if ( Type[0] != 'P' ) { - val = (double *)malloc(nonzeros*sizeof(double)); - if ( val == NULL ) IOHBTerminate("Insufficient memory for val.\n"); - } - } - - readHB_mat_double(filename, colptr, rowind, val); - - cnt = 0; - col = 0; - delete [] Type; - } - - ~harwell_boeing() { - free(colptr); - free(rowind); - free(val); - } - - inline int nrows() const { return M; } - - int cnt; - int col; - int* colptr; - bool isComplex; - int M; - int N; - int nonzeros; - int* rowind; - double* val; -}; - -int main(int argc, char* argv[]) -{ - using namespace std; - using namespace boost; - - if (argc < 2) { - cout << argv[0] << " HB file" << endl; - return -1; - } - - int delta = 0; - - if ( argc >= 4 ) - delta = atoi(argv[3]); - - typedef double Type; - - harwell_boeing hbs(argv[1]); - - //must be BGL directed graph now - typedef adjacency_list<vecS, vecS, directedS> Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - - int n = hbs.nrows(); - - cout << "n is " << n << endl; - - Graph G(n); - - int num_edge = 0; - - for (int i = 0; i < n; ++i) - for (int j = hbs.colptr[i]; j < hbs.colptr[i+1]; ++j) - if ( (hbs.rowind[j - 1] - 1 ) > i ) { - add_edge(hbs.rowind[j - 1] - 1, i, G); - add_edge(i, hbs.rowind[j - 1] - 1, G); - num_edge++; - } - - cout << "number of off-diagnal elements: " << num_edge << endl; - - typedef std::vector<int> Vector; - - Vector inverse_perm(n, 0); - Vector perm(n, 0); - - Vector supernode_sizes(n, 1); // init has to be 1 - - boost::property_map<Graph, vertex_index_t>::type - id = get(vertex_index, G); - - Vector degree(n, 0); - - minimum_degree_ordering - (G, - make_iterator_property_map(°ree[0], id, degree[0]), - &inverse_perm[0], - &perm[0], - make_iterator_property_map(&supernode_sizes[0], id, supernode_sizes[0]), - delta, id); - - if ( argc >= 3 ) { - ifstream input(argv[2]); - if ( input.fail() ) { - cout << argv[3] << " is failed to open!. " << endl; - return -1; - } - int comp; - bool is_correct = true; - int i; - for ( i=0; i<n; i++ ) { - input >> comp; - if ( comp != inverse_perm[i]+1 ) { - cout << "at i= " << i << ": " << comp - << " ***is NOT EQUAL to*** " << inverse_perm[i]+1 << endl; - is_correct = false; - } - } - for ( i=0; i<n; i++ ) { - input >> comp; - if ( comp != perm[i]+1 ) { - cout << "at i= " << i << ": " << comp - << " ***is NOT EQUAL to*** " << perm[i]+1 << endl; - is_correct = false; - } - } - if ( is_correct ) - cout << "Permutation and inverse permutation are correct. "<< endl; - else - cout << "WARNING -- Permutation or inverse permutation is not the " - << "same ones generated by Liu's " << endl; - - } - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/modify_graph.cpp b/Utilities/BGL/boost/graph/example/modify_graph.cpp deleted file mode 100644 index 4cd93306deeb2ef9ea82893db8786f62ea7332f5..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/modify_graph.cpp +++ /dev/null @@ -1,203 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#include <boost/config.hpp> -#include <iostream> -#include <string> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graph_utility.hpp> - -using namespace boost; - -// Predicate Function for use in remove if -template <class NamePropertyMap> -struct name_equals_predicate -{ - name_equals_predicate(const std::string& x, NamePropertyMap name) - : m_str(x), m_name(name) { } - - template <class Edge> - bool operator()(const Edge& e) const { - return m_str == m_name[e]; - } - std::string m_str; - NamePropertyMap m_name; -}; -// helper creation function -template <class NamePropertyMap> -inline name_equals_predicate<NamePropertyMap> -name_equals(const std::string& str, NamePropertyMap name) { - return name_equals_predicate<NamePropertyMap>(str, name); -} - -template <class MutableGraph> -void modify_demo(MutableGraph& g) -{ - typedef graph_traits<MutableGraph> GraphTraits; - typedef typename GraphTraits::vertices_size_type size_type; - typedef typename GraphTraits::edge_descriptor edge_descriptor; - size_type n = 0; - typename GraphTraits::edges_size_type m = 0; - typename GraphTraits::vertex_descriptor u, v, w; - edge_descriptor e, e1, e2; - typename property_map<MutableGraph, edge_name_t>::type - name_map = get(edge_name, g); - bool added; - typename GraphTraits::vertex_iterator vi, vi_end; - - { - v = add_vertex(g); - - assert(num_vertices(g) == n + 1); - assert(size_type(vertices(g).second - vertices(g).first) == n + 1); - assert(v == *std::find(vertices(g).first, vertices(g).second, v)); - } - { - remove_vertex(v, g); - - assert(num_vertices(g) == n); - assert(size_type(vertices(g).second - vertices(g).first) == n); - // v is no longer a valid vertex descriptor - } - { - u = add_vertex(g); - v = add_vertex(g); - - std::pair<edge_descriptor, bool> p = add_edge(u, v, g); - - assert(num_edges(g) == m + 1); - assert(p.second == true); // edge should have been added - assert(source(p.first, g) == u); - assert(target(p.first, g) == v); - assert(p.first == *std::find(out_edges(u, g).first, - out_edges(u, g).second, p.first)); - assert(p.first == *std::find(in_edges(v, g).first, - in_edges(v, g).second, p.first)); - } - { - // use tie() for convenience, avoid using the std::pair - - u = add_vertex(g); - v = add_vertex(g); - - tie(e, added) = add_edge(u, v, g); - - assert(num_edges(g) == m + 2); - assert(added == true); // edge should have been added - assert(source(e, g) == u); - assert(target(e, g) == v); - assert(e == *std::find(out_edges(u, g).first, out_edges(u, g).second, e)); - assert(e == *std::find(in_edges(v, g).first, in_edges(v, g).second, e)); - } - { - add_edge(u, v, g); // add a parallel edge - - remove_edge(u, v, g); - - assert(num_edges(g) == m + 1); - bool exists; - tie(e, exists) = edge(u, v, g); - assert(exists == false); - assert(out_degree(u, g) == 0); - assert(in_degree(v, g) == 0); - } - { - e = *edges(g).first; - tie(u, v) = incident(e, g); - - remove_edge(e, g); - - assert(num_edges(g) == m); - assert(out_degree(u, g) == 0); - assert(in_degree(v, g) == 0); - } - { - add_edge(u, v, g); - - typename GraphTraits::out_edge_iterator iter, iter_end; - tie(iter, iter_end) = out_edges(u, g); - - remove_edge(iter, g); - - assert(num_edges(g) == m); - assert(out_degree(u, g) == 0); - assert(in_degree(v, g) == 0); - } - { - w = add_vertex(g); - tie(e1, added) = add_edge(u, v, g); - tie(e2, added) = add_edge(v, w, g); - name_map[e1] = "I-5"; - name_map[e2] = "Route 66"; - - typename GraphTraits::out_edge_iterator iter, iter_end; - tie(iter, iter_end) = out_edges(u, g); - - remove_edge_if(name_equals("Route 66", name_map), g); - - assert(num_edges(g) == m + 1); - - remove_edge_if(name_equals("I-5", name_map), g); - - assert(num_edges(g) == m); - assert(out_degree(u, g) == 0); - assert(out_degree(v, g) == 0); - assert(in_degree(v, g) == 0); - assert(in_degree(w, g) == 0); - } - { - tie(e1, added) = add_edge(u, v, g); - tie(e2, added) = add_edge(u, w, g); - name_map[e1] = "foo"; - name_map[e2] = "foo"; - - remove_out_edge_if(u, name_equals("foo", name_map), g); - - assert(num_edges(g) == m); - assert(out_degree(u, g) == 0); - } - { - tie(e1, added) = add_edge(u, v, g); - tie(e2, added) = add_edge(w, v, g); - name_map[e1] = "bar"; - name_map[e2] = "bar"; - - remove_in_edge_if(v, name_equals("bar", name_map), g); - - assert(num_edges(g) == m); - assert(in_degree(v, g) == 0); - } - { - add_edge(u, v, g); - add_edge(u, w, g); - add_edge(u, v, g); - add_edge(v, u, g); - - clear_vertex(u, g); - - assert(out_degree(u, g) == 0); - - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { - typename GraphTraits::adjacency_iterator ai, ai_end; - for (tie(ai, ai_end) = adjacent_vertices(*vi, g); - ai != ai_end; ++ai) - assert(*ai != u); - } - } -} - -int -main() -{ - adjacency_list<listS, vecS, bidirectionalS, - no_property, property<edge_name_t, std::string> > g; - - modify_demo(g); - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/modify_graph.expected b/Utilities/BGL/boost/graph/example/modify_graph.expected deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/Utilities/BGL/boost/graph/example/neighbor_bfs.cpp b/Utilities/BGL/boost/graph/example/neighbor_bfs.cpp deleted file mode 100644 index e5b888402cae0ef49e13096856dc34f26ba93b69..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/neighbor_bfs.cpp +++ /dev/null @@ -1,148 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#include <boost/config.hpp> - -#include <algorithm> -#include <vector> -#include <utility> -#include <iostream> - -#include <boost/graph/visitors.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graph_utility.hpp> -#include <boost/graph/neighbor_bfs.hpp> -#include <boost/property_map.hpp> - -/* - - Sample Output: - - 0 --> 2 - 1 --> 1 3 4 - 2 --> 1 3 4 - 3 --> 1 4 - 4 --> 0 1 - distances: 0 2 1 2 1 - parent[0] = 0 - parent[1] = 2 - parent[2] = 0 - parent[3] = 2 - parent[4] = 0 - -*/ - -using namespace boost; - -template <class ParentDecorator> -struct print_parent { - print_parent(const ParentDecorator& p_) : p(p_) { } - template <class Vertex> - void operator()(const Vertex& v) const { - std::cout << "parent[" << v << "] = " << p[v] << std::endl; - } - ParentDecorator p; -}; - -template <class DistanceMap, class PredecessorMap, class ColorMap> -class distance_and_pred_visitor : public neighbor_bfs_visitor<> -{ - typedef typename property_traits<ColorMap>::value_type ColorValue; - typedef color_traits<ColorValue> Color; -public: - distance_and_pred_visitor(DistanceMap d, PredecessorMap p, ColorMap c) - : m_distance(d), m_predecessor(p), m_color(c) { } - - template <class Edge, class Graph> - void tree_out_edge(Edge e, const Graph& g) const - { - typename graph_traits<Graph>::vertex_descriptor - u = source(e, g), v = target(e, g); - put(m_distance, v, get(m_distance, u) + 1); - put(m_predecessor, v, u); - } - template <class Edge, class Graph> - void tree_in_edge(Edge e, const Graph& g) const - { - typename graph_traits<Graph>::vertex_descriptor - u = source(e, g), v = target(e, g); - put(m_distance, u, get(m_distance, v) + 1); - put(m_predecessor, u, v); - } - - DistanceMap m_distance; - PredecessorMap m_predecessor; - ColorMap m_color; -}; - -int main(int , char* []) -{ - typedef adjacency_list< - mapS, vecS, bidirectionalS, - property<vertex_color_t, default_color_type> - > Graph; - - typedef property_map<Graph, vertex_color_t>::type - ColorMap; - - Graph G(5); - add_edge(0, 2, G); - add_edge(1, 1, G); - add_edge(1, 3, G); - add_edge(1, 4, G); - add_edge(2, 1, G); - add_edge(2, 3, G); - add_edge(2, 4, G); - add_edge(3, 1, G); - add_edge(3, 4, G); - add_edge(4, 0, G); - add_edge(4, 1, G); - - typedef Graph::vertex_descriptor Vertex; - - // Array to store predecessor (parent) of each vertex. This will be - // used as a Decorator (actually, its iterator will be). - std::vector<Vertex> p(num_vertices(G)); - // VC++ version of std::vector has no ::pointer, so - // I use ::value_type* instead. - typedef std::vector<Vertex>::value_type* Piter; - - // 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 - // a Decorator. - typedef graph_traits<Graph>::vertices_size_type size_type; - size_type d[5]; - std::fill_n(d, 5, 0); - - // The source vertex - Vertex s = *(vertices(G).first); - p[s] = s; - distance_and_pred_visitor<size_type*, Vertex*, ColorMap> - vis(d, &p[0], get(vertex_color, G)); - neighbor_breadth_first_search - (G, s, visitor(vis). - color_map(get(vertex_color, G))); - - print_graph(G); - - if (num_vertices(G) < 11) { - std::cout << "distances: "; -#ifdef BOOST_OLD_STREAM_ITERATORS - std::copy(d, d + 5, std::ostream_iterator<int, char>(std::cout, " ")); -#else - std::copy(d, d + 5, std::ostream_iterator<int>(std::cout, " ")); -#endif - std::cout << std::endl; - - std::for_each(vertices(G).first, vertices(G).second, - print_parent<Piter>(&p[0])); - } - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/ordered_out_edges.cpp b/Utilities/BGL/boost/graph/example/ordered_out_edges.cpp deleted file mode 100644 index 93613332cb56c56121f453f85328812ba49c8f3b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/ordered_out_edges.cpp +++ /dev/null @@ -1,123 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <functional> -#include <string> - -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/properties.hpp> - -/* - Sample output: - - 0 --chandler--> 1 --joe--> 1 - 1 --chandler--> 0 --joe--> 0 --curly--> 2 --dick--> 3 --dick--> 3 - 2 --curly--> 1 --tom--> 4 - 3 --dick--> 1 --dick--> 1 --harry--> 4 - 4 --tom--> 2 --harry--> 3 - - name(0,1) = chandler - - name(0,1) = chandler - name(0,1) = joe - - */ - -template <class StoredEdge> -struct order_by_name - : public std::binary_function<StoredEdge,StoredEdge,bool> -{ - bool operator()(const StoredEdge& e1, const StoredEdge& e2) const { - // Order by target vertex, then by name. - // std::pair's operator< does a nice job of implementing - // lexicographical compare on tuples. - return std::make_pair(e1.get_target(), boost::get(boost::edge_name, e1)) - < std::make_pair(e2.get_target(), boost::get(boost::edge_name, e2)); - } -}; - -#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -struct ordered_set_by_nameS { }; -namespace boost { - template <class ValueType> - struct container_gen<ordered_set_by_nameS, ValueType> { - typedef std::multiset<ValueType, order_by_name<ValueType> > type; - }; -} -#else -struct ordered_set_by_nameS { - template <class T> - struct bind_ { typedef std::multiset<T, order_by_name<T> > type; }; -}; -namespace boost { - template <> struct container_selector<ordered_set_by_nameS> { - typedef ordered_set_by_nameS type; - }; -} -#endif - -namespace boost { - template <> - struct parallel_edge_traits<ordered_set_by_nameS> { - typedef allow_parallel_edge_tag type; - }; -} - -int -main() -{ -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - std::cout << "This program requires partial specialization" << std::endl; -#else - using namespace boost; - typedef property<edge_name_t, std::string> EdgeProperty; - typedef adjacency_list<ordered_set_by_nameS, vecS, undirectedS, - no_property, EdgeProperty> graph_type; - graph_type g; - - add_edge(0, 1, EdgeProperty("joe"), g); - add_edge(1, 2, EdgeProperty("curly"), g); - add_edge(1, 3, EdgeProperty("dick"), g); - add_edge(1, 3, EdgeProperty("dick"), g); - add_edge(2, 4, EdgeProperty("tom"), g); - add_edge(3, 4, EdgeProperty("harry"), g); - add_edge(0, 1, EdgeProperty("chandler"), g); - - property_map<graph_type, vertex_index_t>::type id = get(vertex_index, g); - property_map<graph_type, edge_name_t>::type name = get(edge_name, g); - - graph_traits<graph_type>::vertex_iterator i, end; - graph_traits<graph_type>::out_edge_iterator ei, edge_end; - for (boost::tie(i, end) = vertices(g); i != end; ++i) { - std::cout << id[*i] << " "; - for (boost::tie(ei, edge_end) = out_edges(*i, g); ei != edge_end; ++ei) - std::cout << " --" << name[*ei] << "--> " << id[target(*ei, g)] << " "; - std::cout << std::endl; - } - std::cout << std::endl; - - bool found; - typedef graph_traits<graph_type> Traits; - Traits::edge_descriptor e; - Traits::out_edge_iterator e_first, e_last; - - tie(e, found) = edge(0, 1, g); - if (found) - std::cout << "name(0,1) = " << name[e] << std::endl; - else - std::cout << "not found" << std::endl; - std::cout << std::endl; - - tie(e_first, e_last) = edge_range(0, 1, g); - while (e_first != e_last) - std::cout << "name(0,1) = " << name[*e_first++] << std::endl; -#endif - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/ordered_out_edges.expected b/Utilities/BGL/boost/graph/example/ordered_out_edges.expected deleted file mode 100644 index 63548a1a073d0fb7da5672fb7129aaf2013d41d0..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/ordered_out_edges.expected +++ /dev/null @@ -1,10 +0,0 @@ -0 --chandler--> 1 --joe--> 1 -1 --chandler--> 0 --joe--> 0 --curly--> 2 --dick--> 3 --dick--> 3 -2 --curly--> 1 --tom--> 4 -3 --dick--> 1 --dick--> 1 --harry--> 4 -4 --tom--> 2 --harry--> 3 - -name(0,1) = chandler - -name(0,1) = chandler -name(0,1) = joe diff --git a/Utilities/BGL/boost/graph/example/ospf-example.cpp b/Utilities/BGL/boost/graph/example/ospf-example.cpp deleted file mode 100644 index 1533288927d249e457bd886b4524650525821ef9..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/ospf-example.cpp +++ /dev/null @@ -1,127 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <fstream> // for file I/O -#include <boost/graph/graphviz.hpp> // for read/write_graphviz() -#include <boost/graph/dijkstra_shortest_paths.hpp> -#include <boost/lexical_cast.hpp> -int -main() -{ - using namespace boost; - GraphvizDigraph g_dot; - read_graphviz("figs/ospf-graph.dot", g_dot); - - typedef adjacency_list < vecS, vecS, directedS, no_property, - property < edge_weight_t, int > > Graph; - typedef graph_traits < Graph >::vertex_descriptor vertex_descriptor; - Graph g(num_vertices(g_dot)); - property_map < GraphvizDigraph, edge_attribute_t >::type - edge_attr_map = get(edge_attribute, g_dot); - graph_traits < GraphvizDigraph >::edge_iterator ei, ei_end; - for (tie(ei, ei_end) = edges(g_dot); ei != ei_end; ++ei) { - int weight = lexical_cast < int >(edge_attr_map[*ei]["label"]); - property < edge_weight_t, int >edge_property(weight); - add_edge(source(*ei, g_dot), target(*ei, g_dot), edge_property, g); - } - - vertex_descriptor router_six; - property_map < GraphvizDigraph, vertex_attribute_t >::type - vertex_attr_map = get(vertex_attribute, g_dot); - graph_traits < GraphvizDigraph >::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g_dot); vi != vi_end; ++vi) - if ("RT6" == vertex_attr_map[*vi]["label"]) { - router_six = *vi; - break; - } - - std::vector < vertex_descriptor > parent(num_vertices(g)); - // All vertices start out as there own parent - typedef graph_traits < Graph >::vertices_size_type size_type; - for (size_type p = 0; p < num_vertices(g); ++p) - parent[p] = p; - -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - std::vector<int> distance(num_vertices(g)); - property_map<Graph, edge_weight_t>::type weightmap = get(edge_weight, g); - property_map<Graph, vertex_index_t>::type indexmap = get(vertex_index, g); - dijkstra_shortest_paths - (g, router_six, &parent[0], &distance[0], weightmap, - indexmap, std::less<int>(), closed_plus<int>(), - (std::numeric_limits<int>::max)(), 0, default_dijkstra_visitor()); -#else - dijkstra_shortest_paths(g, router_six, predecessor_map(&parent[0])); -#endif - - graph_traits < GraphvizDigraph >::edge_descriptor e; - for (size_type i = 0; i < num_vertices(g); ++i) - if (parent[i] != i) { - e = edge(parent[i], i, g_dot).first; - edge_attr_map[e]["color"] = "black"; - } - -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ can't handle write_graphviz :( - { - std::ofstream out("figs/ospf-sptree.dot"); - out << "digraph loops {\n" - << "size=\"3,3\"\n" - << "ratio=\"fill\"\n" - << "shape=\"box\"\n"; - graph_traits<Graph>::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { - out << *vi << "["; - for (std::map<std::string,std::string>::iterator ai = vattr_map[*vi].begin(); - ai != vattr_map[*vi].end(); ++ai) { - out << ai->first << "=" << ai->second; - if (next(ai) != vattr_map[*vi].end()) - out << ", "; - } - out<< "]"; - } - - for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { - out << source(*ei, g) << " -> " << target(*ei, g) << "["; - std::map<std::string,std::string>& attr_map = eattr_map[*ei]; - for (std::map<std::string,std::string>::iterator eai = attr_map.begin(); - eai != attr_map.end(); ++eai) { - out << eai->first << "=" << eai->second; - if (next(eai) != attr_map.end()) - out << ", "; - } - out<< "]"; - } - out << "}\n"; - } -#else - graph_property < GraphvizDigraph, graph_edge_attribute_t >::type & - graph_edge_attr_map = get_property(g_dot, graph_edge_attribute); - graph_edge_attr_map["color"] = "grey"; - write_graphviz("figs/ospf-sptree.dot", g_dot); -#endif - - std::ofstream rtable("routing-table.dat"); - rtable << "Dest Next Hop Total Cost" << std::endl; - for (tie(vi, vi_end) = vertices(g_dot); vi != vi_end; ++vi) - if (parent[*vi] != *vi) { - rtable << vertex_attr_map[*vi]["label"] << " "; - vertex_descriptor v = *vi, child; - int path_cost = 0; - property_map < Graph, edge_weight_t >::type - weight_map = get(edge_weight, g); - do { - path_cost += get(weight_map, edge(parent[v], v, g).first); - child = v; - v = parent[v]; - } while (v != parent[v]); - rtable << vertex_attr_map[child]["label"] << " "; - rtable << path_cost << std::endl; - - } - - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/parallel-compile-time.cpp b/Utilities/BGL/boost/graph/example/parallel-compile-time.cpp deleted file mode 100644 index f66d1bd90bd74c765c7ab27f3cf777a403281764..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/parallel-compile-time.cpp +++ /dev/null @@ -1,204 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <fstream> -#include <iostream> -#include <numeric> -#include <string> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graph_utility.hpp> -#include <boost/graph/property_iter_range.hpp> -#include <boost/graph/depth_first_search.hpp> // for default_dfs_visitor - -namespace std -{ - template < typename T > - std::istream & operator >> (std::istream & in, std::pair < T, T > &p) - { - in >> p.first >> p.second; - return in; - } -} - -namespace boost -{ - enum vertex_compile_cost_t { vertex_compile_cost }; - 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; - -typedef graph_traits<file_dep_graph2>::vertex_descriptor vertex_t; -typedef graph_traits<file_dep_graph2>::edge_descriptor edge_t; - - -template < typename Graph, typename ColorMap, typename Visitor > void -dfs_v2(const Graph & g, - typename graph_traits < Graph >::vertex_descriptor u, - ColorMap color, Visitor vis) -{ - typedef typename property_traits < ColorMap >::value_type color_type; - typedef color_traits < color_type > ColorT; - color[u] = ColorT::gray(); - vis.discover_vertex(u, g); - typename graph_traits < Graph >::out_edge_iterator ei, ei_end; - for (tie(ei, ei_end) = out_edges(u, g); ei != ei_end; ++ei) - if (color[target(*ei, g)] == ColorT::white()) { - vis.tree_edge(*ei, g); - dfs_v2(g, target(*ei, g), color, vis); - } else if (color[target(*ei, g)] == ColorT::gray()) - vis.back_edge(*ei, g); - else - vis.forward_or_cross_edge(*ei, g); - color[u] = ColorT::black(); - vis.finish_vertex(u, g); -} - -template < typename Graph, typename Visitor, typename ColorMap > void -generic_dfs_v2(const Graph & g, Visitor vis, ColorMap color) -{ - typedef typename property_traits <ColorMap >::value_type ColorValue; - typedef color_traits < ColorValue > ColorT; - typename graph_traits < Graph >::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) - color[*vi] = ColorT::white(); - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) - if (color[*vi] == ColorT::white()) - dfs_v2(g, *vi, color, vis); -} - - -template < typename OutputIterator > -struct topo_visitor: public default_dfs_visitor -{ - topo_visitor(OutputIterator & order): - topo_order(order) - { - } - template < typename Graph > void - finish_vertex(typename graph_traits < Graph >::vertex_descriptor u, - const Graph &) - { - *topo_order++ = u; - } - OutputIterator & topo_order; -}; - -template < typename Graph, typename OutputIterator, typename ColorMap > void -topo_sort(const Graph & g, OutputIterator topo_order, ColorMap color) -{ - topo_visitor < OutputIterator > vis(topo_order); - generic_dfs_v2(g, vis, color); -} - - -typedef property_map < file_dep_graph2, vertex_name_t >::type name_map_t; -typedef property_map < file_dep_graph2, vertex_compile_cost_t >::type - compile_cost_map_t; -typedef property_map < file_dep_graph2, vertex_distance_t >::type distance_map_t; -typedef property_map < file_dep_graph2, vertex_color_t >::type color_map_t; - - -int -main() -{ - std::ifstream file_in("makefile-dependencies.dat"); - typedef graph_traits < file_dep_graph2 >::vertices_size_type 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(file_in), input_end; -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ can't handle the iterator constructor - file_dep_graph2 g; - typedef graph_traits<file_dep_graph2 >::vertex_descriptor vertex_t; - std::vector<vertex_t> id2vertex; - for (std::size_t v = 0; v < n_vertices; ++v) - id2vertex.push_back(add_vertex(g)); - while (input_begin != input_end) { - size_type i, j; - tie(i, j) = *input_begin++; - add_edge(id2vertex[i], id2vertex[j], g); - } -#else - file_dep_graph2 g(input_begin, input_end, n_vertices); -#endif - - name_map_t - name_map = - get(vertex_name, g); - compile_cost_map_t - compile_cost_map = - get(vertex_compile_cost, g); - distance_map_t - distance_map = - get(vertex_distance, g); - color_map_t - color_map = - get(vertex_color, g); - - { - std::ifstream name_in("makefile-target-names.dat"); - std::ifstream compile_cost_in("target-compile-costs.dat"); - graph_traits < file_dep_graph2 >::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { - name_in >> name_map[*vi]; - compile_cost_in >> compile_cost_map[*vi]; - } - - } - std::vector < vertex_t > topo_order(num_vertices(g)); - topo_sort(g, topo_order.rbegin(), color_map); - - graph_traits < file_dep_graph2 >::vertex_iterator i, i_end; - graph_traits < file_dep_graph2 >::adjacency_iterator vi, vi_end; - - // find source vertices with zero in-degree by marking all vertices with incoming edges - for (tie(i, i_end) = vertices(g); i != i_end; ++i) - color_map[*i] = white_color; - for (tie(i, i_end) = vertices(g); i != i_end; ++i) - for (tie(vi, vi_end) = adjacent_vertices(*i, g); vi != vi_end; ++vi) - color_map[*vi] = black_color; - - // initialize distances to zero, or for source vertices, to the compile cost - for (tie(i, i_end) = vertices(g); i != i_end; ++i) - if (color_map[*i] == white_color) - distance_map[*i] = compile_cost_map[*i]; - else - distance_map[*i] = 0; - - std::vector < vertex_t >::iterator ui; - for (ui = topo_order.begin(); ui != topo_order.end(); ++ui) { - vertex_t - u = * - ui; - for (tie(vi, vi_end) = adjacent_vertices(u, g); vi != vi_end; ++vi) - if (distance_map[*vi] < distance_map[u] + compile_cost_map[*vi]) - distance_map[*vi] = distance_map[u] + compile_cost_map[*vi]; - } - - graph_property_iter_range < file_dep_graph2, - vertex_distance_t >::iterator ci, ci_end; - tie(ci, ci_end) = get_property_iter_range(g, vertex_distance); - std::cout << "total (parallel) compile time: " - << *std::max_element(ci, ci_end) << std::endl; - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/prim-example.cpp b/Utilities/BGL/boost/graph/example/prim-example.cpp deleted file mode 100644 index cdd93f76e824d537d002f8c1c6b5ec048ff72a78..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/prim-example.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/prim_minimum_spanning_tree.hpp> - -int -main() -{ - using namespace boost; - typedef adjacency_list < vecS, vecS, undirectedS, - property<vertex_distance_t, int>, property < edge_weight_t, int > > Graph; - typedef std::pair < int, int >E; - const int num_nodes = 5; - E edges[] = { E(0, 2), E(1, 3), E(1, 4), E(2, 1), E(2, 3), - E(3, 4), E(4, 0) - }; - int weights[] = { 1, 1, 2, 7, 3, 1, 1 }; -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - Graph g(num_nodes); - property_map<Graph, edge_weight_t>::type weightmap = get(edge_weight, g); - for (std::size_t j = 0; j < sizeof(edges) / sizeof(E); ++j) { - graph_traits<Graph>::edge_descriptor e; bool inserted; - tie(e, inserted) = add_edge(edges[j].first, edges[j].second, g); - weightmap[e] = weights[j]; - } -#else - Graph g(edges, edges + sizeof(edges) / sizeof(E), weights, num_nodes); - property_map<Graph, edge_weight_t>::type weightmap = get(edge_weight, g); -#endif - std::vector < graph_traits < Graph >::vertex_descriptor > - p(num_vertices(g)); - -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - property_map<Graph, vertex_distance_t>::type distance = get(vertex_distance, g); - property_map<Graph, vertex_index_t>::type indexmap = get(vertex_index, g); - prim_minimum_spanning_tree - (g, *vertices(g).first, &p[0], distance, weightmap, indexmap, - default_dijkstra_visitor()); -#else - prim_minimum_spanning_tree(g, &p[0]); -#endif - - for (std::size_t i = 0; i != p.size(); ++i) - if (p[i] != i) - std::cout << "parent[" << i << "] = " << p[i] << std::endl; - else - std::cout << "parent[" << i << "] = no parent" << std::endl; - - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/prim-telephone.cpp b/Utilities/BGL/boost/graph/example/prim-telephone.cpp deleted file mode 100644 index 34d9dacd7d337370e034f221f166b9706e547dae..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/prim-telephone.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <fstream> -#include <vector> -#include <boost/lexical_cast.hpp> -#include <boost/graph/graphviz.hpp> -#include <boost/graph/prim_minimum_spanning_tree.hpp> -int -main() -{ - using namespace boost; - 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; - Graph g(num_vertices(g_dot)); - property_map < GraphvizGraph, edge_attribute_t >::type - edge_attr_map = get(edge_attribute, g_dot); - graph_traits < GraphvizGraph >::edge_iterator ei, ei_end; - for (tie(ei, ei_end) = edges(g_dot); ei != ei_end; ++ei) { - int weight = lexical_cast < int >(edge_attr_map[*ei]["label"]); - property < edge_weight_t, int >edge_property(weight); - add_edge(source(*ei, g_dot), target(*ei, g_dot), edge_property, g); - } - - typedef graph_traits < Graph >::vertex_descriptor Vertex; - std::vector < Vertex > parent(num_vertices(g)); - property_map < Graph, edge_weight_t >::type weight = get(edge_weight, g); -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - property_map<Graph, vertex_index_t>::type indexmap = get(vertex_index, g); - std::vector<std::size_t> distance(num_vertices(g)); - prim_minimum_spanning_tree(g, *vertices(g).first, &parent[0], &distance[0], - weight, indexmap, default_dijkstra_visitor()); -#else - prim_minimum_spanning_tree(g, &parent[0]); -#endif - - int total_weight = 0; - for (int v = 0; v < num_vertices(g); ++v) - if (parent[v] != v) - total_weight += get(weight, edge(parent[v], v, g).first); - std::cout << "total weight: " << total_weight << std::endl; - - for (int u = 0; u < num_vertices(g); ++u) - if (parent[u] != u) - edge_attr_map[edge(parent[u], u, g_dot).first]["color"] = "black"; - std::ofstream out("figs/telephone-mst-prim.dot"); - graph_property < GraphvizGraph, graph_edge_attribute_t >::type & - graph_edge_attr_map = get_property(g_dot, graph_edge_attribute); - graph_edge_attr_map["color"] = "gray"; - write_graphviz(out, g_dot); - - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/prim.expected b/Utilities/BGL/boost/graph/example/prim.expected deleted file mode 100644 index 0a51ff8189b9971ab6e811a04d6c6e3cb0615c73..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/prim.expected +++ /dev/null @@ -1,9 +0,0 @@ -parent[a] = a -parent[b] = a -parent[c] = f -parent[d] = c -parent[e] = d -parent[f] = g -parent[g] = h -parent[h] = a -parent[i] = c diff --git a/Utilities/BGL/boost/graph/example/print-adjacent-vertices.cpp b/Utilities/BGL/boost/graph/example/print-adjacent-vertices.cpp deleted file mode 100644 index 7b1c4b1c9363d1a948c9b948ba62ebebb63de897..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/print-adjacent-vertices.cpp +++ /dev/null @@ -1,111 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <fstream> -#include <string> -#include <boost/graph/adjacency_list.hpp> - -using namespace boost; - -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; - size_type n_vertices; - typename graph_traits < Graph >::vertex_descriptor u; - typename property_traits < VertexNamePropertyMap >::value_type name; - - graph_in >> n_vertices; // read in number of vertices - for (size_type i = 0; i < n_vertices; ++i) { // Add n vertices to the graph - u = add_vertex(g); - name_in >> name; - put(name_map, u, name); // ** Attach name property to vertex u ** - } - size_type src, targ; - while (graph_in >> src) // Read in edges - if (graph_in >> targ) - add_edge(src, targ, g); // add an edge to the graph - else - break; -} - -template < typename Graph, typename VertexNameMap > void -output_adjacent_vertices(std::ostream & out, - typename graph_traits < Graph >::vertex_descriptor u, - const Graph & g, VertexNameMap name_map) -{ - typename graph_traits < Graph >::adjacency_iterator vi, vi_end; - out << get(name_map, u) << " -> { "; - for (tie(vi, vi_end) = adjacent_vertices(u, g); vi != vi_end; ++vi) - out << get(name_map, *vi) << " "; - out << "}" << std::endl; -} - -template < typename NameMap > class name_equals_t { -public: - name_equals_t(const std::string & n, NameMap map) - : m_name(n), m_name_map(map) - { - } - template < typename Vertex > bool operator()(Vertex u) const - { - return get(m_name_map, u) == m_name; - } -private: - std::string m_name; - NameMap m_name_map; -}; - -// object generator function -template < typename NameMap > - inline name_equals_t < NameMap > -name_equals(const std::string & str, NameMap name) -{ - return name_equals_t < NameMap > (str, name); -} - - -int -main() -{ - typedef 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 = "makefile-dependencies.dat"; - const char* target_file_name = "makefile-target-names.dat"; - std::ifstream file_in(dep_file_name), name_in(target_file_name); - if (!file_in) { - std::cerr << "** Error: could not open file " << dep_file_name - << std::endl; - return -1; - } - if (!name_in) { - std::cerr << "** Error: could not open file " << target_file_name - << std::endl; - return -1; - } - // Obtain internal property map from the graph - property_map < graph_type, vertex_name_t >::type name_map = - get(vertex_name, g); - read_graph_file(file_in, name_in, g, name_map); - - graph_traits < graph_type >::vertex_iterator i, end; - tie(i, end) = vertices(g); - i = std::find_if(i, end, name_equals("dax.h", get(vertex_name, g))); - output_adjacent_vertices(std::cout, *i, g, get(vertex_name, g)); - - assert(num_vertices(g) == 15); - assert(num_edges(g) == 19); - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/print-edges.cpp b/Utilities/BGL/boost/graph/example/print-edges.cpp deleted file mode 100644 index 6c982675d897e6feaae1ec6a3e5e382726db5f3b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/print-edges.cpp +++ /dev/null @@ -1,84 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <fstream> -#include <string> -#include <boost/graph/adjacency_list.hpp> - -using namespace boost; - -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; - size_type n_vertices; - typename graph_traits < Graph >::vertex_descriptor u; - typename property_traits < VertexNamePropertyMap >::value_type name; - - graph_in >> n_vertices; // read in number of vertices - for (size_type i = 0; i < n_vertices; ++i) { // Add n vertices to the graph - u = add_vertex(g); - name_in >> name; - put(name_map, u, name); // ** Attach name property to vertex u ** - } - size_type src, targ; - while (graph_in >> src) // Read in edges - if (graph_in >> targ) - add_edge(src, targ, g); // add an edge to the graph - else - break; -} - -template < typename Graph, typename VertexNameMap > void -print_dependencies(std::ostream & out, const Graph & g, - VertexNameMap name_map) -{ - typename graph_traits < Graph >::edge_iterator ei, ei_end; - for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) - out << get(name_map, source(*ei, g)) << " -$>$ " - << get(name_map, target(*ei, g)) << std::endl; -} - - -int -main() -{ - typedef 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 = "makefile-dependencies.dat"; - const char* target_file_name = "makefile-target-names.dat"; - std::ifstream file_in(dep_file_name), name_in(target_file_name); - if (!file_in) { - std::cerr << "** Error: could not open file " << dep_file_name - << std::endl; - return -1; - } - if (!name_in) { - std::cerr << "** Error: could not open file " << target_file_name - << std::endl; - return -1; - } - - // Obtain internal property map from the graph - property_map < graph_type, vertex_name_t >::type name_map = - get(vertex_name, g); - read_graph_file(file_in, name_in, g, name_map); - - print_dependencies(std::cout, g, get(vertex_name, g)); - - assert(num_vertices(g) == 15); - assert(num_edges(g) == 19); - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/print-in-edges.cpp b/Utilities/BGL/boost/graph/example/print-in-edges.cpp deleted file mode 100644 index d2a6f15d1b3608ed26329c197c99a2c803e7f05b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/print-in-edges.cpp +++ /dev/null @@ -1,111 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <fstream> -#include <string> -#include <boost/graph/adjacency_list.hpp> - -using namespace boost; - -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; - size_type n_vertices; - typename graph_traits < Graph >::vertex_descriptor u; - typename property_traits < VertexNamePropertyMap >::value_type name; - - graph_in >> n_vertices; // read in number of vertices - for (size_type i = 0; i < n_vertices; ++i) { // Add n vertices to the graph - u = add_vertex(g); - name_in >> name; - put(name_map, u, name); // ** Attach name property to vertex u ** - } - size_type src, targ; - while (graph_in >> src) // Read in edges - if (graph_in >> targ) - add_edge(src, targ, g); // add an edge to the graph - else - break; -} - -template < typename Graph, typename VertexNameMap > void -output_in_edges(std::ostream & out, const Graph & g, - typename graph_traits < Graph >::vertex_descriptor v, - VertexNameMap name_map) -{ - typename graph_traits < Graph >::in_edge_iterator ei, ei_end; - for (tie(ei, ei_end) = in_edges(v, g); ei != ei_end; ++ei) - out << get(name_map, source(*ei, g)) << " -> " - << get(name_map, target(*ei, g)) << std::endl; -} - -template < typename NameMap > class name_equals_t { -public: - name_equals_t(const std::string & n, NameMap map) - : m_name(n), m_name_map(map) - { - } - template < typename Vertex > bool operator()(Vertex u) const - { - return get(m_name_map, u) == m_name; - } -private: - std::string m_name; - NameMap m_name_map; -}; - -// object generator function -template < typename NameMap > - inline name_equals_t < NameMap > -name_equals(const std::string & str, NameMap name) -{ - return name_equals_t < NameMap > (str, name); -} - - -int -main() -{ - typedef adjacency_list < listS, // Store out-edges of each vertex in a std::list - vecS, // Store vertex set in a std::vector - bidirectionalS, // The graph is directed, with both out-edges and in-edges - 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 = "makefile-dependencies.dat"; - const char* target_file_name = "makefile-target-names.dat"; - std::ifstream file_in(dep_file_name), name_in(target_file_name); - if (!file_in) { - std::cerr << "** Error: could not open file " << dep_file_name - << std::endl; - return -1; - } - if (!name_in) { - std::cerr << "** Error: could not open file " << target_file_name - << std::endl; - return -1; - } - - // Obtain internal property map from the graph - property_map < graph_type, vertex_name_t >::type name_map = - get(vertex_name, g); - read_graph_file(file_in, name_in, g, name_map); - - graph_traits < graph_type >::vertex_iterator i, end; - tie(i, end) = vertices(g); - typedef property_map < graph_type, vertex_name_t >::type name_map_t; - i = std::find_if(i, end, name_equals("libzigzag.a", get(vertex_name, g))); - output_in_edges(std::cout, g, *i, get(vertex_name, g)); - assert(num_vertices(g) == 15); - assert(num_edges(g) == 19); - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/print-out-edges.cpp b/Utilities/BGL/boost/graph/example/print-out-edges.cpp deleted file mode 100644 index e5532f00dad10fba869c905a95cddb8d348b1c97..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/print-out-edges.cpp +++ /dev/null @@ -1,112 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <fstream> -#include <string> -#include <boost/graph/adjacency_list.hpp> - -using namespace boost; - -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; - size_type n_vertices; - typename graph_traits < Graph >::vertex_descriptor u; - typename property_traits < VertexNamePropertyMap >::value_type name; - - graph_in >> n_vertices; // read in number of vertices - for (size_type i = 0; i < n_vertices; ++i) { // Add n vertices to the graph - u = add_vertex(g); - name_in >> name; - put(name_map, u, name); // ** Attach name property to vertex u ** - } - size_type src, targ; - while (graph_in >> src) // Read in edges - if (graph_in >> targ) - add_edge(src, targ, g); // add an edge to the graph - else - break; -} - -template < typename Graph, typename VertexNameMap > void -output_out_edges(std::ostream & out, const Graph & g, - typename graph_traits < Graph >::vertex_descriptor u, - VertexNameMap name_map) -{ - typename graph_traits < Graph >::out_edge_iterator ei, ei_end; - for (tie(ei, ei_end) = out_edges(u, g); ei != ei_end; ++ei) - out << get(name_map, source(*ei, g)) << " -> " - << get(name_map, target(*ei, g)) << std::endl; -} - -template < typename NameMap > class name_equals_t { -public: - name_equals_t(const std::string & n, NameMap map) - : m_name(n), m_name_map(map) - { - } - template < typename Vertex > bool operator()(Vertex u) const - { - return get(m_name_map, u) == m_name; - } -private: - std::string m_name; - NameMap m_name_map; -}; - -// object generator function -template < typename NameMap > - inline name_equals_t < NameMap > -name_equals(const std::string & str, NameMap name) -{ - return name_equals_t < NameMap > (str, name); -} - - -int -main() -{ - typedef 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 = "makefile-dependencies.dat"; - const char* target_file_name = "makefile-target-names.dat"; - std::ifstream file_in(dep_file_name), name_in(target_file_name); - if (!file_in) { - std::cerr << "** Error: could not open file " << dep_file_name - << std::endl; - return -1; - } - if (!name_in) { - std::cerr << "** Error: could not open file " << target_file_name - << std::endl; - return -1; - } - // Obtain internal property map from the graph - property_map < graph_type, vertex_name_t >::type name_map = - get(vertex_name, g); - read_graph_file(file_in, name_in, g, name_map); - - graph_traits < graph_type >::vertex_iterator i, end; - tie(i, end) = vertices(g); - typedef property_map < graph_type, vertex_name_t >::type name_map_t; - name_equals_t < name_map_t > predicate("dax.h", get(vertex_name, g)); - i = std::find_if(i, end, predicate); - output_out_edges(std::cout, g, *i, get(vertex_name, g)); - - assert(num_vertices(g) == 15); - assert(num_edges(g) == 19); - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/property-map-traits-eg.cpp b/Utilities/BGL/boost/graph/example/property-map-traits-eg.cpp deleted file mode 100644 index c82ab19c5b787a6f86e79aeccd25906e89001ca5..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/property-map-traits-eg.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <string> -#include <boost/graph/adjacency_list.hpp> -int -main() -{ - using namespace boost; - typedef adjacency_list < listS, listS, directedS, - property < vertex_name_t, std::string > >graph_t; - graph_t g; - graph_traits < graph_t >::vertex_descriptor u = add_vertex(g); - property_map < graph_t, vertex_name_t >::type - name_map = get(vertex_name, g); - name_map[u] = "Joe"; - std::cout << name_map[u] << std::endl; - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/property_iterator.cpp b/Utilities/BGL/boost/graph/example/property_iterator.cpp deleted file mode 100644 index 8bffee14023ebb444ad4e84ee6bc8eaf7764f37e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/property_iterator.cpp +++ /dev/null @@ -1,118 +0,0 @@ - -// (C) Copyright François Faure, iMAGIS-GRAVIR / UJF, 2001. Permission -// to copy, use, modify, sell and distribute this software is granted -// provided this copyright notice appears in all copies. This software -// is provided "as is" without express or implied warranty, and with -// no claim as to its suitability for any purpose. - - -// Revision History: -// 03 May 2001 Jeremy Siek -// Moved property iterator code to headers. -// 02 May 2001 François Faure -// Initial version. - -#include <boost/graph/adjacency_list_io.hpp> -#include <boost/graph/property_iter_range.hpp> -#include <fstream> -#include <algorithm> - - -using namespace boost; - -//======== vertex properties -struct toto_t { - enum { num = 23063}; - typedef vertex_property_tag kind; -}; -typedef property< toto_t, double > Toto; - -struct radius_t { - enum { num = 23062}; - typedef vertex_property_tag kind; -}; -typedef property< radius_t, double, Toto > Radius; - -struct mass_t { - enum { num = 23061}; - typedef vertex_property_tag kind; -}; -typedef property< mass_t, int, Radius > Mass; - - -//====== edge properties -struct stiff_t { - enum { num = 23064}; - typedef edge_property_tag kind; -}; -typedef property<stiff_t, double> Stiff; - - - -//===== graph type -typedef Mass VertexProperty; -typedef Stiff EdgeProperty; -typedef adjacency_list<vecS, setS, bidirectionalS, - VertexProperty, EdgeProperty> Graph; - - -//===== utilities -struct Print -{ - template<class T> - Print& operator() (const T& t) { - std::cout << t << " "; - return (*this); - } -}; - -template<class T> -struct Set -{ - T value; - - Set( const T& t ):value(t){} - - Set& operator() (T& t) { - t=value; - return (*this); - } -}; - - -//===== program -int main(int argc, char* argv[]) -{ - if (argc < 2) { - std::cerr<<"args: file"<<std::endl; - return EXIT_FAILURE; - } - - std::ifstream readFile(argv[1]); - - Graph graph; - readFile >> read( graph ); - std::cout << write( graph ); - - std::cout << "radii:" << std::endl; - graph_property_iter_range<Graph,radius_t>::type - seqRadius = get_property_iter_range(graph,radius_t()); - std::for_each( seqRadius.first, seqRadius.second, Print() ); - std::cout << std::endl; - - std::cout << "stiff:" << std::endl; - graph_property_iter_range<Graph,stiff_t>::type - seqStiff = get_property_iter_range(graph, stiff_t()); - std::for_each( seqStiff.first, seqStiff.second, Print() ); - std::cout << std::endl; - - seqStiff = get_property_iter_range(graph, stiff_t()); - std::for_each( seqStiff.first, seqStiff.second, Set<double>(2.4) ); - - std::cout << "new stiff:" << std::endl; - seqStiff = get_property_iter_range(graph,stiff_t()); - std::for_each( seqStiff.first, seqStiff.second, Print() ); - std::cout << std::endl; - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/push-relabel-eg.cpp b/Utilities/BGL/boost/graph/example/push-relabel-eg.cpp deleted file mode 100644 index 2015ebcbef54a7371367d436259ada16768f84b6..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/push-relabel-eg.cpp +++ /dev/null @@ -1,84 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <string> -#include <boost/graph/push_relabel_max_flow.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/read_dimacs.hpp> - -// Use a DIMACS network flow file as stdin. -// push-relabel-eg < max_flow.dat -// -// Sample output: -// c The total flow: -// s 13 -// -// c flow values: -// f 0 6 3 -// f 0 1 0 -// f 0 2 10 -// f 1 5 1 -// f 1 0 0 -// f 1 3 0 -// f 2 4 4 -// f 2 3 6 -// f 2 0 0 -// f 3 7 5 -// f 3 2 0 -// f 3 1 1 -// f 4 5 4 -// f 4 6 0 -// f 5 4 0 -// f 5 7 5 -// f 6 7 3 -// f 6 4 0 -// f 7 6 0 -// f 7 5 0 - - -int -main() -{ - using namespace boost; - typedef adjacency_list_traits < vecS, vecS, directedS > Traits; - typedef adjacency_list < vecS, 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; - Graph g; - - property_map < Graph, edge_capacity_t >::type - capacity = get(edge_capacity, g); - property_map < Graph, edge_residual_capacity_t >::type - residual_capacity = get(edge_residual_capacity, g); - property_map < Graph, edge_reverse_t >::type rev = get(edge_reverse, g); - Traits::vertex_descriptor s, t; - read_dimacs_max_flow(g, capacity, rev, s, t); - -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - property_map<Graph, vertex_index_t>::type indexmap = get(vertex_index, g); - long flow = push_relabel_max_flow(g, s, t, capacity, residual_capacity, rev, - indexmap); -#else - long flow = push_relabel_max_flow(g, s, t); -#endif - - std::cout << "c The total flow:" << std::endl; - std::cout << "s " << flow << std::endl << std::endl; - std::cout << "c flow values:" << std::endl; - graph_traits < Graph >::vertex_iterator u_iter, u_end; - graph_traits < Graph >::out_edge_iterator ei, e_end; - for (tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter) - for (tie(ei, e_end) = out_edges(*u_iter, g); ei != e_end; ++ei) - if (capacity[*ei] > 0) - std::cout << "f " << *u_iter << " " << target(*ei, g) << " " - << (capacity[*ei] - residual_capacity[*ei]) << std::endl; - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/put-get-helper-eg.cpp b/Utilities/BGL/boost/graph/example/put-get-helper-eg.cpp deleted file mode 100644 index 6bb911dbaf94f4c74fedc3a07b54c17b12b8a2fe..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/put-get-helper-eg.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <vector> -#include <string> -#include <boost/property_map.hpp> - -#ifdef BOOST_NO_STD_ITERATOR_TRAITS -#error This examples requires a compiler that provides a working std::iterator_traits -#endif - - -namespace foo -{ - using namespace boost; - template < class RandomAccessIterator, class IndexMap > - class iterator_property_map:public boost::put_get_helper < - typename std::iterator_traits < RandomAccessIterator >::reference, - iterator_property_map < RandomAccessIterator, IndexMap > > - { - public: - typedef std::ptrdiff_t key_type; - typedef typename std::iterator_traits < RandomAccessIterator >::value_type - value_type; - typedef typename std::iterator_traits < RandomAccessIterator >::reference - reference; - typedef boost::lvalue_property_map_tag category; - - iterator_property_map(RandomAccessIterator cc = RandomAccessIterator(), - const IndexMap & _id = - IndexMap()):iter(cc), index(_id) - { - } - reference operator[] (std::ptrdiff_t v) const - { - return *(iter + get(index, v)); - } - protected: - RandomAccessIterator iter; - IndexMap index; - }; - -} - -int -main() -{ - typedef std::vector < std::string > vec_t; - typedef foo::iterator_property_map < vec_t::iterator, - boost::identity_property_map > pmap_t; - using namespace boost; - function_requires < Mutable_LvaluePropertyMapConcept < pmap_t, int > >(); - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/quick-tour.cpp b/Utilities/BGL/boost/graph/example/quick-tour.cpp deleted file mode 100644 index d790e594c98de33a910109da3d619c449e5bca0d..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/quick-tour.cpp +++ /dev/null @@ -1,106 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <fstream> -#include <boost/graph/adjacency_list.hpp> -using namespace boost; - -template < typename VertexDescriptor, typename VertexNameMap > void -print_vertex_name(VertexDescriptor v, VertexNameMap name_map) -{ - std::cout << get(name_map, v); -} - -template < typename Graph, typename TransDelayMap, typename VertexNameMap > void -print_trans_delay(typename graph_traits < Graph >::edge_descriptor e, - const Graph & g, TransDelayMap delay_map, - VertexNameMap name_map) -{ - std::cout << "trans-delay(" << get(name_map, source(e, g)) << "," - << get(name_map, target(e, g)) << ") = " << get(delay_map, e); -} - -template < typename Graph, typename VertexNameMap > void -print_vertex_names(const Graph & g, VertexNameMap name_map) -{ - std::cout << "vertices(g) = { "; - typedef typename graph_traits < Graph >::vertex_iterator iter_t; - for (std::pair < iter_t, iter_t > p = vertices(g); p.first != p.second; - ++p.first) { - print_vertex_name(*p.first, name_map); - std::cout << ' '; - } - std::cout << "}" << std::endl; -} - -template < typename Graph, typename TransDelayMap, typename VertexNameMap > void -print_trans_delays(const Graph & g, TransDelayMap trans_delay_map, - VertexNameMap name_map) -{ - typename graph_traits < Graph >::edge_iterator first, last; - for (tie(first, last) = edges(g); first != last; ++first) { - print_trans_delay(*first, g, trans_delay_map, name_map); - std::cout << std::endl; - } -} - -template < typename Graph, typename VertexNameMap, typename TransDelayMap > void -build_router_network(Graph & g, VertexNameMap name_map, - TransDelayMap delay_map) -{ - typename graph_traits < Graph >::vertex_descriptor a, b, c, d, e; - a = add_vertex(g); - name_map[a] = 'a'; - b = add_vertex(g); - name_map[b] = 'b'; - c = add_vertex(g); - name_map[c] = 'c'; - d = add_vertex(g); - name_map[d] = 'd'; - e = add_vertex(g); - name_map[e] = 'e'; - - typename graph_traits < Graph >::edge_descriptor ed; - bool inserted; - - tie(ed, inserted) = add_edge(a, b, g); - delay_map[ed] = 1.2; - tie(ed, inserted) = add_edge(a, d, g); - delay_map[ed] = 4.5; - tie(ed, inserted) = add_edge(b, d, g); - delay_map[ed] = 1.8; - tie(ed, inserted) = add_edge(c, a, g); - delay_map[ed] = 2.6; - tie(ed, inserted) = add_edge(c, e, g); - delay_map[ed] = 5.2; - tie(ed, inserted) = add_edge(d, c, g); - delay_map[ed] = 0.4; - tie(ed, inserted) = add_edge(d, e, g); - delay_map[ed] = 3.3; - -} - - -int -main() -{ - typedef adjacency_list < listS, listS, directedS, - property < vertex_name_t, char >, - property < edge_weight_t, double > > graph_t; - graph_t g; - - property_map < graph_t, vertex_name_t >::type name_map = - get(vertex_name, g); - property_map < graph_t, edge_weight_t >::type delay_map = - get(edge_weight, g); - - build_router_network(g, name_map, delay_map); - print_vertex_names(g, name_map); - print_trans_delays(g, delay_map, name_map); -} diff --git a/Utilities/BGL/boost/graph/example/quick_tour.cpp b/Utilities/BGL/boost/graph/example/quick_tour.cpp deleted file mode 100644 index 78128c9b3c625bf155a40797ffe6dab038c387f0..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/quick_tour.cpp +++ /dev/null @@ -1,141 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#include <boost/config.hpp> -#include <iostream> // for std::cout -#include <utility> // for std::pair -#include <algorithm> // for std::for_each -#include <boost/utility.hpp> // for boost::tie -#include <boost/graph/graph_traits.hpp> // for boost::graph_traits -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graphviz.hpp> - -using namespace boost; - -template <class Graph> struct exercise_vertex { - exercise_vertex(Graph& g_) : g(g_) { } - typedef typename graph_traits<Graph>::vertex_descriptor Vertex; - void operator()(const Vertex& v) const - { - using namespace boost; - typename property_map<Graph, vertex_index_t>::type - vertex_id = get(vertex_index, g); - std::cout << "vertex: " << get(vertex_id, v) << std::endl; - - // Write out the outgoing edges - std::cout << "\tout-edges: "; - typename graph_traits<Graph>::out_edge_iterator out_i, out_end; - typename graph_traits<Graph>::edge_descriptor e; - for (tie(out_i, out_end) = out_edges(v, g); - out_i != out_end; ++out_i) - { - e = *out_i; - Vertex src = source(e, g), targ = target(e, g); - std::cout << "(" << get(vertex_id, src) - << "," << get(vertex_id, targ) << ") "; - } - std::cout << std::endl; - - // Write out the incoming edges - std::cout << "\tin-edges: "; - typename graph_traits<Graph>::in_edge_iterator in_i, in_end; - for (tie(in_i, in_end) = in_edges(v, g); in_i != in_end; ++in_i) - { - e = *in_i; - Vertex src = source(e, g), targ = target(e, g); - std::cout << "(" << get(vertex_id, src) - << "," << get(vertex_id, targ) << ") "; - } - std::cout << std::endl; - - // Write out all adjacent vertices - std::cout << "\tadjacent vertices: "; - typename graph_traits<Graph>::adjacency_iterator ai, ai_end; - for (tie(ai,ai_end) = adjacent_vertices(v, g); ai != ai_end; ++ai) - std::cout << get(vertex_id, *ai) << " "; - std::cout << std::endl; - } - Graph& g; -}; - - -int main(int,char*[]) -{ - // create a typedef for the Graph type - typedef adjacency_list<vecS, vecS, bidirectionalS, - no_property, property<edge_weight_t, float> > Graph; - - // Make convenient labels for the vertices - enum { A, B, C, D, E, N }; - const int num_vertices = N; - const char* name = "ABCDE"; - - // writing out the edges in the graph - typedef std::pair<int,int> Edge; - Edge edge_array[] = - { Edge(A,B), Edge(A,D), Edge(C,A), Edge(D,C), - Edge(C,E), Edge(B,D), Edge(D,E), }; - const int num_edges = sizeof(edge_array)/sizeof(edge_array[0]); - - // average transmission delay (in milliseconds) for each connection - float transmission_delay[] = { 1.2, 4.5, 2.6, 0.4, 5.2, 1.8, 3.3, 9.1 }; - - // declare a graph object, adding the edges and edge properties -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ can't handle the iterator constructor - Graph g(num_vertices); - property_map<Graph, edge_weight_t>::type weightmap = get(edge_weight, g); - for (std::size_t j = 0; j < num_edges; ++j) { - graph_traits<Graph>::edge_descriptor e; bool inserted; - tie(e, inserted) = add_edge(edge_array[j].first, edge_array[j].second, g); - weightmap[e] = transmission_delay[j]; - } -#else - Graph g(edge_array, edge_array + num_edges, - transmission_delay, num_vertices); -#endif - - boost::property_map<Graph, vertex_index_t>::type - vertex_id = get(vertex_index, g); - boost::property_map<Graph, edge_weight_t>::type - trans_delay = get(edge_weight, g); - - std::cout << "vertices(g) = "; - typedef graph_traits<Graph>::vertex_iterator vertex_iter; - std::pair<vertex_iter, vertex_iter> vp; - for (vp = vertices(g); vp.first != vp.second; ++vp.first) - std::cout << name[get(vertex_id, *vp.first)] << " "; - std::cout << std::endl; - - std::cout << "edges(g) = "; - graph_traits<Graph>::edge_iterator ei, ei_end; - for (tie(ei,ei_end) = edges(g); ei != ei_end; ++ei) - std::cout << "(" << name[get(vertex_id, source(*ei, g))] - << "," << name[get(vertex_id, target(*ei, g))] << ") "; - std::cout << std::endl; - - std::for_each(vertices(g).first, vertices(g).second, - exercise_vertex<Graph>(g)); - - std::map<std::string,std::string> graph_attr, vertex_attr, edge_attr; - graph_attr["size"] = "3,3"; - graph_attr["rankdir"] = "LR"; - graph_attr["ratio"] = "fill"; - vertex_attr["shape"] = "circle"; - - boost::write_graphviz(std::cout, g, - make_label_writer(name), - make_label_writer(trans_delay), - make_graph_attributes_writer(graph_attr, vertex_attr, - edge_attr)); - - return 0; -} - - diff --git a/Utilities/BGL/boost/graph/example/quick_tour.expected b/Utilities/BGL/boost/graph/example/quick_tour.expected deleted file mode 100644 index ec66d962ed422c8488fb632d021a51bce6c510bb..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/quick_tour.expected +++ /dev/null @@ -1,22 +0,0 @@ -vertices(g) = 0 1 2 3 4 -edges(g) = (0,1) (0,2) (0,3) (0,4) (2,0) (2,4) (3,0) (3,1) (3,4) (4,0) (4,1) -vertex: 0 - out-edges: (0,1) (0,2) (0,3) (0,4) - in-edges: (2,0) (3,0) (4,0) - adjacent vertices: 1 2 3 4 -vertex: 1 - out-edges: - in-edges: (0,1) (3,1) (4,1) - adjacent vertices: -vertex: 2 - out-edges: (2,0) (2,4) - in-edges: (0,2) - adjacent vertices: 0 4 -vertex: 3 - out-edges: (3,0) (3,1) (3,4) - in-edges: (0,3) - adjacent vertices: 0 1 4 -vertex: 4 - out-edges: (4,0) (4,1) - in-edges: (0,4) (2,4) (3,4) - adjacent vertices: 0 1 diff --git a/Utilities/BGL/boost/graph/example/reachable-loop-head.cpp b/Utilities/BGL/boost/graph/example/reachable-loop-head.cpp deleted file mode 100644 index 729335e6cb1b8ed6ff7413053cd11263e3bbcc7c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/reachable-loop-head.cpp +++ /dev/null @@ -1,93 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <fstream> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/depth_first_search.hpp> -#include <boost/graph/graphviz.hpp> -#include <boost/graph/copy.hpp> - -int -main(int argc, char *argv[]) -{ - if (argc < 3) { - std::cerr << "usage: reachable-loop-head.exe <in-file> <out-file>" - << std::endl; - return -1; - } - using namespace boost; - GraphvizDigraph g; - read_graphviz(argv[1], g); - graph_traits < GraphvizDigraph >::vertex_descriptor loop_head = 1; - typedef color_traits < default_color_type > Color; - - std::vector < default_color_type > - reachable_from_head(num_vertices(g), Color::white()); - default_color_type c; - depth_first_visit(g, loop_head, default_dfs_visitor(), - make_iterator_property_map(reachable_from_head.begin(), - get(vertex_index, g), c)); - - property_map<GraphvizDigraph, vertex_attribute_t>::type - vattr_map = get(vertex_attribute, g); - - graph_traits < GraphvizDigraph >::vertex_iterator i, i_end; - for (tie(i, i_end) = vertices(g); i != i_end; ++i) - if (reachable_from_head[*i] != Color::white()) { - vattr_map[*i]["color"] = "gray"; - vattr_map[*i]["style"] = "filled"; - } - - std::ofstream loops_out(argv[2]); -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ has trouble with the get_property() functions - loops_out << "digraph G {\n" - << "size=\"3,3\"\n" - << "ratio=\"fill\"\n" - << "shape=\"box\"\n"; - graph_traits<GraphvizDigraph>::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { - loops_out << *vi << "["; - for (std::map<std::string,std::string>::iterator ai = vattr_map[*vi].begin(); - ai != vattr_map[*vi].end(); ++ai) { - loops_out << ai->first << "=" << ai->second; - if (next(ai) != vattr_map[*vi].end()) - loops_out << ", "; - } - loops_out<< "]"; - } - property_map<GraphvizDigraph, edge_attribute_t>::type - eattr_map = get(edge_attribute, g); - graph_traits<GraphvizDigraph>::edge_iterator ei, ei_end; - for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { - loops_out << source(*ei, g) << " -> " << target(*ei, g) << "["; - std::map<std::string,std::string>& attr_map = eattr_map[*ei]; - for (std::map<std::string,std::string>::iterator eai = attr_map.begin(); - eai != attr_map.end(); ++eai) { - loops_out << eai->first << "=" << eai->second; - if (next(eai) != attr_map.end()) - loops_out << ", "; - } - loops_out<< "]"; - } - loops_out << "}\n"; -#else - get_property(g, graph_graph_attribute)["size"] = "3,3"; - get_property(g, graph_graph_attribute)["ratio"] = "fill"; - get_property(g, graph_vertex_attribute)["shape"] = "box"; - - write_graphviz(loops_out, g, - make_vertex_attributes_writer(g), - make_edge_attributes_writer(g), - make_graph_attributes_writer(g)); -#endif - - - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/reachable-loop-tail.cpp b/Utilities/BGL/boost/graph/example/reachable-loop-tail.cpp deleted file mode 100644 index b4ca439a6f19e6b5c0a6b6304c70c7b1d8e6c951..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/reachable-loop-tail.cpp +++ /dev/null @@ -1,66 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <fstream> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/depth_first_search.hpp> -#include <boost/graph/graphviz.hpp> -#include <boost/graph/copy.hpp> -#include <boost/graph/reverse_graph.hpp> - -int -main(int argc, char *argv[]) -{ - if (argc < 3) { - std::cerr << "usage: reachable-loop-tail.exe <in-file> <out-file>" - << std::endl; - return -1; - } - using namespace boost; - GraphvizDigraph g_in; - read_graphviz(argv[1], g_in); - - typedef adjacency_list < vecS, vecS, bidirectionalS, - GraphvizVertexProperty, - GraphvizEdgeProperty, GraphvizGraphProperty > Graph; - Graph g; - copy_graph(g_in, g); - - graph_traits < GraphvizDigraph >::vertex_descriptor loop_tail = 6; - typedef color_traits < default_color_type > Color; - default_color_type c; - - std::vector < default_color_type > reachable_to_tail(num_vertices(g)); - reverse_graph < Graph > reverse_g(g); - depth_first_visit(reverse_g, loop_tail, default_dfs_visitor(), - make_iterator_property_map(reachable_to_tail.begin(), - get(vertex_index, g), c)); - - std::ofstream loops_out(argv[2]); - loops_out << "digraph G {\n" - << " graph [ratio=\"fill\",size=\"3,3\"];\n" - << " node [shape=\"box\"];\n" << " edge [style=\"bold\"];\n"; - - property_map<Graph, vertex_attribute_t>::type - vattr_map = get(vertex_attribute, g); - graph_traits < GraphvizDigraph >::vertex_iterator i, i_end; - for (tie(i, i_end) = vertices(g_in); i != i_end; ++i) { - loops_out << *i << "[label=\"" << vattr_map[*i]["label"] - << "\""; - if (reachable_to_tail[*i] != Color::white()) { - loops_out << ", color=\"gray\", style=\"filled\""; - } - loops_out << "]\n"; - } - graph_traits < GraphvizDigraph >::edge_iterator e, e_end; - for (tie(e, e_end) = edges(g_in); e != e_end; ++e) - loops_out << source(*e, g) << " -> " << target(*e, g) << ";\n"; - loops_out << "}\n"; - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/regression.cfg b/Utilities/BGL/boost/graph/example/regression.cfg deleted file mode 100644 index 762d2e6c9215cdeab16f2efb9337dec170bd8fa0..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/regression.cfg +++ /dev/null @@ -1,114 +0,0 @@ -// Boost Graph Library examples regression test configuration file -// -// From the boost/status directory, run -// ./regression --tests ../libs/graph/example/regression.cfg -o graph-eg.html -// -// Please keep the entries ordered alphabetically by the test's file name. - -compile libs/graph/example/accum-compile-times.cpp -compile libs/graph/example/adjacency_list.cpp -compile libs/graph/example/adjacency_list_io.cpp -compile libs/graph/example/adjacency_matrix.cpp -compile libs/graph/example/bellman-example.cpp -compile libs/graph/example/bellman-ford-internet.cpp -compile libs/graph/example/bfs-example.cpp -compile libs/graph/example/bfs-name-printer.cpp -compile libs/graph/example/bfs.cpp -compile libs/graph/example/bfs_neighbor.cpp -compile libs/graph/example/biconnected_components.cpp -compile libs/graph/example/boost_web_graph.cpp -compile libs/graph/example/bucket_sorter.cpp -compile libs/graph/example/cc-internet.cpp -compile libs/graph/example/city_visitor.cpp -compile libs/graph/example/components_on_edgelist.cpp -compile libs/graph/example/connected-components.cpp -compile libs/graph/example/connected_components.cpp -compile libs/graph/example/container_gen.cpp -compile libs/graph/example/copy-example.cpp -compile libs/graph/example/cuthill_mckee_ordering.cpp -compile libs/graph/example/cycle-file-dep.cpp -compile libs/graph/example/cycle-file-dep2.cpp -compile libs/graph/example/dag_shortest_paths.cpp -compile libs/graph/example/dave.cpp -compile libs/graph/example/default-constructor.cpp -compile libs/graph/example/default-constructor2.cpp -compile libs/graph/example/dfs-example.cpp -compile libs/graph/example/dfs-parenthesis.cpp -compile libs/graph/example/dfs.cpp -compile libs/graph/example/dfs_parenthesis.cpp -compile libs/graph/example/dijkstra-example.cpp -compile libs/graph/example/edge-connectivity.cpp -compile libs/graph/example/edge-function.cpp -compile libs/graph/example/edge-iter-constructor.cpp -compile libs/graph/example/edge_basics.cpp -compile libs/graph/example/edge_connectivity.cpp -compile libs/graph/example/edge_iterator_constructor.cpp -compile libs/graph/example/edge_property.cpp -compile libs/graph/example/edmunds-karp-eg.cpp -compile libs/graph/example/exterior_properties.cpp -compile libs/graph/example/exterior_property_map.cpp -compile libs/graph/example/family-tree-eg.cpp -compile libs/graph/example/fibonacci_heap.cpp -compile libs/graph/example/file_dependencies.cpp -compile libs/graph/example/filtered_graph.cpp -compile libs/graph/example/gerdemann.cpp -compile libs/graph/example/graph-assoc-types.cpp -compile libs/graph/example/graph-property-iter-eg.cpp -compile libs/graph/example/graph.cpp -compile libs/graph/example/graphviz.cpp -compile libs/graph/example/in_edges.cpp -compile libs/graph/example/incremental-components-eg.cpp -compile libs/graph/example/incremental_components.cpp -compile libs/graph/example/interior_property_map.cpp -compile libs/graph/example/isomorphism.cpp -compile libs/graph/example/iterator-property-map-eg.cpp -compile libs/graph/example/johnson-eg.cpp -compile libs/graph/example/kevin-bacon.cpp -compile libs/graph/example/knights-tour.cpp -compile libs/graph/example/kruskal-example.cpp -compile libs/graph/example/kruskal-telephone.cpp -compile libs/graph/example/last-mod-time.cpp -compile libs/graph/example/loops_dfs.cpp -compile libs/graph/example/max_flow.cpp -compile libs/graph/example/min_max_paths.cpp -compile libs/graph/example/minimum_degree_ordering.cpp -compile libs/graph/example/modify_graph.cpp -compile libs/graph/example/neighbor_bfs.cpp -compile libs/graph/example/ordered_out_edges.cpp -compile libs/graph/example/ospf-example.cpp -compile libs/graph/example/parallel-compile-time.cpp -compile libs/graph/example/prim-example.cpp -compile libs/graph/example/prim-telephone.cpp -compile libs/graph/example/print-adjacent-vertices.cpp -compile libs/graph/example/print-edges.cpp -compile libs/graph/example/print-in-edges.cpp -compile libs/graph/example/print-out-edges.cpp -compile libs/graph/example/property-map-traits-eg.cpp -compile libs/graph/example/property_iterator.cpp -compile libs/graph/example/push-relabel-eg.cpp -compile libs/graph/example/put-get-helper-eg.cpp -compile libs/graph/example/quick-tour.cpp -compile libs/graph/example/quick_tour.cpp -compile libs/graph/example/reachable-loop-head.cpp -compile libs/graph/example/reachable-loop-tail.cpp -compile libs/graph/example/remove_edge_if_bidir.cpp -compile libs/graph/example/remove_edge_if_dir.cpp -compile libs/graph/example/remove_edge_if_undir.cpp -compile libs/graph/example/reverse-graph-eg.cpp -compile libs/graph/example/scc.cpp -compile libs/graph/example/strong-components.cpp -compile libs/graph/example/strong_components.cpp -compile libs/graph/example/subgraph.cpp -compile libs/graph/example/topo-sort-file-dep.cpp -compile libs/graph/example/topo-sort-file-dep2.cpp -compile libs/graph/example/topo-sort1.cpp -compile libs/graph/example/topo-sort2.cpp -compile libs/graph/example/topo_sort.cpp -compile libs/graph/example/transitive_closure.cpp -compile libs/graph/example/transpose-example.cpp -compile libs/graph/example/undirected.cpp -compile libs/graph/example/vector-as-graph.cpp -compile libs/graph/example/vertex-name-property.cpp -compile libs/graph/example/vertex_basics.cpp -compile libs/graph/example/visitor.cpp - diff --git a/Utilities/BGL/boost/graph/example/regrtest.py b/Utilities/BGL/boost/graph/example/regrtest.py deleted file mode 100644 index a5e523abd8ab94613074a691ae1aa14cd501850a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/regrtest.py +++ /dev/null @@ -1,306 +0,0 @@ -#!/usr/bin/python - -# boost graph library compilation regression test - -# Usage: regrtest [*|compiler] [*|library/program] -# -# Default: regrtest * * -# -# Compilers: bcc = Borland 5.5.1 -# cw = Metrowerks CodeWarrior -# gcc = GNU GCC -# gcc-stlport = GNU GCC with STLport library -# como = Comeau C++ -# vc = Microsoft Visual C++ -# vcstlport = Microsoft Visual C++ with STLport library -# suncc = Sun's C++ compiler -# kcc = KAI C++ 3.4g -# -# Examples: regrtest -# regrtest -# regrtest gcc -# regrtest * smart_ptr/smart_ptr_test.cpp -# regrtest gcc smart_ptr/smart_ptr_test.cpp -# -# Note: use the following command line syntax if output is to be redirected: -# python regrtest.py [*|compiler] [*|library/program] >log 2>&1 - -# Revision history: -# 09 Dec 00 Modified the main boost regrtest.py to create this file. -Jeremy - - -# The Metrowerks and Microsoft compilers require various environment variables be set. -# See mwcc -help -# See http://msdn.microsoft.com/library/devprods/vs6/visualc/vccore/_core_building_on_the_command_line.3a_.overview.htm -# Others: -# See bcb4.hlp. Don't bother with bcb4tools.hlp; it has a bad link to the command line options - -import sys -import os -import time - -#------------------------------------------------------------------------------# - -def invoke( desc, command ): - - print " ", desc - f.write( "<td>" ) - print " ", command #script debugging aid - sys.stdout.flush() - rs=os.system( command ) - print " return status: ", rs - if rs==0: - f.write( "yes" ) - else: - f.write( "no" ) - f.write( "</td>\n" ) - -#------------------------------------------------------------------------------# - -def compile( program ): - - fullpath= path + "/libs/" + program - - print - print "*****", program, "*****" - - f.write( "<tr>\n" ) - f.write( "<td><a href=\"" + program + "\">" + program + "</a></td>\n" ) - -# ---------- Linux2 ---------- # - - if sys.platform == "linux2": - if compiler_arg == "*" or compiler_arg == "gcc": - invoke( "GCC 2.95.2", 'g++ -ftemplate-depth-30 -c -I' + path + ' ' + fullpath ) - if compiler_arg == "*" or compiler_arg == "gcc-stlport": - invoke( "GCC 2.95.2 STLport 4.0", 'g++ -V 2.95.2-stlport -c -ftemplate-depth-30 -I' + path + ' ' + fullpath ) -# if compiler_arg == "*" or compiler_arg == "gcc-exp": -# invoke( "GCC pre-2.97 experimental", '/opt/exp/gcc/bin/g++ -ftemplate-depth-30 -I' + path + ' ' + fullpath ) - if compiler_arg == "*" or compiler_arg == "como": - invoke( "Comeau C++ 4.2.44 beta3", 'como -c -I' + path + ' ' + fullpath) -# if compiler_arg == "*" or compiler_arg == "occ": -# invoke( "OpenC++ 2.5.9", 'occ -c --regular-c++ -I' + path + ' ' + fullpath) - -# ----------- Solaris (Sun OS 5)/Sparc ------ # - - elif sys.platform == "sunos5": - if compiler_arg == "*" or compiler_arg =="suncc": - invoke("Sun WorkShop 6 2000/04/07 C++ 5.1", 'CC -c -I' + path + ' ' + fullpath ) - if compiler_arg == "*" or compiler_arg == "gcc": - invoke( "GCC 2.95.2", 'g++ -Wall -pedantic -ftemplate-depth-30 -Wno-long-long -c -I' + path + ' ' + fullpath ) - if compiler_arg == "*" or compiler_arg == "kcc": - invoke( "KCC 3.4g", 'KCC --strict_warnings -lm -I' + path + ' ' + fullpath ) - - -# ----------- BeOS5/Intel ------ # -# -# currently this compiler fails so many tests that it may not be worth while -# reporting the results: most of these are as a result of broken C++ standard -# libraries and a non-standard <climits>, problems that the forthcoming -# gcc3 should fix (STLPort does not build on this platform). -# - elif sys.platform == "beos": - if compiler_arg=="*" or compiler_arg=="gcc": - invoke( "GNU GCC", "c++ -ftemplate-depth-30 -Wall -I" + path + " " + fullpath ) - if compiler_arg=="*" or compiler_arg=="gcc-sgi": - invoke( "GNU GCC", "c++ -ftemplate-depth-30 -Wall -I/boot/home/config/stlport/stl330 -I" + path + " " + fullpath ) - -# ---------- Windows ---------- # - - else: -# if compiler_arg=="*" or compiler_arg=="bcc54": -# bcc54_path=os.environ["BOOST_BCC54_PATH"] -# invoke( "Borland C++ 5.4 up2", "\"" + bcc54_path + "/bcc32\" -I" + path + " -j10 -q " + fullpath ) - if compiler_arg=="*" or compiler_arg=="bcc": - bcc55_path=os.environ["BOOST_BCC55_PATH"] - invoke( "Borland C++ 5.5.1", "\"" + bcc55_path + "/bcc32\" -I" + path + " -j10 -q " + fullpath ) - - # GCC 2.95.2 is looping on some tests, so only invoke if asked for by name - #if compiler_arg=="*" or compiler_arg=="gcc": - if compiler_arg=="gcc": - # TODO: fix the absolute STLport paths - invoke( "GNU GCC", "c++ -ftemplate-depth-30 -I" + path + " -IC:/stl/STLport-4.0b8/stlport " + fullpath + " c:/stl/STLport-4.0b8/lib/libstlport_gcc.a" ) - - if compiler_arg=="*" or compiler_arg=="cw": - invoke( "Metrowerks CodeWarrior", "mwcc -maxerrors 10 -cwd source -I- -I" + path + " " + fullpath ) - -#John Maddock says use /Zm400 switch; it increases compiler memory -# /MDd causes compiler errors in VC98\INCLUDE\xlocnum -Jeremy Siek - if compiler_arg=="*" or compiler_arg=="vc": - invoke( "VC++ with MS library", 'cl /c /nologo /Zm400 /W3 /GR /GX /Zi /Od /GZ /I "' + path + '" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ' + fullpath ) - if compiler_arg=="*" or compiler_arg=="vcstlport": - stl=os.environ["BOOST_STLPORT_PATH"] - invoke( "VC++ with STLport library", 'cl /c /nologo /Zm400 /W3 /GR /GX /Zi /Od /GZ /I "' + stl + '" /I "' + path + '" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ' + fullpath ) - - - f.write( "</tr>\n" ) - -#------------------------------------------------------------------------------# - -def library(): - - print - print "***** Boost Library *****" - - f.write( "<tr>\n" ) - f.write( "<td>Boost Graph Library build</td>\n" ) - - #if compiler_arg=="*" or compiler_arg=="bcc32": - #if compiler_arg=="*" or compiler_arg=="gcc": - #if compiler_arg=="*" or compiler_arg=="cw": - - #if compiler_arg=="*" or compiler_arg=="vc": - # command='cl /nologo /MDd /W3 /GR /GX /Zi /Od /GZ /I "' + path + '" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB /c"' - # command=command + " " + path + "/libs/" + ... - # invoke( "VC++ with MS library", command ) - -# invoke( "MS Lib with MS library", 'lib /nologo /out:"boost_vc.lib" boost_timer_vc.obj boost_prg_timer_vc.obj boost_prg_display_vc.obj' ) - - #if compiler_arg=="*" or compiler_arg=="vcstlport": - - f.write( "</tr>\n" ) - -#---------------------------------- main ------------------------------------# - -# set up environment variables - -path=os.environ["BOOST_PATH"] - -compiler_arg="*" -if len(sys.argv)>1: - compiler_arg=sys.argv[1] - -program_arg="*" -if len(sys.argv)>2: - program_arg=sys.argv[2] - -if sys.platform == "linux2": - platform = "Linux/x86" -elif sys.platform == "sunos5": - platform = "SunOS5/sparc" -elif sys.platform == "beos": - platform = "BeOS5/x86" -elif sys.platform == "win32": - platform = "Windows" - if os.name == "nt": - platform = platform + " NT / Windows 2000" -else: - print "**** Error: unknown platform ****" - sys.exit(1) - -f=open( "cs-" + sys.platform + ".html", "w" ) - -f.write( "<html>\n<head>\n<title>\nCompiler Status: " + platform + "\n</title>\n</head>" ) -f.write( "<body bgcolor=\"#FFFFFF\" text=\"#000000\">\n" ) -f.write( "<h1><img border=\"0\" src=\"../../../boost.png\" width=\"277\" height=\"86\"></h1>\n" ) -f.write( "<h1>Compiler Status: " + platform + "</h1>\n" ) -f.write( "<p><b>Run Date:</b> " + time.strftime("%d %b %Y %H:%M GMT", time.gmtime(time.time())) + "</p>\n" ) -f.write( "<p>\n" ) -f.write( "<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n" ) -f.write( "<tr>\n" ) -f.write( "<td>Program</td>\n" ) - -if sys.platform == "linux2": - if compiler_arg == "*" or compiler_arg == "gcc": - f.write( "<td>GNU<br>GCC<br>2.95.2</td>\n" ) - if compiler_arg == "*" or compiler_arg == "gcc-stlport": - f.write( "<td>GNU<br>GCC<br>2.95.2<br>STLport<br>4.0</td>\n" ) -# if compiler_arg == "*" or compiler_arg == "gcc-exp": -# f.write( "<td>GNU<br>GCC<br>pre-2.97 experimental</td>\n" ) - if compiler_arg == "*" or compiler_arg == "como": - f.write( "<td>Comeau C++<br>4.2.44 beta3<br>STLport<br>4.0</td>\n" ) -# if compiler_arg == "*" or compiler_arg == "occ": -# f.write( "<td>OpenC++<br>2.5.9</td>\n" ) -elif sys.platform == "sunos5": - if compiler_arg == "*" or compiler_arg == "suncc": - f.write( "<td>Sun C++<br>Sun WorkShop 6, C++ 5.1</td>\n" ) - if compiler_arg == "*" or compiler_arg == "gcc": - f.write( "<td>GNU<br>GCC<br>2.95.2</td>\n" ) - if compiler_arg == "*" or compiler_arg == "kcc": - f.write( "<td>KAI<br>KCC<br>3.4g</td>\n" ) -elif sys.platform == "beos": - if compiler_arg == "*" or compiler_arg == "gcc": - f.write( "<td>GNUPro<br>GCC 2.9</td>\n" ) - if compiler_arg == "*" or compiler_arg == "gcc-sgi": - f.write( "<td>GNUPro<br>GCC 2.9<br>+<br>SGI STL 3.3</td>\n" ) -else: -# if compiler_arg=="*" or compiler_arg=="bcc54": -# f.write( "<td>Borland<br>BCC<br>5.4 up2</td>\n" ) - if compiler_arg=="*" or compiler_arg=="bcc": - f.write( "<td>Borland<br>BCC<br>5.5.1</td>\n" ) - - # GCC 2.95.2 is looping on some tests, so only invoke if asked for by name - #if compiler_arg=="*" or compiler_arg=="gcc": - if compiler_arg=="gcc": - f.write( "<td>GNU<br>GCC<br>2.95.2<br>STLport<br>4.0 beta 8</td>\n" ) - if compiler_arg=="*" or compiler_arg=="cw": - f.write( "<td>Metrowerks<br>CodeWarrior<br>6.0</td>\n" ) - if compiler_arg=="*" or compiler_arg=="vc": - f.write( "<td>Microsoft<br>VC++<br>6.0 SP4</td>\n" ) - if compiler_arg=="*" or compiler_arg=="vcstlport": - f.write( "<td>Microsoft<br>VC++<br>6.0 SP4<br>STLport<br>4.0</td>\n" ) - -f.write( "</tr>\n" ) - -if program_arg=="*": -# compile( "graph/example/LEDA_concept_check.cpp" ) - compile( "graph/example/adjacency_list.cpp" ) - compile( "graph/example/bellman_ford.cpp" ) - compile( "graph/example/bfs.cpp" ) - compile( "graph/example/bfs_basics.cpp" ) - compile( "graph/example/bucket_sorter.cpp" ) - compile( "graph/example/city_visitor.cpp" ) - compile( "graph/example/components_on_edgelist.cpp" ) - compile( "graph/example/concept_checks.cpp" ) - compile( "graph/example/connected_components.cpp" ) - compile( "graph/example/container_gen.cpp" ) - compile( "graph/example/cuthill_mckee_ordering.cpp" ) - compile( "graph/example/dave.cpp" ) - compile( "graph/example/dfs.cpp" ) - compile( "graph/example/dfs_basics.cpp" ) - compile( "graph/example/dfs_parenthesis.cpp" ) - compile( "graph/example/dijkstra.cpp" ) - compile( "graph/example/dynamic_components.cpp" ) - compile( "graph/example/edge_basics.cpp" ) - compile( "graph/example/edge_iterator_constructor.cpp" ) - compile( "graph/example/edge_property.cpp" ) - compile( "graph/example/exterior_properties.cpp" ) - compile( "graph/example/exterior_property_map.cpp" ) - compile( "graph/example/family_tree.cpp" ) - compile( "graph/example/fibonacci_heap.cpp" ) - compile( "graph/example/file_dependencies.cpp" ) - compile( "graph/example/gerdemann.cpp" ) - compile( "graph/example/graph.cpp" ) - compile( "graph/example/in_edges.cpp" ) - compile( "graph/example/interior_property_map.cpp" ) - compile( "graph/example/johnson.cpp" ) - compile( "graph/example/kevin_bacon.cpp" ) - compile( "graph/example/knights_tour.cpp" ) - compile( "graph/example/kruskal.cpp" ) - compile( "graph/example/max_flow.cpp" ) -# compile( "graph/example/miles_span.cpp" ) - compile( "graph/example/ordered_out_edges.cpp" ) - compile( "graph/example/prim.cpp" ) - compile( "graph/example/quick_tour.cpp" ) - compile( "graph/example/remove_edge_if_bidir.cpp" ) - compile( "graph/example/remove_edge_if_dir.cpp" ) - compile( "graph/example/remove_edge_if_undir.cpp" ) - compile( "graph/example/reverse_graph.cpp" ) - compile( "graph/example/topo_sort.cpp" ) - compile( "graph/example/undirected.cpp" ) - compile( "graph/example/vector_as_graph.cpp" ) - compile( "graph/example/vertex_basics.cpp" ) - compile( "graph/example/visitor.cpp" ) -else: - compile( program_arg ) - -f.write( "</table>\n" ); -if sys.platform == "linux2": - f.write( "<p>\nNote: A hand-crafted <limits> Standard header has been applied to all configurations.\n" ) -f.write( "</body>\n</html>\n" ) - -# end - - - - diff --git a/Utilities/BGL/boost/graph/example/remove_edge_if_bidir.cpp b/Utilities/BGL/boost/graph/example/remove_edge_if_bidir.cpp deleted file mode 100644 index 09ddea09788b26b88d96f7d7f413acaf36f8c4c1..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/remove_edge_if_bidir.cpp +++ /dev/null @@ -1,102 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#include <boost/config.hpp> -#include <iostream> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graph_utility.hpp> - -/* - Sample output: - - original graph: - 0 --> 3 2 3 - 1 --> 3 - 2 --> 0 - 3 --> 2 - 1(0,3) 2(0,2) 3(0,3) 4(1,3) 5(2,0) 6(3,2) - - removing edges connecting 0 to 3 - 0 --> 2 - 1 --> 3 - 2 --> 0 - 3 --> 2 - 2(0,2) 4(1,3) 5(2,0) 6(3,2) - removing edges with weight greater than 3 - 0 --> 2 - 1 --> - 2 --> - 3 --> - 2(0,2) - - - */ - -using namespace boost; - -typedef adjacency_list<vecS, vecS, bidirectionalS, - no_property, property<edge_weight_t, int> > Graph; - -struct has_weight_greater_than { - has_weight_greater_than(int w_, Graph& g_) : w(w_), g(g_) { } - bool operator()(graph_traits<Graph>::edge_descriptor e) { -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - property_map<Graph, edge_weight_t>::type weight = get(edge_weight, g); - return get(weight, e) > w; -#else - // This version of get() breaks VC++ - return get(edge_weight, g, e) > w; -#endif - } - int w; - Graph& g; -}; - -int -main() -{ - typedef std::pair<std::size_t,std::size_t> Edge; - Edge edge_array[6] = { Edge(0,3), Edge(0,2), Edge(0, 3), - Edge(1,3), - Edge(2, 0), - Edge(3, 2) }; - -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - Graph g(4); - for (std::size_t j = 0; j < 6; ++j) - add_edge(edge_array[j].first, edge_array[j].second, g); -#else - Graph g(edge_array, edge_array + 6, 4); -#endif - property_map<Graph, edge_weight_t>::type - weight = get(edge_weight, g); - - int w = 0; - graph_traits<Graph>::edge_iterator ei, ei_end; - for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) - weight[*ei] = ++w; - - property_map<Graph, vertex_index_t>::type indexmap = get(vertex_index, g); - - std::cout << "original graph:" << std::endl; - print_graph(g, indexmap); - print_edges2(g, indexmap, weight); - std::cout << std::endl; - - std::cout << "removing edges connecting 0 to 3" << std::endl; - remove_out_edge_if(vertex(0,g), incident_to(vertex(3,g), g), g); - print_graph(g, indexmap); - print_edges2(g, indexmap, weight); - - std::cout << "removing edges with weight greater than 3" << std::endl; - remove_edge_if(has_weight_greater_than(3, g), g); - print_graph(g, indexmap); - print_edges2(g, indexmap, weight); - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/remove_edge_if_bidir.expected b/Utilities/BGL/boost/graph/example/remove_edge_if_bidir.expected deleted file mode 100644 index 62bf6ee03e2cec47a6747e35dc7446499e4eb1ca..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/remove_edge_if_bidir.expected +++ /dev/null @@ -1,19 +0,0 @@ -original graph: -0 --> 3 2 3 -1 --> 3 -2 --> 0 -3 --> 2 -1(0,3) 2(0,2) 3(0,3) 4(1,3) 5(2,0) 6(3,2) - -removing edges connecting 0 to 3 -0 --> 2 -1 --> 3 -2 --> 0 -3 --> 2 -2(0,2) 4(1,3) 5(2,0) 6(3,2) -removing edges with weight greater than 3 -0 --> 2 -1 --> -2 --> -3 --> -2(0,2) diff --git a/Utilities/BGL/boost/graph/example/remove_edge_if_dir.cpp b/Utilities/BGL/boost/graph/example/remove_edge_if_dir.cpp deleted file mode 100644 index 6b6f76edbf35cb803fc428a14a5ca04ed19006e5..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/remove_edge_if_dir.cpp +++ /dev/null @@ -1,73 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#include <boost/config.hpp> -#include <iostream> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graph_utility.hpp> - -/* - Sample output: - - original graph: - 0 --> 3 2 3 - 1 --> 3 - 2 --> 0 - 3 --> 2 - - removing edges (0,3) - 0 --> 2 - 1 --> 3 - 2 --> 0 - 3 --> 2 - removing edge (0,2) and (3, 2) - 0 --> - 1 --> 3 - 2 --> 0 - 3 --> - - */ - -using namespace boost; - -typedef adjacency_list<vecS, vecS, directedS> Graph; - - -int -main() -{ - typedef std::pair<std::size_t,std::size_t> Edge; - Edge edges[6] = { Edge(0,3), Edge(0,2), Edge(0, 3), - Edge(1,3), - Edge(2, 0), - Edge(3, 2) }; - -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ can't handle iterator constructor - Graph g(4); - for (std::size_t j = 0; j < 6; ++j) - add_edge(edges[j].first, edges[j].second, g); -#else - Graph g(edges, edges + 6, 4); -#endif - - std::cout << "original graph:" << std::endl; - print_graph(g, get(vertex_index, g)); - std::cout << std::endl; - - std::cout << "removing edges (0,3)" << std::endl; - remove_out_edge_if(vertex(0,g), incident_to(vertex(3,g), g), g); - print_graph(g, get(vertex_index, g)); - - std::cout << "removing edge (0,2) and (3, 2)" << std::endl; - remove_edge_if(incident_to(vertex(2,g), g), g); - print_graph(g, get(vertex_index, g)); - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/remove_edge_if_dir.expected b/Utilities/BGL/boost/graph/example/remove_edge_if_dir.expected deleted file mode 100644 index 875e4854851a3e1270d90082db87d54d3067a6f5..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/remove_edge_if_dir.expected +++ /dev/null @@ -1,16 +0,0 @@ -original graph: -0 --> 3 2 3 -1 --> 3 -2 --> 0 -3 --> 2 - -removing edges (0,3) -0 --> 2 -1 --> 3 -2 --> 0 -3 --> 2 -removing edge (0,2) and (3, 2) -0 --> -1 --> 3 -2 --> 0 -3 --> diff --git a/Utilities/BGL/boost/graph/example/remove_edge_if_undir.cpp b/Utilities/BGL/boost/graph/example/remove_edge_if_undir.cpp deleted file mode 100644 index 7af8131b70e86b02ebf8e7ef0d24af7780e99d33..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/remove_edge_if_undir.cpp +++ /dev/null @@ -1,100 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#include <boost/config.hpp> -#include <iostream> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graph_utility.hpp> - -using namespace boost; - -/* - Sample output: - - original graph: - 0 <--> 3 3 2 - 1 <--> 3 - 2 <--> 0 3 - 3 <--> 0 0 1 2 - 1(0,3) 2(0,3) 3(1,3) 4(2,0) 5(3,2) - - removing edges connecting 0 and 3 - 0 <--> 2 - 1 <--> 3 - 2 <--> 0 3 - 3 <--> 1 2 - 3(1,3) 4(2,0) 5(3,2) - removing edges with weight greater than 3 - 0 <--> - 1 <--> 3 - 2 <--> - 3 <--> 1 - 3(1,3) - - */ - -typedef adjacency_list<vecS, vecS, undirectedS, - no_property, property<edge_weight_t, int> > Graph; - -struct has_weight_greater_than { - has_weight_greater_than(int w_, Graph& g_) : w(w_), g(g_) { } - bool operator()(graph_traits<Graph>::edge_descriptor e) { -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - property_map<Graph, edge_weight_t>::type weight = get(edge_weight, g); - return get(weight, e) > w; -#else - // This version of get breaks VC++ - return get(edge_weight, g, e) > w; -#endif - } - int w; - Graph& g; -}; - -int -main() -{ - typedef std::pair<std::size_t,std::size_t> Edge; - Edge edge_array[5] = { Edge(0, 3), Edge(0, 3), - Edge(1, 3), - Edge(2, 0), - Edge(3, 2) }; - -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - Graph g(4); - for (std::size_t j = 0; j < 5; ++j) - add_edge(edge_array[j].first, edge_array[j].second, g); -#else - Graph g(edge_array, edge_array + 5, 4); -#endif - property_map<Graph, edge_weight_t>::type - weight = get(edge_weight, g); - - int w = 0; - graph_traits<Graph>::edge_iterator ei, ei_end; - for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) - weight[*ei] = ++w; - - std::cout << "original graph:" << std::endl; - print_graph(g, get(vertex_index, g)); - print_edges2(g, get(vertex_index, g), get(edge_weight, g)); - std::cout << std::endl; - - std::cout << "removing edges connecting 0 and 3" << std::endl; - remove_out_edge_if(vertex(0, g), incident_on(vertex(3, g), g), g); - print_graph(g, get(vertex_index, g)); - print_edges2(g, get(vertex_index, g), get(edge_weight, g)); - - std::cout << "removing edges with weight greater than 3" << std::endl; - remove_edge_if(has_weight_greater_than(3, g), g); - print_graph(g, get(vertex_index, g)); - print_edges2(g, get(vertex_index, g), get(edge_weight, g)); - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/remove_edge_if_undir.expected b/Utilities/BGL/boost/graph/example/remove_edge_if_undir.expected deleted file mode 100644 index 1614e3833efb06582e30ed08567e83aa5b672c89..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/remove_edge_if_undir.expected +++ /dev/null @@ -1,19 +0,0 @@ -original graph: -0 <--> 3 3 2 -1 <--> 3 -2 <--> 0 3 -3 <--> 0 0 1 2 -1(0,3) 2(0,3) 3(1,3) 4(2,0) 5(3,2) - -removing edges connecting 0 and 3 -0 <--> 2 -1 <--> 3 -2 <--> 0 3 -3 <--> 1 2 -3(1,3) 4(2,0) 5(3,2) -removing edges with weight greater than 3 -0 <--> -1 <--> 3 -2 <--> -3 <--> 1 -3(1,3) diff --git a/Utilities/BGL/boost/graph/example/reverse-graph-eg.cpp b/Utilities/BGL/boost/graph/example/reverse-graph-eg.cpp deleted file mode 100644 index 9ccf1875c410026405d8c25c79dc22539fc6ea96..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/reverse-graph-eg.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> - -#include <algorithm> -#include <vector> -#include <utility> -#include <iostream> - -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/reverse_graph.hpp> -#include <boost/graph/graph_utility.hpp> - -int -main() -{ - using namespace boost; - typedef adjacency_list < vecS, vecS, bidirectionalS > Graph; - - Graph G(5); - add_edge(0, 2, G); - add_edge(1, 1, G); - add_edge(1, 3, G); - add_edge(1, 4, G); - add_edge(2, 1, G); - add_edge(2, 3, G); - add_edge(2, 4, G); - add_edge(3, 1, G); - add_edge(3, 4, G); - add_edge(4, 0, G); - add_edge(4, 1, G); - - std::cout << "original graph:" << std::endl; - print_graph(G, get(vertex_index, G)); - - - std::cout << std::endl << "reversed graph:" << std::endl; -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 // avoid VC++ bug... - reverse_graph<Graph> R(G); - print_graph(R, get(vertex_index, G)); -#else - print_graph(make_reverse_graph(G), get(vertex_index, G)); -#endif - - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/reverse_graph.expected b/Utilities/BGL/boost/graph/example/reverse_graph.expected deleted file mode 100644 index fc3bb22c98340ca9668a8e6b3d5b5e4e5577f4a8..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/reverse_graph.expected +++ /dev/null @@ -1,13 +0,0 @@ -original graph: -0 --> 2 -1 --> 1 3 4 -2 --> 1 3 4 -3 --> 1 4 -4 --> 0 1 - -reversed graph: -0 --> 4 -1 --> 1 2 3 4 -2 --> 0 -3 --> 1 2 -4 --> 1 2 3 diff --git a/Utilities/BGL/boost/graph/example/roget_components.cpp b/Utilities/BGL/boost/graph/example/roget_components.cpp deleted file mode 100644 index c5d2efa0263686ba846d1ec0484d11fd1cf61c72..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/roget_components.cpp +++ /dev/null @@ -1,132 +0,0 @@ -//======================================================================= -// Copyright 2001 University of Notre Dame. -// Authors: Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#include <stdio.h> -#include <iostream> -#include <boost/graph/stanford_graph.hpp> -#include <boost/graph/strong_components.hpp> - -#define specs(v) \ - (filename ? index_map[v] : v->cat_no) << " " << v->name - -int main(int argc, char* argv[]) -{ - using namespace boost; - Graph* g; - typedef graph_traits<Graph*>::vertex_descriptor vertex_t; - unsigned long n = 0; - unsigned long d = 0; - unsigned long p = 0; - long s = 0; - char* filename = NULL; - int c, i; - - while (--argc) { - if (sscanf(argv[argc], "-n%lu", &n) == 1); - else if (sscanf(argv[argc], "-d%lu", &d) == 1); - else if (sscanf(argv[argc], "-p%lu", &p) == 1); - else if (sscanf(argv[argc], "-s%ld", &s) == 1); - else if (strncmp(argv[argc], "-g", 2) == 0) - filename = argv[argc] + 2; - else { - fprintf(stderr, "Usage: %s [-nN][-dN][-pN][-sN][-gfoo]\n", argv[0]); - return -2; - } - } - - g = (filename ? restore_graph(filename) : roget(n, d, p, s)); - if (g == NULL) { - fprintf(stderr, "Sorry, can't create the graph! (error code %ld)\n", - panic_code); - return -1; - } - printf("Reachability analysis of %s\n\n", g->id); - - // - The root map corresponds to what Knuth calls the "min" field. - // - The discover time map is the "rank" field - // - Knuth uses the rank field for double duty, to record the - // discover time, and to keep track of which vertices have - // been visited. The BGL strong_components() function needs - // a separate field for marking colors, so we use the w field. - - std::vector<int> comp(num_vertices(g)); - property_map<Graph*, vertex_index_t>::type - index_map = get(vertex_index, g); - - property_map<Graph*, v_property<vertex_t> >::type - root = get(v_property<vertex_t>(), g); - - int num_comp = strong_components - (g, make_iterator_property_map(comp.begin(), index_map), - root_map(root). - discover_time_map(get(z_property<long>(), g)). - color_map(get(w_property<long>(), g))); - - std::vector< std::vector<vertex_t> > strong_comp(num_comp); - - // First add representative vertices to each component's list - graph_traits<Graph*>::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) - if (root[*vi] == *vi) - strong_comp[comp[index_map[*vi]]].push_back(*vi); - - // Then add the other vertices of the component - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) - if (root[*vi] != *vi) - strong_comp[comp[index_map[*vi]]].push_back(*vi); - - // We do not print out the "from" and "to" information as Knuth - // does because we no longer have easy access to that information - // from outside the algorithm. - - for (c = 0; c < num_comp; ++c) { - vertex_t v = strong_comp[c].front(); - std::cout << "Strong component `" << specs(v) << "'"; - if (strong_comp[c].size() > 1) { - std::cout << " also includes:\n"; - for (i = 1; i < strong_comp[c].size(); ++i) - std::cout << " " << specs(strong_comp[c][i]) << std::endl; - } else - std::cout << std::endl; - } - - // Next we print out the "component graph" or "condensation", that - // is, we consider each component to be a vertex in a new graph - // where there is an edge connecting one component to another if there - // is one or more edges connecting any of the vertices from the - // first component to any of the vertices in the second. We use the - // name of the representative vertex as the name of the component. - - printf("\nLinks between components:\n"); - - // This array provides an efficient way to check if we've already - // created a link from the current component to the component - // of the target vertex. - std::vector<int> mark(num_comp, (std::numeric_limits<int>::max)()); - - // We go in reverse order just to mimic the output ordering in - // Knuth's version. - for (c = num_comp - 1; c >= 0; --c) { - vertex_t u = strong_comp[c][0]; - for (i = 0; i < strong_comp[c].size(); ++i) { - vertex_t v = strong_comp[c][i]; - graph_traits<Graph*>::out_edge_iterator ei, ei_end; - for (tie(ei, ei_end) = out_edges(v, g); ei != ei_end; ++ei) { - vertex_t x = target(*ei, g); - int comp_x = comp[index_map[x]]; - if (comp_x != c && mark[comp_x] != c) { - mark[comp_x] = c; - vertex_t w = strong_comp[comp_x][0]; - std::cout << specs(u) << " -> " << specs(w) - << " (e.g., " << specs(v) << " -> " << specs(x) << ")\n"; - } // if - } // for - } // for - } // for -} diff --git a/Utilities/BGL/boost/graph/example/scc.cpp b/Utilities/BGL/boost/graph/example/scc.cpp deleted file mode 100644 index 0851d3219d19e9ab2a370f33e71aac7e4984bb04..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/scc.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <fstream> -#include <map> -#include <string> -#include <boost/graph/strong_components.hpp> -#include <boost/graph/graphviz.hpp> - -int -main() -{ - using namespace boost; - GraphvizDigraph g; - read_graphviz("figs/scc.dot", g); - - typedef graph_traits < GraphvizDigraph >::vertex_descriptor vertex_t; - std::map < vertex_t, int >component; - - strong_components(g, make_assoc_property_map(component)); - - property_map < GraphvizDigraph, vertex_attribute_t >::type - vertex_attr_map = get(vertex_attribute, g); - std::string color[] = { - "white", "gray", "black", "lightgray"}; - graph_traits < GraphvizDigraph >::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { - vertex_attr_map[*vi]["color"] = color[component[*vi]]; - vertex_attr_map[*vi]["style"] = "filled"; - if (vertex_attr_map[*vi]["color"] == "black") - vertex_attr_map[*vi]["fontcolor"] = "white"; - } - write_graphviz("figs/scc-out.dot", g); - - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/scc.dot b/Utilities/BGL/boost/graph/example/scc.dot deleted file mode 100644 index eb55f5d6374888d7fe27e3d6e1501caf8dc50a2e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/scc.dot +++ /dev/null @@ -1,33 +0,0 @@ - -digraph SCC { - node[shape=circle]; - ratio=1.2 - a - b - c - d - e - f - g - h - i - j - - a -> b - a -> f - a -> h - b -> c - b -> a - c -> d - c -> b - d -> e - e -> d - f -> g - g -> f - g -> d - h -> i - i -> h - i -> j - i -> e - i -> c -} diff --git a/Utilities/BGL/boost/graph/example/sgb-regression.cfg b/Utilities/BGL/boost/graph/example/sgb-regression.cfg deleted file mode 100644 index 067a5ea6ea496d6269acd66bef3a817bb5307325..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/sgb-regression.cfg +++ /dev/null @@ -1,11 +0,0 @@ -// Boost Graph Library LEDA examples regression test configuration file -// -// From the boost/status directory, run -// ./regression --tests ../libs/graph/example/sgb-regression.cfg -o graph-sgb-eg.html -// -// Please keep the entries ordered alphabetically by the test's file name. - -compile libs/graph/example/girth.cpp -compile libs/graph/example/miles_span.cpp -compile libs/graph/example/topo-sort-with-sgb.cpp -compile libs/graph/example/roget_components.cpp diff --git a/Utilities/BGL/boost/graph/example/sloan_ordering.cpp b/Utilities/BGL/boost/graph/example/sloan_ordering.cpp deleted file mode 100644 index 774558fb4427c5c7e708cfdd93c79c4ca9f83ea0..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/sloan_ordering.cpp +++ /dev/null @@ -1,250 +0,0 @@ -// -//======================================================================= -// Copyright 2002 Marc Wintermantel (wintermantel@imes.mavt.ethz.ch) -// ETH Zurich, Center of Structure Technologies (www.imes.ethz.ch/st) -// -// This file is part of the Boost Graph Library -// -// You should have received a copy of the License Agreement for the -// Boost Graph Library along with the software; see the file LICENSE. -// If not, contact Office of Research, University of Notre Dame, Notre -// Dame, IN 46556. -// -// Permission to modify the code and to distribute modified code is -// granted, provided the text of this NOTICE is retained, a notice that -// the code was modified is included with the above COPYRIGHT NOTICE and -// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE -// file is distributed with the modified code. -// -// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. -// By way of example, but not limitation, Licensor MAKES NO -// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY -// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS -// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS -// OR OTHER RIGHTS. -//======================================================================= -// - - -#include <boost/config.hpp> -#include <vector> -#include <iostream> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/sloan_ordering.hpp> -#include <boost/graph/properties.hpp> -#include <boost/graph/bandwidth.hpp> -#include <boost/graph/profile.hpp> -#include <boost/graph/wavefront.hpp> - - -using std::cout; -using std::endl; - -/* - Sample Output - ##################################### - ### First light of sloan-ordering ### - ##################################### - - original bandwidth: 8 - original profile: 42 - original max_wavefront: 7 - original aver_wavefront: 4.2 - original rms_wavefront: 4.58258 - - Starting vertex: 0 - Pseudoperipheral vertex: 9 - Pseudoperipheral radius: 4 - - Sloan ordering starting at: 0 - 0 8 3 7 5 2 4 6 1 9 - bandwidth: 4 - profile: 28 - max_wavefront: 4 - aver_wavefront: 2.8 - rms_wavefront: 2.93258 - - Sloan ordering without a start-vertex: - 8 0 3 7 5 2 4 6 1 9 - bandwidth: 4 - profile: 27 - max_wavefront: 4 - aver_wavefront: 2.7 - rms_wavefront: 2.84605 - - ############################### - ### sloan-ordering finished ### - ############################### -*/ - -int main(int , char* []) -{ - cout << endl; - cout << "#####################################" << endl; - cout << "### First light of sloan-ordering ###" << endl; - cout << "#####################################" << endl << endl; - - using namespace boost; - using namespace std; - - - //Defining the graph type - typedef adjacency_list< - setS, - vecS, - undirectedS, - property< - vertex_color_t, - default_color_type, - property< - vertex_degree_t, - int, - property< - vertex_priority_t, - double > > > > Graph; - - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::vertices_size_type size_type; - - typedef std::pair<std::size_t, std::size_t> Pair; - - Pair edges[14] = { Pair(0,3), //a-d - Pair(0,5), //a-f - Pair(1,2), //b-c - Pair(1,4), //b-e - Pair(1,6), //b-g - Pair(1,9), //b-j - Pair(2,3), //c-d - Pair(2,4), //c-e - Pair(3,5), //d-f - Pair(3,8), //d-i - Pair(4,6), //e-g - Pair(5,6), //f-g - Pair(5,7), //f-h - Pair(6,7) }; //g-h - - - //Creating a graph and adding the edges from above into it - Graph G(10); - for (int i = 0; i < 14; ++i) - add_edge(edges[i].first, edges[i].second, G); - - //Creating two iterators over the vertices - graph_traits<Graph>::vertex_iterator ui, ui_end; - - //Creating a property_map with the degrees of the degrees of each vertex - property_map<Graph,vertex_degree_t>::type deg = get(vertex_degree, G); - for (boost::tie(ui, ui_end) = vertices(G); ui != ui_end; ++ui) - deg[*ui] = degree(*ui, G); - - //Creating a property_map for the indices of a vertex - property_map<Graph, vertex_index_t>::type index_map = get(vertex_index, G); - - std::cout << "original bandwidth: " << bandwidth(G) << std::endl; - std::cout << "original profile: " << profile(G) << std::endl; - std::cout << "original max_wavefront: " << max_wavefront(G) << std::endl; - std::cout << "original aver_wavefront: " << aver_wavefront(G) << std::endl; - std::cout << "original rms_wavefront: " << rms_wavefront(G) << std::endl; - - - //Creating a vector of vertices - std::vector<Vertex> sloan_order(num_vertices(G)); - //Creating a vector of size_type - std::vector<size_type> perm(num_vertices(G)); - - { - - //Setting the start node - Vertex s = vertex(0, G); - int ecc; //defining a variable for the pseudoperipheral radius - - //Calculating the pseudoeperipheral node and radius - Vertex e = pseudo_peripheral_pair(G, s, ecc, get(vertex_color, G), get(vertex_degree, G) ); - - cout << endl; - cout << "Starting vertex: " << s << endl; - cout << "Pseudoperipheral vertex: " << e << endl; - cout << "Pseudoperipheral radius: " << ecc << endl << endl; - - - - //Sloan ordering - sloan_ordering(G, s, e, sloan_order.begin(), get(vertex_color, G), - get(vertex_degree, G), get(vertex_priority, G)); - - cout << "Sloan ordering starting at: " << s << endl; - cout << " "; - - for (std::vector<Vertex>::const_iterator i = sloan_order.begin(); - i != sloan_order.end(); ++i) - cout << index_map[*i] << " "; - cout << endl; - - for (size_type c = 0; c != sloan_order.size(); ++c) - perm[index_map[sloan_order[c]]] = c; - std::cout << " bandwidth: " - << bandwidth(G, make_iterator_property_map(&perm[0], index_map, perm[0])) - << std::endl; - std::cout << " profile: " - << profile(G, make_iterator_property_map(&perm[0], index_map, perm[0])) - << std::endl; - std::cout << " max_wavefront: " - << max_wavefront(G, make_iterator_property_map(&perm[0], index_map, perm[0])) - << std::endl; - std::cout << " aver_wavefront: " - << aver_wavefront(G, make_iterator_property_map(&perm[0], index_map, perm[0])) - << std::endl; - std::cout << " rms_wavefront: " - << rms_wavefront(G, make_iterator_property_map(&perm[0], index_map, perm[0])) - << std::endl; - } - - - - - ///////////////////////////////////////////////// - //Version including finding a good starting point - ///////////////////////////////////////////////// - - { - //sloan_ordering - sloan_ordering(G, sloan_order.begin(), - get(vertex_color, G), - make_degree_map(G), - get(vertex_priority, G) ); - - cout << endl << "Sloan ordering without a start-vertex:" << endl; - cout << " "; - for (std::vector<Vertex>::const_iterator i=sloan_order.begin(); - i != sloan_order.end(); ++i) - cout << index_map[*i] << " "; - cout << endl; - - for (size_type c = 0; c != sloan_order.size(); ++c) - perm[index_map[sloan_order[c]]] = c; - std::cout << " bandwidth: " - << bandwidth(G, make_iterator_property_map(&perm[0], index_map, perm[0])) - << std::endl; - std::cout << " profile: " - << profile(G, make_iterator_property_map(&perm[0], index_map, perm[0])) - << std::endl; - std::cout << " max_wavefront: " - << max_wavefront(G, make_iterator_property_map(&perm[0], index_map, perm[0])) - << std::endl; - std::cout << " aver_wavefront: " - << aver_wavefront(G, make_iterator_property_map(&perm[0], index_map, perm[0])) - << std::endl; - std::cout << " rms_wavefront: " - << rms_wavefront(G, make_iterator_property_map(&perm[0], index_map, perm[0])) - << std::endl; - } - - - - cout << endl; - cout << "###############################" << endl; - cout << "### sloan-ordering finished ###" << endl; - cout << "###############################" << endl << endl; - return 0; - -} diff --git a/Utilities/BGL/boost/graph/example/strong-components.cpp b/Utilities/BGL/boost/graph/example/strong-components.cpp deleted file mode 100644 index 251b71668fb2f13f98202c858718161c5e8b21e2..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/strong-components.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <vector> -#include <iostream> -#include <boost/graph/strong_components.hpp> -#include <boost/graph/adjacency_list.hpp> - -int -main() -{ - using namespace boost; - typedef adjacency_list < vecS, vecS, directedS > Graph; - const int N = 6; - Graph G(N); - add_edge(0, 1, G); - add_edge(1, 1, G); - add_edge(1, 3, G); - add_edge(1, 4, G); - add_edge(3, 4, G); - add_edge(3, 0, G); - add_edge(4, 3, G); - add_edge(5, 2, G); - - std::vector<int> c(N); - int num = strong_components - (G, make_iterator_property_map(c.begin(), get(vertex_index, G), c[0])); - - std::cout << "Total number of components: " << num << std::endl; - std::vector < int >::iterator i; - for (i = c.begin(); i != c.end(); ++i) - std::cout << "Vertex " << i - c.begin() - << " is in component " << *i << std::endl; - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/strong_components.cpp b/Utilities/BGL/boost/graph/example/strong_components.cpp deleted file mode 100644 index 4b01f88624bb584a3b4e6930905fa49bb73e9770..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/strong_components.cpp +++ /dev/null @@ -1,73 +0,0 @@ -//======================================================================= -// Copyright 1997-2001 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#include <boost/config.hpp> -#include <iostream> -#include <vector> -#include <boost/graph/strong_components.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graphviz.hpp> -#include <boost/graph/graph_utility.hpp> -/* - Sample output: - A directed graph: - a --> b f h - b --> c a - c --> d b - d --> e - e --> d - f --> g - g --> f d - h --> i - i --> h j e c - j --> - - Total number of components: 4 - Vertex a is in component 3 - Vertex b is in component 3 - Vertex c is in component 3 - Vertex d is in component 0 - Vertex e is in component 0 - Vertex f is in component 1 - Vertex g is in component 1 - Vertex h is in component 3 - Vertex i is in component 3 - Vertex j is in component 2 - */ - -int main(int, char*[]) -{ - using namespace boost; - const char* name = "abcdefghij"; - - GraphvizDigraph G; - read_graphviz("scc.dot", G); - - std::cout << "A directed graph:" << std::endl; - print_graph(G, name); - std::cout << std::endl; - - typedef graph_traits<GraphvizGraph>::vertex_descriptor Vertex; - - std::vector<int> component(num_vertices(G)), discover_time(num_vertices(G)); - std::vector<default_color_type> color(num_vertices(G)); - std::vector<Vertex> root(num_vertices(G)); - int num = strong_components(G, &component[0], - root_map(&root[0]). - color_map(&color[0]). - discover_time_map(&discover_time[0])); - - std::cout << "Total number of components: " << num << std::endl; - std::vector<int>::size_type i; - for (i = 0; i != component.size(); ++i) - std::cout << "Vertex " << name[i] - <<" is in component " << component[i] << std::endl; - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/strong_components.expected b/Utilities/BGL/boost/graph/example/strong_components.expected deleted file mode 100644 index 7786f51ea596ba0288774b08c629d77e92d6c0e9..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/strong_components.expected +++ /dev/null @@ -1,23 +0,0 @@ -A directed graph: -a --> b f h -b --> c a -c --> d b -d --> e -e --> d -f --> g -g --> f d -h --> i -i --> h j e c -j --> - -Total number of components: 4 -Vertex a is in component 3 -Vertex b is in component 3 -Vertex c is in component 3 -Vertex d is in component 0 -Vertex e is in component 0 -Vertex f is in component 1 -Vertex g is in component 1 -Vertex h is in component 3 -Vertex i is in component 3 -Vertex j is in component 2 diff --git a/Utilities/BGL/boost/graph/example/subgraph.cpp b/Utilities/BGL/boost/graph/example/subgraph.cpp deleted file mode 100644 index 25db1960669842cbeceaa23a91b5389f6913a85f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/subgraph.cpp +++ /dev/null @@ -1,88 +0,0 @@ -//======================================================================= -// Copyright 2001 University of Notre Dame. -// Author: Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -/* - Sample output: - - G0: - 0 --> 1 - 1 --> 2 3 - 2 --> 5 - 3 --> - 4 --> 1 5 - 5 --> 3 - 0(0,1) 1(1,2) 2(1,3) 6(2,5) 3(4,1) 4(4,5) 5(5,3) - - G1: - 2 --> 5 - 4 --> 5 - 5 --> - 6(2,5) 4(4,5) - - G2: - 0 --> 1 - 1 --> - 0(0,1) - - */ - -#include <boost/config.hpp> -#include <iostream> -#include <boost/graph/subgraph.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graph_utility.hpp> - -int main(int,char*[]) -{ - using namespace boost; - typedef adjacency_list_traits<vecS, vecS, directedS> Traits; - typedef subgraph< adjacency_list<vecS, vecS, directedS, - property<vertex_color_t, int>, property<edge_index_t, int> > > Graph; - - const int N = 6; - Graph G0(N); - enum { A, B, C, D, E, F}; // for conveniently refering to vertices in G0 - - Graph& G1 = G0.create_subgraph(); - Graph& G2 = G0.create_subgraph(); - enum { A1, B1, C1 }; // for conveniently refering to vertices in G1 - enum { A2, B2 }; // for conveniently refering to vertices in G2 - - add_vertex(C, G1); // global vertex C becomes local A1 for G1 - add_vertex(E, G1); // global vertex E becomes local B1 for G1 - add_vertex(F, G1); // global vertex F becomes local C1 for G1 - - add_vertex(A, G2); // global vertex A becomes local A1 for G2 - add_vertex(B, G2); // global vertex B becomes local B1 for G2 - - add_edge(A, B, G0); - add_edge(B, C, G0); - add_edge(B, D, G0); - add_edge(E, B, G0); - add_edge(E, F, G0); - add_edge(F, D, G0); - - add_edge(A1, C1, G1); // (A1,C1) is subgraph G1 local indices for (C,F). - - std::cout << "G0:" << std::endl; - print_graph(G0, get(vertex_index, G0)); - print_edges2(G0, get(vertex_index, G0), get(edge_index, G0)); - std::cout << std::endl; - - Graph::children_iterator ci, ci_end; - int num = 1; - for (tie(ci, ci_end) = G0.children(); ci != ci_end; ++ci) { - std::cout << "G" << num++ << ":" << std::endl; - print_graph(*ci, get(vertex_index, *ci)); - print_edges2(*ci, get(vertex_index, *ci), get(edge_index, *ci)); - std::cout << std::endl; - } - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/subgraph.expected b/Utilities/BGL/boost/graph/example/subgraph.expected deleted file mode 100644 index a75a0ce75d1602c94b809e6350a9eda195b80575..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/subgraph.expected +++ /dev/null @@ -1,20 +0,0 @@ -G0: -0 --> 1 -1 --> 2 3 -2 --> 5 -3 --> -4 --> 1 5 -5 --> 3 -0(0,1) 1(1,2) 2(1,3) 6(2,5) 3(4,1) 4(4,5) 5(5,3) - -G1: -2 --> 5 -4 --> 5 -5 --> -6(2,5) 4(4,5) - -G2: -0 --> 1 -1 --> -0(0,1) - diff --git a/Utilities/BGL/boost/graph/example/subgraph_properties.cpp b/Utilities/BGL/boost/graph/example/subgraph_properties.cpp deleted file mode 100644 index 7de21cec9a265b9fb3421ee03c5afb2f2b3c5190..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/subgraph_properties.cpp +++ /dev/null @@ -1,109 +0,0 @@ -// (C) Copyright Jeremy Siek 2004 -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -/* - Sample output: - - After initializing properties for G1: - Global and local properties for vertex G0[C]... - G0[C]= A1 - G1[A1]= A1 - Global and local properties for vertex G0[E]... - G0[E]= B1 - G1[B1]= B1 - Global and local properties for vertex G0[F]... - G0[F]= C1 - G1[C1]= C1 - - - After initializing properties for G2: - Global and local properties for vertex G0[A] - G0[A]= A2 - G2[A2]= A2 - Global and local properties for vertex G0[C]... - G0[C]= B2 - G1[A1]= B2 - G2[B2]= B2 - - */ - -#include <boost/config.hpp> -#include <iostream> -#include <boost/graph/subgraph.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graph_utility.hpp> - -int main(int,char*[]) -{ - using namespace boost; - //typedef adjacency_list_traits<vecS, vecS, directedS> Traits;// Does nothing? - typedef property< vertex_color_t, int, - property< vertex_name_t, std::string > > VertexProperty; - - typedef subgraph< adjacency_list< vecS, vecS, directedS, - VertexProperty, property<edge_index_t, int> > > Graph; - - const int N = 6; - Graph G0(N); - enum { A, B, C, D, E, F}; // for conveniently refering to vertices in G0 - - property_map<Graph, vertex_name_t>::type name = get(vertex_name_t(), G0); - name[A] = "A"; - name[B] = "B"; - name[C] = "C"; - name[D] = "D"; - name[E] = "E"; - name[F] = "F"; - - Graph& G1 = G0.create_subgraph(); - enum { A1, B1, C1 }; // for conveniently refering to vertices in G1 - - add_vertex(C, G1); // global vertex C becomes local A1 for G1 - add_vertex(E, G1); // global vertex E becomes local B1 for G1 - add_vertex(F, G1); // global vertex F becomes local C1 for G1 - - property_map<Graph, vertex_name_t>::type name1 = get(vertex_name_t(), G1); - name1[A1] = "A1"; - - std::cout << std::endl << "After initializing properties for G1:" << std::endl; - std::cout << " Global and local properties for vertex G0[C]..." << std::endl; - std::cout << " G0[C]= " << boost::get(vertex_name, G0, C) << std::endl;// prints: "G0[C]= C" - std::cout << " G1[A1]= " << boost::get(vertex_name, G1, A1) << std::endl;// prints: "G1[A1]= A1" - - name1[B1] = "B1"; - - std::cout << " Global and local properties for vertex G0[E]..." << std::endl; - std::cout << " G0[E]= " << boost::get(vertex_name, G0, E) << std::endl;// prints: "G0[E]= E" - std::cout << " G1[B1]= " << boost::get(vertex_name, G1, B1) << std::endl;// prints: "G1[B1]= B1" - - name1[C1] = "C1"; - - std::cout << " Global and local properties for vertex G0[F]..." << std::endl; - std::cout << " G0[F]= " << boost::get(vertex_name, G0, F) << std::endl;// prints: "G0[F]= F" - std::cout << " G1[C1]= " << boost::get(vertex_name, G1, C1) << std::endl;// prints: "G1[C1]= C1" - - Graph& G2 = G0.create_subgraph(); - enum { A2, B2 }; // for conveniently refering to vertices in G2 - - add_vertex(A, G2); // global vertex A becomes local A2 for G2 - add_vertex(C, G2); // global vertex C becomes local B2 for G2 - - property_map<Graph, vertex_name_t>::type name2 = get(vertex_name_t(), G2); - name2[A2] = "A2"; - - std::cout << std::endl << std::endl << "After initializing properties for G2:" << std::endl; - std::cout << " Global and local properties for vertex G0[A]" << std::endl; - std::cout << " G0[A]= " << boost::get(vertex_name, G0, A) << std::endl;// prints: "G0[A]= A" - std::cout << " G2[A2]= " << boost::get(vertex_name, G2, A2) << std::endl;// prints: "G2[A2]= A2" - - name2[B2] = "B2"; - - std::cout << " Global and local properties for vertex G0[C]..." << std::endl; - std::cout << " G0[C]= " << boost::get(vertex_name, G0, C) << std::endl;// prints: "G0[C]= C" - std::cout << " G1[A1]= " << boost::get(vertex_name, G1, A1) << std::endl;// prints: "G1[A1]= A1" - std::cout << " G2[B2]= " << boost::get(vertex_name, G2, B2) << std::endl;// prints: "G2[B2]= B2" - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/target-compile-costs.dat b/Utilities/BGL/boost/graph/example/target-compile-costs.dat deleted file mode 100644 index cc1453577c87ce2c5a7b244c32e20c43d7cb3336..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/target-compile-costs.dat +++ /dev/null @@ -1,15 +0,0 @@ -0.0 -0.0 -0.0 -0.0 -0.0 -1.5 -0.0 -2.8 -0.0 -3.6 -0.0 -8.7 -1.1 -1.5 -2.1 diff --git a/Utilities/BGL/boost/graph/example/tc.dot b/Utilities/BGL/boost/graph/example/tc.dot deleted file mode 100644 index 39c429411d9885f5082c527efe203ea0f6ae068b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/tc.dot +++ /dev/null @@ -1,13 +0,0 @@ -digraph TC { - node[shape=circle]; - a - b - c - d - - b -> c - b -> d - c -> b - d -> c - d -> a -} diff --git a/Utilities/BGL/boost/graph/example/test-astar-cities.dot b/Utilities/BGL/boost/graph/example/test-astar-cities.dot deleted file mode 100644 index aee8107c7b2274f1710ad798351f000f0316f054..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/test-astar-cities.dot +++ /dev/null @@ -1,36 +0,0 @@ -graph G { -0[label="Troy", pos="460,193", fontsize="11"]; -1[label="Lake Placid", pos="432,338", fontsize="11"]; -2[label="Plattsburgh", pos="480,378", fontsize="11"]; -3[label="Massena", pos="352,400", fontsize="11"]; -4[label="Watertown", pos="262,309", fontsize="11"]; -5[label="Utica", pos="322,228", fontsize="11"]; -6[label="Syracuse", pos="241,222", fontsize="11"]; -7[label="Rochester", pos="111,234", fontsize="11"]; -8[label="Buffalo", pos="0,208", fontsize="11"]; -9[label="Ithaca", pos="209,166", fontsize="11"]; -10[label="Binghamton", pos="262,134", fontsize="11"]; -11[label="Woodstock", pos="422,128", fontsize="11"]; -12[label="New York", pos="437,0", fontsize="11"]; -0--5 [label="96", fontsize="11"]; -0--1 [label="134", fontsize="11"]; -0--2 [label="143", fontsize="11"]; -1--2 [label="65", fontsize="11"]; -2--3 [label="115", fontsize="11"]; -1--3 [label="133", fontsize="11"]; -3--4 [label="117", fontsize="11"]; -4--5 [label="116", fontsize="11"]; -4--6 [label="74", fontsize="11"]; -5--6 [label="56", fontsize="11"]; -6--7 [label="84", fontsize="11"]; -7--8 [label="73", fontsize="11"]; -6--9 [label="69", fontsize="11"]; -9--10 [label="70", fontsize="11"]; -9--7 [label="116", fontsize="11"]; -10--0 [label="147", fontsize="11"]; -10--11 [label="173", fontsize="11"]; -10--12 [label="183", fontsize="11"]; -6--10 [label="74", fontsize="11"]; -11--0 [label="71", fontsize="11"]; -11--12 [label="124", fontsize="11"]; -} diff --git a/Utilities/BGL/boost/graph/example/topo-sort-file-dep.cpp b/Utilities/BGL/boost/graph/example/topo-sort-file-dep.cpp deleted file mode 100644 index 21d0d3263efcd0fda819c9a9f9a63b1035093d96..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/topo-sort-file-dep.cpp +++ /dev/null @@ -1,92 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <fstream> -#include <iostream> -#include <string> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graph_utility.hpp> - -using namespace boost; - -namespace std -{ - template < typename T > - std::istream & operator >> (std::istream & in, std::pair < T, T > &p) - { - in >> p.first >> p.second; - return in; - } -} - -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; - -typedef graph_traits < file_dep_graph >::vertex_descriptor vertex_t; -typedef graph_traits < file_dep_graph >::edge_descriptor edge_t; - -void -topo_sort_dfs(const file_dep_graph & g, vertex_t u, vertex_t * &topo_order, - int *mark) -{ - mark[u] = 1; // 1 means visited, 0 means not yet visited - graph_traits < file_dep_graph >::adjacency_iterator vi, vi_end; - for (tie(vi, vi_end) = adjacent_vertices(u, g); vi != vi_end; ++vi) - if (mark[*vi] == 0) - topo_sort_dfs(g, *vi, topo_order, mark); - - *--topo_order = u; -} - -void -topo_sort(const file_dep_graph & g, vertex_t * topo_order) -{ - std::vector < int >mark(num_vertices(g), 0); - graph_traits < file_dep_graph >::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) - if (mark[*vi] == 0) - topo_sort_dfs(g, *vi, topo_order, &mark[0]); -} - - -int -main() -{ - std::ifstream file_in("makefile-dependencies.dat"); - typedef graph_traits < file_dep_graph >::vertices_size_type 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(file_in), input_end; -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ can't handle the iterator constructor - file_dep_graph g(n_vertices); - while (input_begin != input_end) { - size_type i, j; - tie(i, j) = *input_begin++; - add_edge(i, j, g); - } -#else - file_dep_graph g(input_begin, input_end, n_vertices); -#endif - - std::vector < std::string > name(num_vertices(g)); - std::ifstream name_in("makefile-target-names.dat"); - graph_traits < file_dep_graph >::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) - name_in >> name[*vi]; - - std::vector < vertex_t > order(num_vertices(g)); - topo_sort(g, &order[0] + num_vertices(g)); - for (size_type i = 0; i < num_vertices(g); ++i) - std::cout << name[order[i]] << std::endl; - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/topo-sort-file-dep2.cpp b/Utilities/BGL/boost/graph/example/topo-sort-file-dep2.cpp deleted file mode 100644 index 05024761241687cddbdf082f18fad54879cd9ca0..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/topo-sort-file-dep2.cpp +++ /dev/null @@ -1,152 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <fstream> -#include <iostream> -#include <string> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graph_utility.hpp> - -using namespace boost; - -namespace std -{ - template < typename T > - std::istream & - operator >> (std::istream & in, std::pair < T, T > &p) - { - in >> p.first >> p.second; - return - in; - } -} - -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; - -typedef graph_traits <file_dep_graph >::vertex_descriptor vertex_t; -typedef graph_traits <file_dep_graph >::edge_descriptor edge_t; - -template < typename Visitor > void -dfs_v1(const file_dep_graph & g, vertex_t u, default_color_type * color, - Visitor vis) -{ - color[u] = gray_color; - vis.discover_vertex(u, g); - graph_traits < file_dep_graph >::out_edge_iterator ei, ei_end; - for (tie(ei, ei_end) = out_edges(u, g); ei != ei_end; ++ei) { - if (color[target(*ei, g)] == white_color) { - vis.tree_edge(*ei, g); - dfs_v1(g, target(*ei, g), color, vis); - } else if (color[target(*ei, g)] == gray_color) - vis.back_edge(*ei, g); - else - vis.forward_or_cross_edge(*ei, g); - } - color[u] = black_color; - vis.finish_vertex(u, g); -} - -template < typename Visitor > void -generic_dfs_v1(const file_dep_graph & g, Visitor vis) -{ - std::vector < default_color_type > color(num_vertices(g), white_color); - graph_traits < file_dep_graph >::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { - if (color[*vi] == white_color) - dfs_v1(g, *vi, &color[0], vis); - } -} - -struct dfs_visitor_default -{ - template < typename V, typename G > void - discover_vertex(V, const G &) - { - } - - template < typename E, typename G > void - tree_edge(E, const G &) - { - } - - template < typename E, typename G > void - back_edge(E, const G &) - { - } - - template < typename E, typename G > void - forward_or_cross_edge(E, const G &) - { - } - - template < typename V, typename G > void - finish_vertex(V, const G &) - { - } -}; - -struct topo_visitor : public dfs_visitor_default -{ - topo_visitor(vertex_t * &order) : topo_order(order) - { - } - void - finish_vertex(vertex_t u, const file_dep_graph &) - { - *--topo_order = u; - } - vertex_t*& topo_order; -}; - -void -topo_sort(const file_dep_graph & g, vertex_t * topo_order) -{ - topo_visitor vis(topo_order); - generic_dfs_v1(g, vis); -} - - -int -main() -{ - std::ifstream file_in("makefile-dependencies.dat"); - typedef graph_traits<file_dep_graph>::vertices_size_type 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(file_in), input_end; - -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ can't handle the iterator constructor - file_dep_graph g(n_vertices); - while (input_begin != input_end) { - size_type i, j; - tie(i, j) = *input_begin++; - add_edge(i, j, g); - } -#else - file_dep_graph g(input_begin, input_end, n_vertices); -#endif - - std::vector < std::string > name(num_vertices(g)); - std::ifstream name_in("makefile-target-names.dat"); - graph_traits < file_dep_graph >::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) - name_in >> name[*vi]; - - std::vector < vertex_t > order(num_vertices(g)); - topo_sort(g, &order[0] + num_vertices(g)); - for (size_type i = 0; i < num_vertices(g); ++i) - std::cout << name[order[i]] << std::endl; - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/topo-sort-with-leda.cpp b/Utilities/BGL/boost/graph/example/topo-sort-with-leda.cpp deleted file mode 100644 index cd24b76e30c462b8dda3792194064b4f41c7dd9e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/topo-sort-with-leda.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <vector> -#include <string> -#include <boost/graph/topological_sort.hpp> -#include <boost/graph/leda_graph.hpp> -// Undefine macros from LEDA that conflict with the C++ Standard Library. -#undef string -#undef vector - -int -main() -{ - using namespace boost; - typedef GRAPH < std::string, char >graph_t; - graph_t leda_g; - typedef graph_traits < graph_t >::vertex_descriptor vertex_t; - std::vector < vertex_t > vert(7); - vert[0] = add_vertex(std::string("pick up kids from school"), leda_g); - vert[1] = add_vertex(std::string("buy groceries (and snacks)"), leda_g); - vert[2] = add_vertex(std::string("get cash at ATM"), leda_g); - vert[3] = - add_vertex(std::string("drop off kids at soccer practice"), leda_g); - vert[4] = add_vertex(std::string("cook dinner"), leda_g); - vert[5] = add_vertex(std::string("pick up kids from soccer"), leda_g); - vert[6] = add_vertex(std::string("eat dinner"), leda_g); - - add_edge(vert[0], vert[3], leda_g); - add_edge(vert[1], vert[3], leda_g); - add_edge(vert[1], vert[4], leda_g); - add_edge(vert[2], vert[1], leda_g); - add_edge(vert[3], vert[5], leda_g); - add_edge(vert[4], vert[6], leda_g); - add_edge(vert[5], vert[6], leda_g); - - std::vector < vertex_t > topo_order; - node_array < default_color_type > color_array(leda_g); - - topological_sort(leda_g, std::back_inserter(topo_order), - color_map(make_leda_node_property_map(color_array))); - - std::reverse(topo_order.begin(), topo_order.end()); - int n = 1; - for (std::vector < vertex_t >::iterator i = topo_order.begin(); - i != topo_order.end(); ++i, ++n) - std::cout << n << ": " << leda_g[*i] << std::endl; - - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/topo-sort-with-sgb.cpp b/Utilities/BGL/boost/graph/example/topo-sort-with-sgb.cpp deleted file mode 100644 index 9b0ea8e5d39bf231bd4cc12fc46658d037791fc3..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/topo-sort-with-sgb.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <vector> -#include <string> -#include <iostream> -#include <boost/graph/topological_sort.hpp> -#include <boost/graph/stanford_graph.hpp> - -int -main() -{ - using namespace boost; - const int n_vertices = 7; - Graph *sgb_g = gb_new_graph(n_vertices); - - const char *tasks[] = { - "pick up kids from school", - "buy groceries (and snacks)", - "get cash at ATM", - "drop off kids at soccer practice", - "cook dinner", - "pick up kids from soccer", - "eat dinner" - }; - const int n_tasks = sizeof(tasks) / sizeof(char *); - - gb_new_arc(sgb_g->vertices + 0, sgb_g->vertices + 3, 0); - gb_new_arc(sgb_g->vertices + 1, sgb_g->vertices + 3, 0); - gb_new_arc(sgb_g->vertices + 1, sgb_g->vertices + 4, 0); - gb_new_arc(sgb_g->vertices + 2, sgb_g->vertices + 1, 0); - gb_new_arc(sgb_g->vertices + 3, sgb_g->vertices + 5, 0); - gb_new_arc(sgb_g->vertices + 4, sgb_g->vertices + 6, 0); - gb_new_arc(sgb_g->vertices + 5, sgb_g->vertices + 6, 0); - - typedef graph_traits < Graph * >::vertex_descriptor vertex_t; - std::vector < vertex_t > topo_order; - topological_sort(sgb_g, std::back_inserter(topo_order), - vertex_index_map(get(vertex_index, sgb_g))); - int n = 1; - for (std::vector < vertex_t >::reverse_iterator i = topo_order.rbegin(); - i != topo_order.rend(); ++i, ++n) - std::cout << n << ": " << tasks[get(vertex_index, sgb_g)[*i]] << std::endl; - - gb_recycle(sgb_g); - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/topo-sort1.cpp b/Utilities/BGL/boost/graph/example/topo-sort1.cpp deleted file mode 100644 index 90c98a2d9992330569c76b86504ab151a1ded2bf..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/topo-sort1.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <deque> // to store the vertex ordering -#include <vector> -#include <list> -#include <iostream> -#include <boost/graph/vector_as_graph.hpp> -#include <boost/graph/topological_sort.hpp> - -int -main() -{ - using namespace boost; - const char *tasks[] = { - "pick up kids from school", - "buy groceries (and snacks)", - "get cash at ATM", - "drop off kids at soccer practice", - "cook dinner", - "pick up kids from soccer", - "eat dinner" - }; - const int n_tasks = sizeof(tasks) / sizeof(char *); - - std::vector < std::list < int > > g(n_tasks); - g[0].push_back(3); - g[1].push_back(3); - g[1].push_back(4); - g[2].push_back(1); - g[3].push_back(5); - g[4].push_back(6); - g[5].push_back(6); - - std::deque < int >topo_order; - - topological_sort(g, std::front_inserter(topo_order), - vertex_index_map(identity_property_map())); - - int n = 1; - for (std::deque < int >::iterator i = topo_order.begin(); - i != topo_order.end(); ++i, ++n) - std::cout << tasks[*i] << std::endl; - - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/topo-sort2.cpp b/Utilities/BGL/boost/graph/example/topo-sort2.cpp deleted file mode 100644 index 4663181ef2c508467e36e51d046e2dc1b8359f14..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/topo-sort2.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <vector> -#include <deque> -#include <iostream> -#include <boost/graph/topological_sort.hpp> -#include <boost/graph/adjacency_list.hpp> -int -main() -{ - using namespace boost; - const char *tasks[] = { - "pick up kids from school", - "buy groceries (and snacks)", - "get cash at ATM", - "drop off kids at soccer practice", - "cook dinner", - "pick up kids from soccer", - "eat dinner" - }; - const int n_tasks = sizeof(tasks) / sizeof(char *); - - adjacency_list < listS, vecS, directedS > g(n_tasks); - - add_edge(0, 3, g); - add_edge(1, 3, g); - add_edge(1, 4, g); - add_edge(2, 1, g); - add_edge(3, 5, g); - add_edge(4, 6, g); - add_edge(5, 6, g); - - std::deque < int >topo_order; - - topological_sort(g, std::front_inserter(topo_order), - vertex_index_map(identity_property_map())); - - int n = 1; - for (std::deque < int >::iterator i = topo_order.begin(); - i != topo_order.end(); ++i, ++n) - std::cout << tasks[*i] << std::endl; - - return EXIT_SUCCESS; -} diff --git a/Utilities/BGL/boost/graph/example/topo_sort.cpp b/Utilities/BGL/boost/graph/example/topo_sort.cpp deleted file mode 100644 index 124db6a2d69739fe31e2c56f3433378b45cf5bd6..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/topo_sort.cpp +++ /dev/null @@ -1,74 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <list> -#include <algorithm> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/topological_sort.hpp> -#include <iterator> -#include <utility> - - -typedef std::pair<std::size_t,std::size_t> Pair; - -/* - Topological sort example - - The topological sort algorithm creates a linear ordering - of the vertices such that if edge (u,v) appears in the graph, - then u comes before v in the ordering. - - Sample output: - - A topological ordering: 2 5 0 1 4 3 - -*/ - -int -main(int , char* []) -{ - //begin - using namespace boost; - - /* Topological sort will need to color the graph. Here we use an - internal decorator, so we "property" the color to the graph. - */ - typedef adjacency_list<vecS, vecS, directedS, - property<vertex_color_t, default_color_type> > Graph; - - typedef boost::graph_traits<Graph>::vertex_descriptor Vertex; - Pair edges[6] = { Pair(0,1), Pair(2,4), - Pair(2,5), - Pair(0,3), Pair(1,4), - Pair(4,3) }; -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // VC++ can't handle the iterator constructor - Graph G(6); - for (std::size_t j = 0; j < 6; ++j) - add_edge(edges[j].first, edges[j].second, G); -#else - Graph G(edges, edges + 6, 6); -#endif - - boost::property_map<Graph, vertex_index_t>::type id = get(vertex_index, G); - - typedef std::vector< Vertex > container; - container c; - topological_sort(G, std::back_inserter(c)); - - std::cout << "A topological ordering: "; - for (container::reverse_iterator ii = c.rbegin(); - ii != c.rend(); ++ii) - std::cout << id[*ii] << " "; - std::cout << std::endl; - - return 0; -} - diff --git a/Utilities/BGL/boost/graph/example/topo_sort.expected b/Utilities/BGL/boost/graph/example/topo_sort.expected deleted file mode 100644 index aeb3f41fe70fcbc6e666b64449fb612355cc00e8..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/topo_sort.expected +++ /dev/null @@ -1 +0,0 @@ -A topological ordering: 2 5 0 1 4 3 diff --git a/Utilities/BGL/boost/graph/example/transitive_closure.cpp b/Utilities/BGL/boost/graph/example/transitive_closure.cpp deleted file mode 100644 index 2b99cdb9681ce6cc799e156742d3f3d7bf8f48e1..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/transitive_closure.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Jeremy Siek 2001 -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// NOTE: this final is generated by libs/graph/doc/transitive_closure.w - -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -#error The transitive closure algorithm uses partial specialization. -#endif - -#include <boost/graph/transitive_closure.hpp> -#include <boost/graph/graphviz.hpp> -#include <boost/graph/graph_utility.hpp> - -int -main(int, char *[]) -{ - using namespace boost; - typedef property < vertex_name_t, char >Name; - typedef property < vertex_index_t, std::size_t, Name > Index; - typedef adjacency_list < listS, listS, directedS, Index > graph_t; - typedef graph_traits < graph_t >::vertex_descriptor vertex_t; - graph_t G; - std::vector < vertex_t > verts(4); - for (int i = 0; i < 4; ++i) - verts[i] = add_vertex(Index(i, Name('a' + i)), G); - add_edge(verts[1], verts[2], G); - add_edge(verts[1], verts[3], G); - add_edge(verts[2], verts[1], G); - add_edge(verts[3], verts[2], G); - add_edge(verts[3], verts[0], G); - - std::cout << "Graph G:" << std::endl; - print_graph(G, get(vertex_name, G)); - - adjacency_list <> TC; - transitive_closure(G, TC); - - std::cout << std::endl << "Graph G+:" << std::endl; - char name[] = "abcd"; - print_graph(TC, name); - std::cout << std::endl; - - std::ofstream out("tc-out.dot"); - write_graphviz(out, TC, make_label_writer(name)); - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/transpose-example.cpp b/Utilities/BGL/boost/graph/example/transpose-example.cpp deleted file mode 100644 index 0231027ffe91475c9d0f5bcd73559982f3365394..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/transpose-example.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <boost/graph/transpose_graph.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graph_utility.hpp> - -int -main() -{ - using namespace boost; - typedef int weight_t; - typedef adjacency_list < vecS, vecS, bidirectionalS, - property < vertex_name_t, char > > graph_t; - - enum { a, b, c, d, e, f, g, N }; - graph_t G(N); - property_map < graph_t, vertex_name_t >::type - name_map = get(vertex_name, G); - char name = 'a'; - graph_traits < graph_t >::vertex_iterator v, v_end; - for (tie(v, v_end) = vertices(G); v != v_end; ++v, ++name) - name_map[*v] = name; - - typedef std::pair < int, int >E; - E edge_array[] = { 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) - add_edge(edge_array[i].first, edge_array[i].second, G); - - print_graph(G, name_map); - std::cout << std::endl; - - graph_t G_T; - transpose_graph(G, G_T); - - print_graph(G_T, name_map); - - graph_traits < graph_t >::edge_iterator ei, ei_end; - for (tie(ei, ei_end) = edges(G); ei != ei_end; ++ei) - assert(edge(target(*ei, G), source(*ei, G), G_T).second == true); - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/undirected.cpp b/Utilities/BGL/boost/graph/example/undirected.cpp deleted file mode 100644 index 49a7ed7d3d46516c68de6ccbe5e9a38fb81de116..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/undirected.cpp +++ /dev/null @@ -1,109 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <boost/graph/adjacency_list.hpp> -using namespace boost; - -template < typename UndirectedGraph > void -undirected_graph_demo1() -{ - const int V = 3; - UndirectedGraph undigraph(V); - typename graph_traits < UndirectedGraph >::vertex_descriptor zero, one, two; - typename graph_traits < UndirectedGraph >::out_edge_iterator out, out_end; - typename graph_traits < UndirectedGraph >::in_edge_iterator in, in_end; - - zero = vertex(0, undigraph); - one = vertex(1, undigraph); - two = vertex(2, undigraph); - add_edge(zero, one, undigraph); - add_edge(zero, two, undigraph); - add_edge(one, two, undigraph); - - std::cout << "out_edges(0): "; - for (tie(out, out_end) = out_edges(zero, undigraph); out != out_end; ++out) - std::cout << *out; - std::cout << std::endl << "in_edges(0): "; - for (tie(in, in_end) = in_edges(zero, undigraph); in != in_end; ++in) - std::cout << *in; - std::cout << std::endl; -} - -template < typename DirectedGraph > void -directed_graph_demo() -{ - const int V = 2; - DirectedGraph digraph(V); - typename graph_traits < DirectedGraph >::vertex_descriptor u, v; - typedef typename DirectedGraph::edge_property_type Weight; - typename property_map < DirectedGraph, edge_weight_t >::type - weight = get(edge_weight, digraph); - typename graph_traits < DirectedGraph >::edge_descriptor e1, e2; - bool found; - - u = vertex(0, digraph); - v = vertex(1, digraph); - add_edge(u, v, Weight(1.2), digraph); - add_edge(v, u, Weight(2.4), digraph); - tie(e1, found) = edge(u, v, digraph); - tie(e2, found) = edge(v, u, digraph); - std::cout << "in a directed graph is "; -#ifdef __GNUC__ - // no boolalpha - std::cout << "(u,v) == (v,u) ? " << (e1 == e2) << std::endl; -#else - std::cout << "(u,v) == (v,u) ? " - << std::boolalpha << (e1 == e2) << std::endl; -#endif - std::cout << "weight[(u,v)] = " << get(weight, e1) << std::endl; - std::cout << "weight[(v,u)] = " << get(weight, e2) << std::endl; -} - -template < typename UndirectedGraph > void -undirected_graph_demo2() -{ - const int V = 2; - UndirectedGraph undigraph(V); - typename graph_traits < UndirectedGraph >::vertex_descriptor u, v; - typedef typename UndirectedGraph::edge_property_type Weight; - typename property_map < UndirectedGraph, edge_weight_t >::type - weight = get(edge_weight, undigraph); - typename graph_traits < UndirectedGraph >::edge_descriptor e1, e2; - bool found; - - u = vertex(0, undigraph); - v = vertex(1, undigraph); - add_edge(u, v, Weight(3.1), undigraph); - tie(e1, found) = edge(u, v, undigraph); - tie(e2, found) = edge(v, u, undigraph); - std::cout << "in an undirected graph is "; -#ifdef __GNUC__ - std::cout << "(u,v) == (v,u) ? " << (e1 == e2) << std::endl; -#else - std::cout << "(u,v) == (v,u) ? " - << std::boolalpha << (e1 == e2) << std::endl; -#endif - std::cout << "weight[(u,v)] = " << get(weight, e1) << std::endl; - std::cout << "weight[(v,u)] = " << get(weight, e2) << std::endl; -} - - -int -main() -{ - typedef property < edge_weight_t, double >Weight; - typedef adjacency_list < vecS, vecS, undirectedS, - no_property, Weight > UndirectedGraph; - typedef adjacency_list < vecS, vecS, directedS, - no_property, Weight > DirectedGraph; - undirected_graph_demo1 < UndirectedGraph > (); - undirected_graph_demo2 < UndirectedGraph > (); - directed_graph_demo < DirectedGraph > (); - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/undirected.expected b/Utilities/BGL/boost/graph/example/undirected.expected deleted file mode 100644 index 015a7afc9f3844d51093beccf2503483e24ed810..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/undirected.expected +++ /dev/null @@ -1,7 +0,0 @@ -in a directed graph is (u,v) == (v,u) ? 0 -weight[(u,v)] = 1.2 -weight[(v,u)] = 2.4 -in an undirected graph is (u,v) == (v,u) ? 1 -weight[(u,v)] = 3.1 -weight[(v,u)] = 3.1 -the edges incident to v: (0,1) diff --git a/Utilities/BGL/boost/graph/example/undirected_dfs.cpp b/Utilities/BGL/boost/graph/example/undirected_dfs.cpp deleted file mode 100644 index bc314d39bc5e66b5d392d28440fd0facb6342c69..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/undirected_dfs.cpp +++ /dev/null @@ -1,80 +0,0 @@ -//======================================================================= -// Copyright 2002 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#include <string> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/undirected_dfs.hpp> -#include <boost/cstdlib.hpp> -#include <iostream> - -/* - Example graph from Tarjei Knapstad. - - H15 - | - H8 C2 - \ / \ - H9-C0-C1 C3-O7-H14 - / | | - H10 C6 C4 - / \ / \ - H11 C5 H13 - | - H12 -*/ - -std::string name[] = { "C0", "C1", "C2", "C3", "C4", "C5", "C6", "O7", - "H8", "H9", "H10", "H11", "H12", "H13", "H14", "H15"}; - - -struct detect_loops : public boost::dfs_visitor<> -{ - template <class Edge, class Graph> - void back_edge(Edge e, const Graph& g) { - std::cout << name[source(e, g)] - << " -- " - << name[target(e, g)] << "\n"; - } -}; - -int main(int, char*[]) -{ - using namespace boost; - typedef adjacency_list< vecS, vecS, undirectedS, - no_property, - property<edge_color_t, default_color_type> > graph_t; - typedef graph_traits<graph_t>::vertex_descriptor vertex_t; - - const std::size_t N = sizeof(name)/sizeof(std::string); - graph_t g(N); - - add_edge(0, 1, g); - add_edge(0, 8, g); - add_edge(0, 9, g); - add_edge(0, 10, g); - add_edge(1, 2, g); - add_edge(1, 6, g); - add_edge(2, 15, g); - add_edge(2, 3, g); - add_edge(3, 7, g); - add_edge(3, 4, g); - add_edge(4, 13, g); - add_edge(4, 5, g); - add_edge(5, 12, g); - add_edge(5, 6, g); - add_edge(6, 11, g); - add_edge(7, 14, g); - - std::cout << "back edges:\n"; - detect_loops vis; - undirected_dfs(g, root_vertex(vertex_t(0)).visitor(vis) - .edge_color_map(get(edge_color, g))); - std::cout << std::endl; - - return boost::exit_success; -} diff --git a/Utilities/BGL/boost/graph/example/vector-as-graph.cpp b/Utilities/BGL/boost/graph/example/vector-as-graph.cpp deleted file mode 100644 index ccf6abeb69739f63748cba1a4eec740177952c6f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/vector-as-graph.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -#error The vector_as_graph.hpp header requires partial specialization -#endif - -#include <vector> -#include <list> -#include <iostream> // needed by graph_utility. -Jeremy -#include <boost/graph/vector_as_graph.hpp> -#include <boost/graph/graph_utility.hpp> - -int -main() -{ - enum - { r, s, t, u, v, w, x, y, N }; - char name[] = "rstuvwxy"; - typedef std::vector < std::list < int > > Graph; - Graph g(N); - g[r].push_back(v); - g[s].push_back(r); - g[s].push_back(r); - g[s].push_back(w); - g[t].push_back(x); - g[u].push_back(t); - g[w].push_back(t); - g[w].push_back(x); - g[x].push_back(y); - g[y].push_back(u); - boost::print_graph(g, name); - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/vector_as_graph.expected b/Utilities/BGL/boost/graph/example/vector_as_graph.expected deleted file mode 100644 index 1f72879473a986ce0f0741cf4a8314a446943358..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/vector_as_graph.expected +++ /dev/null @@ -1,2 +0,0 @@ -order of discovery: s r w v t x y u -order of finish: s r w v t x y u diff --git a/Utilities/BGL/boost/graph/example/vertex-name-property.cpp b/Utilities/BGL/boost/graph/example/vertex-name-property.cpp deleted file mode 100644 index c1216f04668bab02d262dffbd8bf89091e963a83..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/vertex-name-property.cpp +++ /dev/null @@ -1,80 +0,0 @@ -//======================================================================= -// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -#include <boost/config.hpp> -#include <iostream> -#include <fstream> -#include <string> -#include <boost/graph/adjacency_list.hpp> - -using namespace boost; - -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; - size_type n_vertices; - typename graph_traits < Graph >::vertex_descriptor u; - typename property_traits < VertexNamePropertyMap >::value_type name; - - graph_in >> n_vertices; // read in number of vertices - for (size_type i = 0; i < n_vertices; ++i) { // Add n vertices to the graph - u = add_vertex(g); - name_in >> name; - put(name_map, u, name); // ** Attach name property to vertex u ** - } - size_type src, targ; - while (graph_in >> src) // Read in edges - if (graph_in >> targ) - add_edge(src, targ, g); // add an edge to the graph - else - break; -} - - -int -main() -{ - typedef 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 = "makefile-dependencies.dat"; - const char* target_file_name = "makefile-target-names.dat"; - std::ifstream file_in(dep_file_name), name_in(target_file_name); - if (!file_in) { - std::cerr << "** Error: could not open file " << dep_file_name - << std::endl; - return -1; - } - if (!name_in) { - std::cerr << "** Error: could not open file " << target_file_name - << std::endl; - return -1; - } - - // Obtain internal property map from the graph - property_map < graph_type, vertex_name_t >::type name_map = - get(vertex_name, g); - read_graph_file(file_in, name_in, g, name_map); - - // 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; - // Create last modified time property map - iter_map_t mod_time_map(last_mod_vec.begin(), get(vertex_index, g)); - - assert(num_vertices(g) == 15); - assert(num_edges(g) == 19); - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/vertex_basics.cpp b/Utilities/BGL/boost/graph/example/vertex_basics.cpp deleted file mode 100644 index 8d2053fbc9000880acc8445de3e94e80f3749da2..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/vertex_basics.cpp +++ /dev/null @@ -1,159 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= - -#include <boost/config.hpp> -#include <iostream> -#include <algorithm> -#include <boost/graph/adjacency_list.hpp> - -using namespace std; -using namespace boost; - - -/* - Vertex Basics - - This example demonstrates the GGCL Vertex interface. - - Sample output: - - vertices(g) = 0 1 2 3 4 - vertex id: 0 - out-edges: (0,1) (0,2) (0,3) (0,4) - in-edges: (2,0) (3,0) (4,0) - adjacent vertices: 1 2 3 4 - - vertex id: 1 - out-edges: - in-edges: (0,1) (3,1) (4,1) - adjacent vertices: - - vertex id: 2 - out-edges: (2,0) (2,4) - in-edges: (0,2) - adjacent vertices: 0 4 - - vertex id: 3 - out-edges: (3,0) (3,1) (3,4) - in-edges: (0,3) - adjacent vertices: 0 1 4 - - vertex id: 4 - out-edges: (4,0) (4,1) - in-edges: (0,4) (2,4) (3,4) - adjacent vertices: 0 1 - - - */ - - -/* some helper functors for output */ - -template <class Graph> -struct print_edge { - print_edge(Graph& g) : G(g) { } - - typedef typename boost::graph_traits<Graph>::edge_descriptor Edge; - typedef typename boost::graph_traits<Graph>::vertex_descriptor Vertex; - void operator()(Edge e) const - { - typename boost::property_map<Graph, vertex_index_t>::type - id = get(vertex_index, G); - - Vertex src = source(e, G); - Vertex targ = target(e, G); - - cout << "(" << id[src] << "," << id[targ] << ") "; - } - - Graph& G; -}; - -template <class Graph> -struct print_index { - print_index(Graph& g) : G(g){ } - - typedef typename boost::graph_traits<Graph>::vertex_descriptor Vertex; - void operator()(Vertex c) const - { - typename boost::property_map<Graph,vertex_index_t>::type - id = get(vertex_index, G); - cout << id[c] << " "; - } - - Graph& G; -}; - - -template <class Graph> -struct exercise_vertex { - typedef typename boost::graph_traits<Graph>::vertex_descriptor Vertex; - - exercise_vertex(Graph& _g) : g(_g) { } - - void operator()(Vertex v) const - { - typename boost::property_map<Graph, vertex_index_t>::type - id = get(vertex_index, g); - - cout << "vertex id: " << id[v] << endl; - - cout << "out-edges: "; - for_each(out_edges(v, g).first, out_edges(v,g).second, - print_edge<Graph>(g)); - - cout << endl; - - cout << "in-edges: "; - for_each(in_edges(v, g).first, in_edges(v,g).second, - print_edge<Graph>(g)); - - cout << endl; - - cout << "adjacent vertices: "; - for_each(adjacent_vertices(v,g).first, - adjacent_vertices(v,g).second, print_index<Graph>(g)); - cout << endl << endl; - } - - Graph& g; -}; - - -int -main() -{ - typedef adjacency_list<vecS,vecS,bidirectionalS> MyGraphType; - - typedef pair<int,int> Pair; - 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) }; - - /* Construct a graph using the edge_array*/ - MyGraphType g(5); - for (int i=0; i<11; ++i) - add_edge(edge_array[i].first, edge_array[i].second, g); - - boost::property_map<MyGraphType, vertex_index_t>::type - id = get(vertex_index, g); - - cout << "vertices(g) = "; - boost::graph_traits<MyGraphType>::vertex_iterator vi; - for (vi = vertices(g).first; vi != vertices(g).second; ++vi) - std::cout << id[*vi] << " "; - std::cout << std::endl; - - /* Use the STL for_each algorithm to "exercise" all - of the vertices in the graph */ - for_each(vertices(g).first, vertices(g).second, - exercise_vertex<MyGraphType>(g)); - - return 0; -} diff --git a/Utilities/BGL/boost/graph/example/vertex_basics.expected b/Utilities/BGL/boost/graph/example/vertex_basics.expected deleted file mode 100644 index 96a103d961fdb49c7899dfe420e49bdfedb7e121..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/vertex_basics.expected +++ /dev/null @@ -1,26 +0,0 @@ -vertices(g) = 0 1 2 3 4 -vertex id: 0 -out-edges: (0,1) (0,2) (0,3) (0,4) -in-edges: (2,0) (3,0) (4,0) -adjacent vertices: 1 2 3 4 - -vertex id: 1 -out-edges: -in-edges: (0,1) (3,1) (4,1) -adjacent vertices: - -vertex id: 2 -out-edges: (2,0) (2,4) -in-edges: (0,2) -adjacent vertices: 0 4 - -vertex id: 3 -out-edges: (3,0) (3,1) (3,4) -in-edges: (0,3) -adjacent vertices: 0 1 4 - -vertex id: 4 -out-edges: (4,0) (4,1) -in-edges: (0,4) (2,4) (3,4) -adjacent vertices: 0 1 - diff --git a/Utilities/BGL/boost/graph/example/visitor.cpp b/Utilities/BGL/boost/graph/example/visitor.cpp deleted file mode 100644 index 700932d844dbb51d24fa6ba7b07fb620562d9bff..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/visitor.cpp +++ /dev/null @@ -1,108 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -// -// Sample output -// -// DFS categorized directed graph -// tree: 0 --> 2 -// tree: 2 --> 1 -// back: 1 --> 1 -// tree: 1 --> 3 -// back: 3 --> 1 -// tree: 3 --> 4 -// back: 4 --> 0 -// back: 4 --> 1 -// forward or cross: 2 --> 3 - -// BFS categorized directed graph -// tree: 0 --> 2 -// tree: 2 --> 1 -// tree: 2 --> 3 -// cycle: 1 --> 1 -// cycle: 1 --> 3 -// cycle: 3 --> 1 -// tree: 3 --> 4 -// cycle: 4 --> 0 -// cycle: 4 --> 1 - -#include <boost/config.hpp> -#include <iostream> -#include <vector> -#include <algorithm> -#include <utility> -#include <string> - -#include <boost/graph/visitors.hpp> -#include <boost/graph/graph_utility.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/breadth_first_search.hpp> -#include <boost/graph/depth_first_search.hpp> - -using namespace boost; -using namespace std; - -template <class Tag> -struct edge_printer : public base_visitor<edge_printer<Tag> > { - typedef Tag event_filter; - edge_printer(std::string edge_t) : m_edge_type(edge_t) { } - template <class Edge, class Graph> - void operator()(Edge e, Graph& G) { - std::cout << m_edge_type << ": " << source(e, G) - << " --> " << target(e, G) << std::endl; - } - std::string m_edge_type; -}; -template <class Tag> -edge_printer<Tag> print_edge(std::string type, Tag) { - return edge_printer<Tag>(type); -} - -int -main(int, char*[]) -{ - - using namespace boost; - - typedef adjacency_list<> Graph; - typedef std::pair<int,int> E; - E edges[] = { 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 - Graph G(5); - for (std::size_t j = 0; j < sizeof(edges)/sizeof(E); ++j) - add_edge(edges[j].first, edges[j].second, G); -#else - Graph G(edges, edges + sizeof(edges)/sizeof(E), 5); -#endif - - typedef boost::graph_traits<Graph>::vertex_descriptor Vertex; - typedef boost::graph_traits<Graph>::vertices_size_type size_type; - - std::vector<size_type> d(num_vertices(G)); - std::vector<size_type> f(num_vertices(G)); - - cout << "DFS categorized directed graph" << endl; - depth_first_search(G, visitor(make_dfs_visitor( - make_list(print_edge("tree", on_tree_edge()), - print_edge("back", on_back_edge()), - print_edge("forward or cross", on_forward_or_cross_edge()) - )))); - - cout << endl << "BFS categorized directed graph" << endl; - boost::breadth_first_search - (G, vertex(0, G), visitor(make_bfs_visitor( - std::make_pair(print_edge("tree", on_tree_edge()), - print_edge("cycle", on_non_tree_edge()))))); - - return 0; -} - diff --git a/Utilities/BGL/boost/graph/example/visitor.expected b/Utilities/BGL/boost/graph/example/visitor.expected deleted file mode 100644 index 18bad31fcecb81942f79df35a0fc2cffd6a77efc..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/example/visitor.expected +++ /dev/null @@ -1,21 +0,0 @@ -DFS categorized directed graph -tree: 0 --> 2 -tree: 2 --> 1 -back: 1 --> 1 -tree: 1 --> 3 -back: 3 --> 1 -tree: 3 --> 4 -back: 4 --> 0 -back: 4 --> 1 -forward or cross: 2 --> 3 - -BFS categorized directed graph -tree: 0 --> 2 -tree: 2 --> 1 -tree: 2 --> 3 -cycle: 1 --> 1 -cycle: 1 --> 3 -cycle: 3 --> 1 -tree: 3 --> 4 -cycle: 4 --> 0 -cycle: 4 --> 1