Compare commits

..

43 Commits

Author SHA1 Message Date
Arnaud Becheler dbca3f1a1e Merge pull request #531 from Becheler/refactor/drop-tti-dependency
refactor: remove dependency on boost.tti using detector idiom
2026-07-20 13:24:40 +02:00
Arnaud Becheler ec7d9ac07c Merge pull request #527 from Becheler/refactor/mpl-to-mp11
refactor: removing many dependencies to Boost.MPL
2026-07-20 11:51:09 +02:00
Arnaud Becheler 80ed2d2602 Merge branch 'develop' into refactor/mpl-to-mp11 2026-07-20 11:02:31 +02:00
Arnaud Becheler 3c4d3d2b4f fix: resolve conflict with develop 2026-07-20 11:02:03 +02:00
Arnaud Becheler 81d5c1ae11 Merge pull request #529 from Becheler/refactor/graphml-remove-mpl-dependency
fix: phase from mpl to mp11 facilities in graphml
2026-07-20 10:07:50 +02:00
Arnaud Becheler 330ded10af convert internal MPL metafunctions to std <type_traits> 2026-07-20 09:12:13 +02:00
Arnaud Becheler a6359db8a8 remove dead Boost.MPL includes 2026-07-20 09:05:59 +02:00
Arnaud Becheler 8617207304 refactor: import MP11 instead of handrolling 2026-07-20 08:53:02 +02:00
Arnaud Becheler 59d477dd6a fix: handroll mpl facilities 2026-07-20 08:48:35 +02:00
Arnaud Becheler a46bb0c58e Merge pull request #532 from Becheler/refactor/drop-math-dependency
refactor: remove dependency to boost.math
2026-07-20 08:44:28 +02:00
Arnaud Becheler c7369835e4 Merge pull request #530 from Becheler/refactor/mpl-public-traits-to-std
Migrate public traits from MPL to STL (breaking change)
2026-07-20 08:43:40 +02:00
Arnaud Becheler 5a18325250 refactor: remove dependency to boost.math 2026-07-17 11:15:30 +02:00
Arnaud Becheler b3cb64738b refactor: remove dependency on boost.tti using detector idiom 2026-07-17 10:58:26 +02:00
Arnaud Becheler c9ce31788e fix: from mpl::true to std::true_type in overload sets 2026-07-17 10:23:46 +02:00
Arnaud Becheler 18c34a9313 fix: refactor public traits from mpl to std 2026-07-16 18:42:50 +02:00
Arnaud Becheler 3b2cc9c8e5 Merge pull request #526 from Becheler/fix/dependency-reduction
fix: remove 6 stale or deprecated dependencies
2026-07-16 15:43:30 +02:00
Arnaud Becheler 1576c02a14 Merge pull request #528 from Becheler/refactor/graph-traits-void-t-detector
fix: remove dependency to MPL in graph_traits using detector idiom
2026-07-16 15:42:04 +02:00
Arnaud Becheler 479ee6f1df fix: remove dependency to MPL using detector idiom 2026-07-16 13:30:44 +02:00
Arnaud Becheler 369326a022 fix: remove dependencies from CMakeLists.txt 2026-07-15 18:18:01 +02:00
Arnaud Becheler 0ebbb93033 fix: remove stale dependency on numeric_conversion 2026-07-15 11:54:11 +02:00
Arnaud Becheler 3fc6574636 fix: remove dependency to boost foreach 2026-07-15 11:34:28 +02:00
Arnaud Becheler 97f2ee3d7e fix: remove dependency to boost move 2026-07-15 10:47:45 +02:00
Arnaud Becheler 4c1dad02c0 fix: remove stale boost typeof entry 2026-07-15 09:54:39 +02:00
Arnaud Becheler 28ecc8a99a fix: remove stale boost bind entry 2026-07-15 09:46:42 +02:00
Arnaud Becheler 3e59c37e97 Merge pull request #525 from Becheler/fix/subgraph-124-ci
fix: undefined behavior when transforming non-existing edges in a subgraph
2026-07-15 09:26:57 +02:00
Arnaud Becheler a4ee119825 fix: remove dep to boost.conversion as implicit_cast was redundant 2026-07-15 09:25:24 +02:00
Arnaud Becheler 7db1f2e420 doc: fix to describe the precise behavior 2026-07-14 16:45:05 +02:00
Arnaud Becheler 297a322e8a fix: tests now illustrate the query versus transform idioms 2026-07-14 15:45:35 +02:00
Arnaud Becheler f611587c14 fix: global_to_local asserts on edges not in the subgraph, mirroring the vertex overload 2026-07-14 15:16:50 +02:00
Arnaud Becheler 58a726f6cf bug: global_to_local on an edge absent from subgraph dereferences a missing map entry 2026-07-14 14:43:09 +02:00
Arnaud Becheler 2f65c696a8 test: locking behaviour against regressions 2026-07-14 14:18:30 +02:00
Arnaud Becheler b648c6ea14 Merge pull request #521 from Becheler/doc/imitate-unordered-bundle
doc: opt out of aggregated boostlook to solve toc issues
2026-07-14 13:34:53 +02:00
Arnaud Becheler e55c4f250d Merge pull request #523 from Becheler/ci/dependency-count-bot
infra: add a boostdeps counting bot
2026-07-14 13:06:47 +02:00
Jeremy W. Murphy 5a4d1696c9 Merge pull request #522 from Becheler/ci/pin-macos-clang
fix: pin macos version
2026-07-14 08:08:49 +09:00
Arnaud Becheler 848786f2ef fix: minor fix tested against real logs 2026-07-09 13:55:50 +02:00
Arnaud Becheler abf032dabb fix: boostdep needs boost headers and compiled filesystem 2026-07-09 13:39:09 +02:00
Arnaud Becheler 078f965b9e infra: add a boostdeps counting bot 2026-07-09 13:26:16 +02:00
Arnaud Becheler 82e569c18a fix: pin macos version 2026-07-09 12:05:52 +02:00
Arnaud Becheler 8286c075b3 doc: opt out of aggregated boostlook to solve toc issues 2026-07-09 10:35:42 +02:00
Jeremy W. Murphy 50e90d2d64 Revert "Merge pull request #392 from jeremy-murphy/CMake"
This reverts commit 35e20c255f, reversing
changes made to dde65fefc7.
2026-07-03 11:39:49 +09:00
Jeremy W. Murphy 35e20c255f Merge pull request #392 from jeremy-murphy/CMake
Split CMake identities: superproject and developer
2026-07-02 18:01:11 +09:00
Arnaud Becheler dde65fefc7 Merge pull request #519 from Becheler/doc/imitate-unordered-bundle
doc: imitate unordered bundle to recover tocs
2026-07-01 10:34:53 +02:00
Arnaud Becheler e61f290d46 doc: imitate unordered bundle to recover tocs 2026-07-01 09:56:36 +02:00
56 changed files with 865 additions and 881 deletions
+131
View File
@@ -0,0 +1,131 @@
#!/usr/bin/env python3
"""Print a markdown table of Boost dependency changes between two CI log archives.
Usage: dep_table.py BASELINE.zip AFTER.zip
Each archive is a GitHub Actions run-log zip. The `deps` job of the
dependency-report workflow prints two marker-delimited boostdep reports into
its log:
===DEP-BRIEF-START=== boostdep --brief graph ===DEP-BRIEF-END===
===DEP-PRIMARY-START=== boostdep graph (primary) ===DEP-PRIMARY-END===
From those it derives two metrics and prints their delta vs the baseline:
- the set of transitive Boost modules graph depends on (from --brief:
Primary + Secondary sections = the full transitive closure), and
- the header-inclusion weight of each direct dependency (from the primary
report: how many distinct boost/graph files pull that dependency in).
Weights are the live signal, they drop toward zero as coupling is removed;
the module count is the coarse target that only moves when a dep hits zero.
"""
import re
import sys
import zipfile
BRIEF = ("===DEP-BRIEF-START===", "===DEP-BRIEF-END===")
PRIMARY = ("===DEP-PRIMARY-START===", "===DEP-PRIMARY-END===")
# Module names as boostdep prints them, e.g. "numeric~conversion".
MODULE = re.compile(r"[A-Za-z0-9_.~-]+")
TIMESTAMP = re.compile(r"^\d{4}-\d\d-\d\dT[\d:.]+Z\s?") # GitHub log line prefix
ANSI = re.compile(r"\x1b\[[0-9;]*m")
def read_clean_lines(zip_path):
"""Top-level per-job logs, with GitHub timestamp and ANSI prefixes stripped."""
lines = []
with zipfile.ZipFile(zip_path) as z:
for entry in z.namelist():
if "/" in entry or not entry.endswith(".txt"):
continue
for ln in z.read(entry).decode("utf-8", "replace").splitlines():
lines.append(TIMESTAMP.sub("", ANSI.sub("", ln)))
return lines
def block(lines, markers):
"""Lines strictly between the marker lines, matched exactly.
Exact matching is what skips the echoed `echo "<marker>"` command lines
GitHub prepends to a run step, so we capture boostdep's real stdout.
"""
start, end = markers
out, capturing = [], False
for ln in lines:
s = ln.strip()
if s == start:
capturing = True
continue
if s == end and capturing:
break
if capturing:
out.append(ln)
return out
def parse_brief(lines):
"""--brief output -> set of module names (one bare name per line)."""
mods = set()
for ln in lines:
s = ln.strip()
if not s or s.startswith("#") or s.lower().startswith("brief dependency"):
continue
if MODULE.fullmatch(s):
mods.add(s)
return mods
def parse_weights(lines):
"""Primary report -> {dependency: number of distinct graph files that pull it in}."""
weights, cur = {}, None
for ln in lines:
head = re.match(r"^([A-Za-z0-9_.~-]+):\s*$", ln) # "module:" at column 0
if head:
cur = head.group(1)
weights.setdefault(cur, set())
continue
frm = re.match(r"^\s+from\s+(.+?)\s*$", ln)
if frm and cur is not None:
weights[cur].add(frm.group(1))
return {k: len(v) for k, v in weights.items()}
def main(base_zip, pr_zip):
bl, pl = read_clean_lines(base_zip), read_clean_lines(pr_zip)
base_mods = parse_brief(block(bl, BRIEF))
pr_mods = parse_brief(block(pl, BRIEF))
base_w = parse_weights(block(bl, PRIMARY))
pr_w = parse_weights(block(pl, PRIMARY))
# Header-inclusion weights: the live signal. Only rows that changed, most-reduced first.
print("**Header-inclusion weights** (graph files pulling each direct dependency in):")
print()
changed = []
for dep in base_w.keys() | pr_w.keys():
b, p = base_w.get(dep, 0), pr_w.get(dep, 0)
if b != p:
changed.append((p - b, dep, b, p))
if changed:
print("| Dependency | develop | PR | Δ |")
print("|-----|--------:|---:|----:|")
for d, dep, b, p in sorted(changed): # reductions (negative delta) first
print(f"| {dep} | {b} | {p} | {d:+d} |")
else:
print("_No header-inclusion-weight changes._")
print()
# Transitive module set: the coarse target.
added = sorted(pr_mods - base_mods)
removed = sorted(base_mods - pr_mods)
nb, np_ = len(base_mods), len(pr_mods)
diff = np_ - nb
print(f"**Transitive Boost modules:** {nb}{np_} ({f'{diff:+d}' if diff else '0'})")
if added:
print(f"- added: {', '.join(added)}")
if removed:
print(f"- removed: {', '.join(removed)}")
if __name__ == "__main__":
if len(sys.argv) != 3:
sys.exit("usage: dep_table.py BASELINE.zip AFTER.zip")
main(sys.argv[1], sys.argv[2])
+3 -1
View File
@@ -56,7 +56,7 @@ jobs:
run: ../../../b2 toolset=$TOOLSET cxxstd=${{ matrix.cxxstd }}
working-directory: ../boost-root/libs/graph/test
macos:
runs-on: macos-latest
runs-on: macos-15
strategy:
fail-fast: false
matrix:
@@ -71,6 +71,8 @@ jobs:
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[linux];[Linux];[LINUX]'
commit-filter-separator: ';'
fail-fast: true
- name: Print pinned AppleClang version
run: clang++ --version
- name: Checkout main boost
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
- name: Update tools/boostdep
@@ -0,0 +1,61 @@
name: dependency-count-comment
on:
workflow_run:
workflows: ["dependency-report"]
types: [completed]
permissions:
actions: read
pull-requests: write
contents: read
jobs:
comment:
if: github.event.workflow_run.event == 'pull_request'
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
PR_RUN: ${{ github.event.workflow_run.id }}
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
steps:
- uses: actions/checkout@v4
- name: Download this PR run's log archive
run: gh api "repos/$REPO/actions/runs/$PR_RUN/logs" > pr-logs.zip
- name: Download latest successful develop run's log archive
run: |
DEV=$(gh run list --workflow dependency-report --branch develop --status success \
--limit 1 --json databaseId --jq '.[0].databaseId')
if [ -z "$DEV" ]; then echo "no develop baseline run found" >&2; exit 1; fi
echo "DEV_RUN=$DEV" >> "$GITHUB_ENV"
gh api "repos/$REPO/actions/runs/$DEV/logs" > base-logs.zip
- name: Generate table
run: |
{
echo "Boost dependency footprint vs \`develop\` (auto-generated)."
echo "PR run \`$PR_RUN\` vs develop run \`$DEV_RUN\` (\`${HEAD_SHA:0:10}\`)."
echo
python3 .github/scripts/dep_table.py base-logs.zip pr-logs.zip
} > table.md
- name: Resolve PR number
id: pr
run: |
num=$(gh api "repos/$REPO/pulls?state=open&per_page=100" \
--jq "map(select(.head.sha==\"$HEAD_SHA\"))[0].number")
if [ -z "$num" ]; then
echo "no open PR found with head $HEAD_SHA" >&2
exit 1
fi
echo "num=$num" >> "$GITHUB_OUTPUT"
- name: Post or update sticky comment
uses: marocchino/sticky-pull-request-comment@v2
with:
header: dependency-counts
number: ${{ steps.pr.outputs.num }}
path: table.md
+42
View File
@@ -0,0 +1,42 @@
name: dependency-report
# Computes graph's Boost dependency footprint with boostdep and prints a
# marker-delimited report into the job log, on every push and PR. The
# dependency-count-comment workflow reads these logs (this PR's run and the
# latest develop run) and posts the diff as a PR comment. Kept separate from
# CI so ci.yml is untouched.
on: [ push, pull_request ]
jobs:
deps:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up Boost tree and build boostdep
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
cp -r $GITHUB_WORKSPACE/* libs/graph
git submodule update --init tools/boostdep
# depinst pulls graph's deps; also ensure boostdep's own dep
# (Boost.Filesystem) is present since boostdep links against it.
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" graph
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" filesystem
./bootstrap.sh
./b2 headers
# boostdep #includes <boost/filesystem.hpp> and links the compiled
# library, so build it with b2 (a bare c++ compile can't resolve that).
./b2 tools/boostdep/build
- name: Boostdep dependency report
working-directory: ../boost-root
run: |
BOOSTDEP=$(find "$PWD" -type f -name boostdep -perm -u+x 2>/dev/null | grep -v '/src/' | head -1)
if [ -z "$BOOSTDEP" ]; then echo "boostdep executable not found after build" >&2; exit 1; fi
echo "using boostdep: $BOOSTDEP"
echo "===DEP-BRIEF-START==="
"$BOOSTDEP" --boost-root . --track-sources --no-track-tests --brief graph
echo "===DEP-BRIEF-END==="
echo "===DEP-PRIMARY-START==="
"$BOOSTDEP" --boost-root . --track-sources --no-track-tests graph
echo "===DEP-PRIMARY-END==="
+3 -182
View File
@@ -2,9 +2,6 @@
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
# When we're part of the Boost super project.
cmake_minimum_required(VERSION 3.8...3.16)
project(boost_graph VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
@@ -14,6 +11,8 @@ add_library(boost_graph
src/read_graphviz_new.cpp
)
add_library(Boost::graph ALIAS boost_graph)
target_include_directories(boost_graph PUBLIC include)
target_link_libraries(boost_graph
@@ -26,16 +25,13 @@ target_link_libraries(boost_graph
Boost::concept_check
Boost::config
Boost::container_hash
Boost::conversion
Boost::core
Boost::detail
Boost::foreach
Boost::function
Boost::integer
Boost::iterator
Boost::lexical_cast
Boost::math
Boost::move
Boost::mp11
Boost::mpl
Boost::multi_index
Boost::multiprecision
@@ -50,10 +46,8 @@ target_link_libraries(boost_graph
Boost::smart_ptr
Boost::spirit
Boost::throw_exception
Boost::tti
Boost::tuple
Boost::type_traits
Boost::typeof
Boost::unordered
Boost::utility
Boost::xpressive
@@ -67,179 +61,6 @@ target_compile_definitions(boost_graph
# PRIVATE BOOST_GRAPH_SOURCE
)
else()
# When we're worked on by Boost.Graph developers.
# Using 3.29 for now until I figure out the differences with the new Boost
# config cmake introduced in 3.30.
cmake_minimum_required(VERSION 3.29)
project(boost_graph VERSION 1.0.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 14)
# TODO: The super-project version is set explicitly just like this, but we
# should parse it from boost/version.hpp.
find_package(Boost 1.90.0 REQUIRED COMPONENTS regex)
add_library(boost_graph)
target_sources(boost_graph PUBLIC
FILE_SET HEADERS
BASE_DIRS "include"
FILES
include/boost/graph/adj_list_serialize.hpp
include/boost/graph/adjacency_iterator.hpp
include/boost/graph/adjacency_list.hpp
include/boost/graph/adjacency_list_io.hpp
include/boost/graph/adjacency_matrix.hpp
include/boost/graph/astar_search.hpp
include/boost/graph/bandwidth.hpp
include/boost/graph/bc_clustering.hpp
include/boost/graph/bellman_ford_shortest_paths.hpp
include/boost/graph/betweenness_centrality.hpp
include/boost/graph/biconnected_components.hpp
include/boost/graph/bipartite.hpp
include/boost/graph/boyer_myrvold_planar_test.hpp
include/boost/graph/boykov_kolmogorov_max_flow.hpp
include/boost/graph/breadth_first_search.hpp
include/boost/graph/bron_kerbosch_all_cliques.hpp
include/boost/graph/buffer_concepts.hpp
include/boost/graph/chrobak_payne_drawing.hpp
include/boost/graph/circle_layout.hpp
include/boost/graph/closeness_centrality.hpp
include/boost/graph/clustering_coefficient.hpp
include/boost/graph/compressed_sparse_row_graph.hpp
include/boost/graph/connected_components.hpp
include/boost/graph/copy.hpp
include/boost/graph/core_numbers.hpp
include/boost/graph/create_condensation_graph.hpp
include/boost/graph/cuthill_mckee_ordering.hpp
include/boost/graph/cycle_canceling.hpp
include/boost/graph/dag_shortest_paths.hpp
include/boost/graph/degree_centrality.hpp
include/boost/graph/depth_first_search.hpp
include/boost/graph/dijkstra_shortest_paths.hpp
include/boost/graph/dijkstra_shortest_paths_no_color_map.hpp
include/boost/graph/dimacs.hpp
include/boost/graph/directed_graph.hpp
include/boost/graph/dll_import_export.hpp
include/boost/graph/dominator_tree.hpp
include/boost/graph/eccentricity.hpp
include/boost/graph/edge_coloring.hpp
include/boost/graph/edge_connectivity.hpp
include/boost/graph/edge_list.hpp
include/boost/graph/edmonds_karp_max_flow.hpp
include/boost/graph/edmunds_karp_max_flow.hpp
include/boost/graph/erdos_renyi_generator.hpp
include/boost/graph/exception.hpp
include/boost/graph/exterior_property.hpp
include/boost/graph/filtered_graph.hpp
include/boost/graph/find_flow_cost.hpp
include/boost/graph/floyd_warshall_shortest.hpp
include/boost/graph/fruchterman_reingold.hpp
include/boost/graph/geodesic_distance.hpp
include/boost/graph/graph_archetypes.hpp
include/boost/graph/graph_as_tree.hpp
include/boost/graph/graph_concepts.hpp
include/boost/graph/graph_mutability_traits.hpp
include/boost/graph/graph_selectors.hpp
include/boost/graph/graph_stats.hpp
include/boost/graph/graph_traits.hpp
include/boost/graph/graph_utility.hpp
include/boost/graph/graphml.hpp
include/boost/graph/graphviz.hpp
include/boost/graph/grid_graph.hpp
include/boost/graph/gursoy_atun_layout.hpp
include/boost/graph/hawick_circuits.hpp
include/boost/graph/howard_cycle_ratio.hpp
include/boost/graph/incremental_components.hpp
include/boost/graph/is_kuratowski_subgraph.hpp
include/boost/graph/is_straight_line_drawing.hpp
include/boost/graph/isomorphism.hpp
include/boost/graph/iteration_macros.hpp
include/boost/graph/iteration_macros_undef.hpp
include/boost/graph/johnson_all_pairs_shortest.hpp
include/boost/graph/kamada_kawai_spring_layout.hpp
include/boost/graph/king_ordering.hpp
include/boost/graph/kruskal_min_spanning_tree.hpp
include/boost/graph/labeled_graph.hpp
include/boost/graph/leda_graph.hpp
include/boost/graph/lookup_edge.hpp
include/boost/graph/loop_erased_random_walk.hpp
include/boost/graph/make_biconnected_planar.hpp
include/boost/graph/make_connected.hpp
include/boost/graph/make_maximal_planar.hpp
include/boost/graph/matrix_as_graph.hpp
include/boost/graph/max_cardinality_matching.hpp
include/boost/graph/maximum_adjacency_search.hpp
include/boost/graph/maximum_weighted_matching.hpp
include/boost/graph/mcgregor_common_subgraphs.hpp
include/boost/graph/mesh_graph_generator.hpp
include/boost/graph/metis.hpp
include/boost/graph/metric_tsp_approx.hpp
include/boost/graph/minimum_degree_ordering.hpp
include/boost/graph/named_function_params.hpp
include/boost/graph/named_graph.hpp
include/boost/graph/neighbor_bfs.hpp
include/boost/graph/numeric_values.hpp
include/boost/graph/one_bit_color_map.hpp
include/boost/graph/overloading.hpp
include/boost/graph/page_rank.hpp
include/boost/graph/planar_canonical_ordering.hpp
include/boost/graph/planar_face_traversal.hpp
include/boost/graph/plod_generator.hpp
include/boost/graph/point_traits.hpp
include/boost/graph/prim_minimum_spanning_tree.hpp
include/boost/graph/profile.hpp
include/boost/graph/properties.hpp
include/boost/graph/property_iter_range.hpp
include/boost/graph/push_relabel_max_flow.hpp
include/boost/graph/r_c_shortest_paths.hpp
include/boost/graph/random.hpp
include/boost/graph/random_layout.hpp
include/boost/graph/random_spanning_tree.hpp
include/boost/graph/read_dimacs.hpp
include/boost/graph/relax.hpp
include/boost/graph/reverse_graph.hpp
include/boost/graph/rmat_graph_generator.hpp
include/boost/graph/sequential_vertex_coloring.hpp
include/boost/graph/simple_point.hpp
include/boost/graph/sloan_ordering.hpp
include/boost/graph/small_world_generator.hpp
include/boost/graph/smallest_last_ordering.hpp
include/boost/graph/ssca_graph_generator.hpp
include/boost/graph/st_connected.hpp
include/boost/graph/stanford_graph.hpp
include/boost/graph/stoer_wagner_min_cut.hpp
include/boost/graph/strong_components.hpp
include/boost/graph/subgraph.hpp
include/boost/graph/successive_shortest_path_nonnegative_weights.hpp
include/boost/graph/tiernan_all_cycles.hpp
include/boost/graph/topological_sort.hpp
include/boost/graph/topology.hpp
include/boost/graph/transitive_closure.hpp
include/boost/graph/transitive_reduction.hpp
include/boost/graph/transpose_graph.hpp
include/boost/graph/tree_traits.hpp
include/boost/graph/two_bit_color_map.hpp
include/boost/graph/two_graphs_common_spanning_trees.hpp
include/boost/graph/undirected_dfs.hpp
include/boost/graph/undirected_graph.hpp
include/boost/graph/use_mpi.hpp
include/boost/graph/vector_as_graph.hpp
include/boost/graph/vertex_and_edge_range.hpp
include/boost/graph/vf2_sub_graph_iso.hpp
include/boost/graph/visitors.hpp
include/boost/graph/wavefront.hpp
include/boost/graph/write_dimacs.hpp
PRIVATE
src/graphml.cpp
src/read_graphviz_new.cpp
)
target_link_libraries(boost_graph PUBLIC Boost::headers PRIVATE Boost::regex)
include(CTest)
endif()
add_library(Boost::graph ALIAS boost_graph)
if(BUILD_SHARED_LIBS)
target_compile_definitions(boost_graph PUBLIC BOOST_GRAPH_DYN_LINK)
else()
+1 -7
View File
@@ -11,20 +11,16 @@ constant boost_dependencies :
/boost/array//boost_array
/boost/assert//boost_assert
/boost/bimap//boost_bimap
/boost/bind//boost_bind
/boost/concept_check//boost_concept_check
/boost/config//boost_config
/boost/container_hash//boost_container_hash
/boost/conversion//boost_conversion
/boost/core//boost_core
/boost/detail//boost_detail
/boost/foreach//boost_foreach
/boost/function//boost_function
/boost/integer//boost_integer
/boost/iterator//boost_iterator
/boost/lexical_cast//boost_lexical_cast
/boost/math//boost_math_tr1
/boost/move//boost_move
/boost/mp11//boost_mp11
/boost/mpl//boost_mpl
/boost/multi_index//boost_multi_index
/boost/multiprecision//boost_multiprecision
@@ -39,10 +35,8 @@ constant boost_dependencies :
/boost/smart_ptr//boost_smart_ptr
/boost/spirit//boost_spirit
/boost/throw_exception//boost_throw_exception
/boost/tti//boost_tti
/boost/tuple//boost_tuple
/boost/type_traits//boost_type_traits
/boost/typeof//boost_typeof
/boost/unordered//boost_unordered
/boost/utility//boost_utility
/boost/xpressive//boost_xpressive ;
+3
View File
@@ -6,5 +6,8 @@ asciidoc:
attributes:
source-language: cpp@
table-caption: false
# Right-rail floating TOC. Set here (not in the playbook) so it travels
# with the component under any deploy playbook, not just the local build.
page-toc: ''
nav:
- modules/ROOT/nav.adoc
+74 -12
View File
@@ -30,18 +30,47 @@ template <typename Graph>
class subgraph;
----
The `subgraph` class wraps an `adjacency_list` and maintains a tree of
subgraphs. The root graph owns all vertices and edges. Child subgraphs hold
subsets of the root's vertices, and their edge sets are _induced_: any edge in
the root whose both endpoints are in the child automatically appears in the
child.
`subgraph` represents parts of a single graph as independent graphs, without
copying the data and without the parts drifting out of sync with the whole. All
vertices and edges are stored once, in the root graph. Each subgraph is a
lightweight view onto a subset of that storage which still behaves like a full
graph, so it can be passed to any BGL algorithm.
Each subgraph uses _local_ descriptors (0-based within that subgraph). Use
`local_to_global()` and `global_to_local()` to convert between local and root
descriptors.
[TIP]
====
Consider a national road network: intersections are vertices and roads are
edges. An analysis might focus on one city, then one district within that city,
then compare against the whole country. Rather than three separate copies kept
consistent by hand, `subgraph` keeps one dataset and offers lightweight views
onto its parts. The country is the root, a city is a child subgraph, and a
district is a child of that city. Each view behaves like a normal graph and can
be handed to an algorithm such as `dijkstra_shortest_paths` exactly like any
other BGL graph.
====
Adding an edge to a child subgraph also adds it to all ancestor subgraphs.
Adding a vertex to a child subgraph also adds it to all ancestors.
These views nest into a tree. The _root_ subgraph holds the entire graph and
owns all of its vertices and edges. Each _child_ is a subset of its parent's
vertices, and a child may in turn have children of its own. A child's edges are
_induced_: an edge belongs to a child exactly when both of its endpoints do, so
only vertices are ever added to a child, never edges directly.
Because the storage is shared rather than copied, the levels stay linked in both
directions. A property set at one level, such as an edge weight or a vertex
color, is visible from every level. Adding a vertex or edge to a child also adds
it to every ancestor up to the root, so an edit made while working on one part
keeps the whole hierarchy consistent.
Each subgraph numbers its own vertices and edges 0-based, as required by the
many algorithms that assume a contiguous index space. A descriptor is therefore
meaningful only within one subgraph. `local_to_global()` and `global_to_local()`
translate a descriptor between a subgraph's local numbering and the root's.
Choosing among the graph views:
* `filtered_graph` for a read-only view that hides some vertices or edges.
* `copy_graph` for an independent copy that does not stay linked to the original.
* `subgraph` when mutability, per-region local numbering, and a parent/child
hierarchy over shared storage are all needed.
== Template Parameters
@@ -102,16 +131,49 @@ edge_descriptor global_to_local(edge_descriptor e_global) const;
Convert between local (subgraph-relative) and global (root) descriptors.
[WARNING]
====
These conversions have preconditions, and the two directions differ.
* `global_to_local` requires that the element is in this subgraph. In debug
builds a violation trips `BOOST_ASSERT`; with assertions disabled it returns a
default-constructed descriptor (`null_vertex()` for vertices). When the element
might not be present, query membership first with `find_vertex()` or
`find_edge()`.
* `local_to_global` requires a valid local descriptor of this subgraph. A
violation is undefined behaviour (an unchecked lookup) in all build
configurations.
On the root subgraph every conversion is the identity, so any element is
accepted.
====
'''
[source,cpp]
----
std::pair<vertex_descriptor, bool>
find_vertex(vertex_descriptor u_global) const;
std::pair<edge_descriptor, bool>
find_edge(edge_descriptor e_global) const;
----
Returns `(local_descriptor, true)` if the global vertex is in this subgraph,
`(_, false)` otherwise.
Membership queries that never assert. `find_vertex` returns
`(local_descriptor, true)` if the global vertex is in this subgraph, and
`(null_vertex(), false)` otherwise. `find_edge` behaves the same way for edges,
returning a default-constructed `edge_descriptor` in the not-found case. These
are the safe form of `global_to_local`, for the case where the element is not
known in advance to be in the subgraph.
[NOTE]
====
*Descriptor identity and stability.* For an element that is present, the
conversions round-trip: `global_to_local(local_to_global(x)) == x`, and the
edge index is preserved. Properties live in the root's storage and are shared
across the whole tree, so the same logical element carries the same property
value no matter which subgraph's descriptor reaches it.
====
=== Hierarchy Navigation
+1 -4
View File
@@ -20,11 +20,8 @@ content:
asciidoc:
attributes:
source-highlighter: highlight.js
# Enable the cppalliance theme's right-rail floating TOC on every page.
page-toc: ''
ui:
bundle:
url: https://github.com/boostorg/website-v2-docs/releases/download/ui-master/ui-bundle.zip
url: https://github.com/boostorg/graph-ui-bundle/raw/c80db72a7ba804256beb36e3a46d9c7df265d8d7/ui-bundle.zip
snapshot: true
supplemental_files: ./supplemental-ui
@@ -1,44 +0,0 @@
{{!--
Overrides the cppalliance bundle's header-content partial.
Adds a site-wide banner above the existing nav-bearing #header div, linking
to the previous (pre-rewrite) Boost.Graph documentation. The original
partial body is preserved verbatim below.
--}}
<style>
.bgl-legacy-banner {
background: var(--colors-brand-orange-100, #ffeaca);
color: var(--text-main-text-primary, #18191b);
border-bottom: 1px solid var(--colors-brand-orange-300, #ffc364);
padding: 0.6rem 1rem;
font-size: 0.9rem;
text-align: center;
line-height: 1.4;
}
.bgl-legacy-banner a {
color: inherit;
text-decoration: underline;
font-weight: 500;
}
.bgl-legacy-banner a:hover {
text-decoration: none;
}
html.dark .bgl-legacy-banner {
background: var(--colors-brand-orange-900, #352000);
color: var(--colors-brand-orange-100, #ffeaca);
border-bottom-color: var(--colors-brand-orange-700, #9b5f00);
}
</style>
<div class="bgl-legacy-banner" role="note">
This documentation is being rewritten. If something looks off, please cross-check with the
<a href="https://www.boost.org/doc/libs/1_91_0/libs/graph/doc/">Boost 1.91.0 Boost.Graph docs</a>
and <a href="https://github.com/boostorg/graph/issues/new?template=documentation.md&amp;labels=docs">open an issue</a>.
</div>
<div id="header">
{{#if (and (eq page.component.latest.asciidoc.attributes.remove-sidenav undefined) (eq page.attributes.remove-sidenav undefined))}}
{{> nav}}
{{/if}}
</div>
-89
View File
@@ -1,89 +0,0 @@
{{!--
Overrides the cppalliance bundle's nav-tree partial.
Fixes vs upstream:
1. Nests the recursive call inside the parent <li>, so child <ul>s
are true descendants of their parent item.
2. Adds `class="nav-item"` to each <li>, so the bundle's collapse rule
(`.nav-item:not(.is-active) > .nav-list { display: none }`) applies.
3. Emits a `<button class="nav-item-toggle">` next to items that have
children, wired up by a small inline script to toggle `.is-active`.
4. Auto-expands the current page's ancestor chain via :has() CSS.
--}}
{{#if (eq (or level 0) 0)}}
<style>
/* Chevron + link on one flex row. Guarantees vertical centring
regardless of font metrics or line-height. */
.nav-item-head {
display: flex;
align-items: center;
gap: 0.35em;
}
.nav-item > .nav-item-head > .nav-item-toggle {
flex: 0 0 auto;
width: 0.9em; height: 0.9em;
background: transparent; border: 0; cursor: pointer;
color: inherit; padding: 0;
transition: transform 0.15s ease;
line-height: 0;
}
.nav-item > .nav-item-head > .nav-item-toggle svg {
width: 100%; height: 100%;
display: block;
pointer-events: none; /* clicks go to the button, not the <path> */
}
.nav-item.is-active > .nav-item-head > .nav-item-toggle { transform: rotate(90deg); }
/* A nav-text that has children should look clickable. */
.nav-item > .nav-item-head > .nav-text[onclick] {
cursor: pointer;
user-select: none;
}
</style>
<script>
// Click-to-toggle is handled by inline onclick on each button.
// Here we only auto-expand the ancestor chain of the current page as a
// fallback for browsers that mis-handle the :has() CSS rule above.
(function () {
if (window.__bglNavInit) return;
window.__bglNavInit = true;
function expandAncestors() {
var cur = document.querySelector('.nav-list .is-current-page');
while (cur) {
if (cur.classList && cur.classList.contains('nav-item')) cur.classList.add('is-active');
cur = cur.parentElement;
}
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', expandAncestors);
} else {
expandAncestors();
}
})();
</script>
{{/if}}
{{#if navigation.length}}
<ul class="nav-list">
{{#each navigation}}
{{#if ./content}}
<li class="nav-item{{#if (eq ./url @root.page.url)}} is-current-page{{/if}}" data-depth="{{or ../level 0}}">
<div class="nav-item-head">
{{#if ./items.length}}<button class="nav-item-toggle" aria-label="toggle" onclick="event.preventDefault();event.stopPropagation();this.closest('.nav-item').classList.toggle('is-active');return false;"><svg viewBox="0 0 10 10" aria-hidden="true"><path d="M3.5 2 L7 5 L3.5 8" stroke="currentColor" stroke-width="1.6" fill="none" stroke-linecap="round" stroke-linejoin="round"/></svg></button>{{/if}}
{{#if ./url}}
<a class="nav-link" href="
{{~#if (eq ./urlType 'internal')}}{{{relativize ./url}}}
{{~else}}{{{./url}}}{{~/if}}">{{{./content}}}</a>
{{else}}
<span class="nav-text"{{#if ./items.length}} onclick="this.closest('.nav-item').classList.toggle('is-active');"{{/if}}>{{{./content}}}</span>
{{/if}}
</div>
{{> nav-tree navigation=./items level=(increment ../level)}}
</li>
{{else}}
{{> nav-tree navigation=./items level=(increment ../level)}}
{{/if}}
{{/each}}
</ul>
{{/if}}
+11 -13
View File
@@ -25,12 +25,9 @@
#include <boost/graph/graph_mutability_traits.hpp>
#include <boost/graph/graph_selectors.hpp>
#include <boost/property_map/property_map.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/not.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/graph/detail/edge.hpp>
#include <boost/type_traits/is_same.hpp>
#include <type_traits>
#include <boost/detail/workaround.hpp>
#include <boost/graph/properties.hpp>
#include <boost/graph/named_graph.hpp>
@@ -187,7 +184,7 @@ namespace detail
{
value = false
};
typedef mpl::false_ type;
typedef std::false_type type;
};
template <> struct is_random_access< vecS >
{
@@ -195,12 +192,12 @@ namespace detail
{
value = true
};
typedef mpl::true_ type;
typedef std::true_type type;
};
} // namespace detail
template < typename Selector > struct is_distributed_selector : mpl::false_
template < typename Selector > struct is_distributed_selector : std::false_type
{
};
@@ -220,8 +217,8 @@ struct adjacency_list_traits
typedef typename DirectedS::is_bidir_t is_bidir;
typedef typename DirectedS::is_directed_t is_directed;
typedef typename mpl::if_< is_bidir, bidirectional_tag,
typename mpl::if_< is_directed, directed_tag,
typedef typename std::conditional< is_bidir::value, bidirectional_tag,
typename std::conditional< is_directed::value, directed_tag,
undirected_tag >::type >::type directed_category;
typedef typename parallel_edge_traits< OutEdgeListS >::type
@@ -229,7 +226,7 @@ struct adjacency_list_traits
typedef std::size_t vertices_size_type;
typedef void* vertex_ptr;
typedef typename mpl::if_< is_rand_access, vertices_size_type,
typedef typename std::conditional< is_rand_access::value, vertices_size_type,
vertex_ptr >::type vertex_descriptor;
typedef detail::edge_desc_impl< directed_category, vertex_descriptor >
edge_descriptor;
@@ -242,11 +239,12 @@ private:
typedef typename container_gen< EdgeListS, dummy >::type EdgeContainer;
typedef typename DirectedS::is_bidir_t BidirectionalT;
typedef typename DirectedS::is_directed_t DirectedT;
typedef typename mpl::and_< DirectedT,
typename mpl::not_< BidirectionalT >::type >::type on_edge_storage;
typedef std::integral_constant< bool,
DirectedT::value && !BidirectionalT::value >
on_edge_storage;
public:
typedef typename mpl::if_< on_edge_storage, std::size_t,
typedef typename std::conditional< on_edge_storage::value, std::size_t,
typename EdgeContainer::size_type >::type edges_size_type;
};
+10 -11
View File
@@ -20,8 +20,7 @@
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/graph_mutability_traits.hpp>
#include <boost/graph/graph_selectors.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/bool.hpp>
#include <type_traits>
#include <boost/graph/adjacency_iterator.hpp>
#include <boost/graph/detail/edge.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
@@ -413,7 +412,7 @@ public:
// in_degree, etc.).
BOOST_STATIC_ASSERT(!(is_same< Directed, bidirectionalS >::value));
typedef typename mpl::if_< is_directed, bidirectional_tag,
typedef typename std::conditional< is_directed::value, bidirectional_tag,
undirected_tag >::type directed_category;
typedef disallow_parallel_edge_tag edge_parallel_category;
@@ -470,7 +469,7 @@ public:
public: // should be private
typedef
typename mpl::if_< typename has_property< edge_property_type >::type,
typename std::conditional< has_property< edge_property_type >::type::value,
std::pair< bool, edge_property_type >, char >::type StoredEdge;
#if defined(BOOST_NO_STD_ALLOCATOR)
typedef std::vector< StoredEdge > Matrix;
@@ -510,7 +509,7 @@ public:
MatrixIter, size_type, edge_descriptor >
UnDirOutEdgeIter;
typedef typename mpl::if_< typename Directed::is_directed_t, DirOutEdgeIter,
typedef typename std::conditional< Directed::is_directed_t::value, DirOutEdgeIter,
UnDirOutEdgeIter >::type unfiltered_out_edge_iter;
typedef detail::dir_adj_matrix_in_edge_iter< vertex_descriptor, MatrixIter,
@@ -521,7 +520,7 @@ public:
MatrixIter, size_type, edge_descriptor >
UnDirInEdgeIter;
typedef typename mpl::if_< typename Directed::is_directed_t, DirInEdgeIter,
typedef typename std::conditional< Directed::is_directed_t::value, DirInEdgeIter,
UnDirInEdgeIter >::type unfiltered_in_edge_iter;
typedef detail::adj_matrix_edge_iter< Directed, MatrixIter, size_type,
@@ -1103,7 +1102,7 @@ struct adj_mat_pm_helper< D, VP, EP, GP, A, Tag, edge_property_tag >
{
Tag tag;
lookup_property_from_edge(Tag tag) : tag(tag) {}
typedef typename boost::mpl::if_< IsConst, const EP, EP >::type
typedef typename std::conditional< IsConst::value, const EP, EP >::type
ep_type_nonref;
typedef ep_type_nonref& ep_type;
typedef typename lookup_one_property< ep_type_nonref, Tag >::type&
@@ -1116,20 +1115,20 @@ struct adj_mat_pm_helper< D, VP, EP, GP, A, Tag, edge_property_tag >
};
typedef function_property_map<
lookup_property_from_edge< boost::mpl::false_ >,
lookup_property_from_edge< std::false_type >,
typename graph_traits<
adjacency_matrix< D, VP, EP, GP, A > >::edge_descriptor >
type;
typedef function_property_map<
lookup_property_from_edge< boost::mpl::true_ >,
lookup_property_from_edge< std::true_type >,
typename graph_traits<
adjacency_matrix< D, VP, EP, GP, A > >::edge_descriptor >
const_type;
typedef edge_descriptor arg_type;
typedef
typename lookup_property_from_edge< boost::mpl::false_ >::result_type
typename lookup_property_from_edge< std::false_type >::result_type
single_nonconst_type;
typedef typename lookup_property_from_edge< boost::mpl::true_ >::result_type
typedef typename lookup_property_from_edge< std::true_type >::result_type
single_const_type;
static type get_nonconst(adjacency_matrix< D, VP, EP, GP, A >& g, Tag tag)
@@ -19,7 +19,7 @@
#include <boost/tuple/tuple.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/if.hpp>
#include <type_traits>
#include <boost/property_map/property_map.hpp>
#include <boost/graph/named_function_params.hpp>
#include <algorithm>
@@ -451,7 +451,7 @@ namespace detail
degree_size_type;
typedef
typename graph_traits< Graph >::edge_descriptor edge_descriptor;
typedef typename mpl::if_c<
typedef typename std::conditional<
(is_same< CentralityMap, dummy_property_map >::value),
EdgeCentralityMap, CentralityMap >::type a_centrality_map;
typedef typename property_traits< a_centrality_map >::value_type
@@ -483,7 +483,7 @@ namespace detail
degree_size_type;
typedef
typename graph_traits< Graph >::edge_descriptor edge_descriptor;
typedef typename mpl::if_c<
typedef typename std::conditional<
(is_same< CentralityMap, dummy_property_map >::value),
EdgeCentralityMap, CentralityMap >::type a_centrality_map;
typedef typename property_traits< a_centrality_map >::value_type
-1
View File
@@ -7,7 +7,6 @@
#define BOOST_GRAPH_BUFFER_CONCEPTS_HPP 1
#include <boost/concept_check.hpp>
#include <boost/property_map/property_map.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/type_traits/remove_reference.hpp>
+1 -2
View File
@@ -9,7 +9,6 @@
#ifndef BOOST_GRAPH_CIRCLE_LAYOUT_HPP
#define BOOST_GRAPH_CIRCLE_LAYOUT_HPP
#include <boost/config/no_tr1/cmath.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/iteration_macros.hpp>
#include <boost/graph/topology.hpp>
@@ -34,7 +33,7 @@ void circle_graph_layout(
{
BOOST_STATIC_ASSERT(
property_traits< PositionMap >::value_type::dimensions >= 2);
const double pi = boost::math::constants::pi< double >();
const double pi = 3.14159265358979323846;
#ifndef BOOST_NO_STDC_NAMESPACE
using std::cos;
@@ -36,7 +36,6 @@
#include <boost/property_map/property_map.hpp>
#include <boost/integer.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/mpl/if.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/graph/graph_selectors.hpp>
#include <boost/graph/detail/is_distributed_selector.hpp>
@@ -45,7 +44,6 @@
#include <boost/functional/hash.hpp>
#include <boost/next_prior.hpp>
#include <boost/property_map/transform_value_property_map.hpp>
#include <boost/mpl/print.hpp>
namespace boost
{
+20 -17
View File
@@ -21,11 +21,11 @@
#include <boost/graph/named_function_params.hpp>
#include <boost/graph/detail/mpi_include.hpp>
#include <boost/ref.hpp>
#include <boost/implicit_cast.hpp>
#include <boost/optional.hpp>
#include <boost/parameter.hpp>
#include <boost/concept/assert.hpp>
#include <boost/tti/has_member_function.hpp>
#include <boost/type_traits/make_void.hpp>
#include <type_traits>
#include <vector>
#include <utility>
@@ -69,7 +69,19 @@ namespace detail
}
};
BOOST_TTI_HAS_MEMBER_FUNCTION(finish_edge)
// has_finish_edge<Vis, E, G>::value is true when vis.finish_edge(e, g) is
// a valid call for e of type E and g of type const G&.
template < typename Vis, typename E, typename G, typename = void >
struct has_finish_edge : std::false_type
{
};
template < typename Vis, typename E, typename G >
struct has_finish_edge< Vis, E, G,
boost::void_t< decltype(std::declval< Vis& >().finish_edge(
std::declval< E& >(), std::declval< const G& >())) > >
: std::true_type
{
};
template < bool IsCallable > struct do_call_finish_edge
{
@@ -90,18 +102,9 @@ namespace detail
template < typename E, typename G, typename Vis >
void call_finish_edge(Vis& vis, E e, const G& g)
{ // Only call if method exists
#if ((defined(__GNUC__) && (__GNUC__ > 4) \
|| ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9))) \
|| defined(__clang__) \
|| (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1200)))
do_call_finish_edge< has_member_function_finish_edge< Vis, void,
boost::mpl::vector< E, const G& > >::value >::call_finish_edge(vis,
e, g);
#else
do_call_finish_edge< has_member_function_finish_edge< Vis,
void >::value >::call_finish_edge(vis, e, g);
#endif
{ // Only call if the visitor has a callable finish_edge(e, g)
do_call_finish_edge< has_finish_edge< Vis, E, G >::value >::
call_finish_edge(vis, e, g);
}
// Define BOOST_RECURSIVE_DFS to use older, recursive version.
@@ -275,7 +278,7 @@ void depth_first_search(const VertexListGraph& g, DFSVisitor vis,
typename graph_traits< VertexListGraph >::vertex_iterator ui, ui_end;
for (boost::tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui)
{
Vertex u = implicit_cast< Vertex >(*ui);
Vertex u = *ui;
put(color, u, Color::white());
vis.initialize_vertex(u, g);
}
@@ -289,7 +292,7 @@ void depth_first_search(const VertexListGraph& g, DFSVisitor vis,
for (boost::tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui)
{
Vertex u = implicit_cast< Vertex >(*ui);
Vertex u = *ui;
ColorValue u_color = get(color, u);
if (u_color == Color::white())
{
+26 -24
View File
@@ -27,9 +27,7 @@
#include <boost/iterator/iterator_adaptor.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/not.hpp>
#include <boost/mpl/and.hpp>
#include <type_traits>
#include <boost/graph/graph_concepts.hpp>
#include <boost/pending/container_traits.hpp>
#include <boost/graph/detail/adj_list_edge_iterator.hpp>
@@ -2343,8 +2341,8 @@ namespace detail
typedef typename container_gen< VertexListS, vertex_ptr >::type
SeqVertexList;
typedef boost::integer_range< vertex_descriptor > RandVertexList;
typedef typename mpl::if_< is_rand_access, RandVertexList,
SeqVertexList >::type VertexList;
typedef typename std::conditional< is_rand_access::value,
RandVertexList, SeqVertexList >::type VertexList;
typedef typename VertexList::iterator vertex_iterator;
@@ -2354,21 +2352,22 @@ namespace detail
list_edge< vertex_descriptor, EdgeProperty > >::type
EdgeContainer;
typedef typename mpl::and_< DirectedT,
typename mpl::not_< BidirectionalT >::type >::type
typedef std::integral_constant< bool,
DirectedT::value && !BidirectionalT::value >
on_edge_storage;
typedef typename mpl::if_< on_edge_storage, std::size_t,
typename EdgeContainer::size_type >::type edges_size_type;
typedef typename std::conditional< on_edge_storage::value,
std::size_t, typename EdgeContainer::size_type >::type
edges_size_type;
typedef typename EdgeContainer::iterator EdgeIter;
typedef
typename detail::is_random_access< EdgeListS >::type is_edge_ra;
typedef typename mpl::if_< on_edge_storage,
typedef typename std::conditional< on_edge_storage::value,
stored_edge_property< vertex_descriptor, EdgeProperty >,
typename mpl::if_< is_edge_ra,
typename std::conditional< is_edge_ra::value,
stored_ra_edge_iter< vertex_descriptor, EdgeContainer,
EdgeProperty >,
stored_edge_iter< vertex_descriptor, EdgeIter,
@@ -2421,8 +2420,8 @@ namespace detail
graph_type >
DirectedEdgeIter;
typedef typename mpl::if_< on_edge_storage, DirectedEdgeIter,
UndirectedEdgeIter >::type edge_iterator;
typedef typename std::conditional< on_edge_storage::value,
DirectedEdgeIter, UndirectedEdgeIter >::type edge_iterator;
// stored_vertex and StoredVertexList
typedef typename container_gen< VertexListS, vertex_ptr >::type
@@ -2464,11 +2463,12 @@ namespace detail
InEdgeList m_in_edges;
VertexProperty m_property;
};
typedef typename mpl::if_< is_rand_access,
typename mpl::if_< BidirectionalT, bidir_rand_stored_vertex,
rand_stored_vertex >::type,
typename mpl::if_< BidirectionalT, bidir_seq_stored_vertex,
seq_stored_vertex >::type >::type StoredVertex;
typedef typename std::conditional< is_rand_access::value,
typename std::conditional< BidirectionalT::value,
bidir_rand_stored_vertex, rand_stored_vertex >::type,
typename std::conditional< BidirectionalT::value,
bidir_seq_stored_vertex, seq_stored_vertex >::type >::type
StoredVertex;
struct stored_vertex : public StoredVertex
{
stored_vertex() {}
@@ -2477,17 +2477,19 @@ namespace detail
typedef typename container_gen< VertexListS, stored_vertex >::type
RandStoredVertexList;
typedef typename mpl::if_< is_rand_access, RandStoredVertexList,
SeqStoredVertexList >::type StoredVertexList;
typedef typename std::conditional< is_rand_access::value,
RandStoredVertexList, SeqStoredVertexList >::type
StoredVertexList;
}; // end of config
typedef typename mpl::if_< BidirectionalT,
typedef typename std::conditional< BidirectionalT::value,
bidirectional_graph_helper_with_property< config >,
typename mpl::if_< DirectedT, directed_graph_helper< config >,
typename std::conditional< DirectedT::value,
directed_graph_helper< config >,
undirected_graph_helper< config > >::type >::type
DirectedHelper;
typedef typename mpl::if_< is_rand_access,
typedef typename std::conditional< is_rand_access::value,
vec_adj_list_impl< Graph, config, DirectedHelper >,
adj_list_impl< Graph, config, DirectedHelper > >::type type;
};
@@ -2687,7 +2689,7 @@ namespace detail
{
template < class Tag, class Graph, class Property >
struct adj_list_choose_vertex_pa
: boost::mpl::if_< boost::is_same< Tag, vertex_all_t >,
: std::conditional< boost::is_same< Tag, vertex_all_t >::value,
adj_list_all_vertex_pa, adj_list_any_vertex_pa >::type ::
template bind_< Tag, Graph, Property >
{
@@ -40,7 +40,6 @@
#include <boost/property_map/property_map.hpp>
#include <boost/integer.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/mpl/if.hpp>
#include <boost/graph/graph_selectors.hpp>
#include <boost/static_assert.hpp>
#include <boost/functional/hash.hpp>
+3 -2
View File
@@ -9,6 +9,7 @@
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/properties.hpp>
#include <type_traits>
// The structures in this module are responsible for selecting and defining
// types for accessing a builting index map. Note that the selection of these
@@ -67,8 +68,8 @@ namespace detail
// VertexEdgeGraph - whichever type Key is selecting.
template < typename Graph, typename Key > struct choose_indexer
{
typedef typename mpl::if_<
is_same< Key, typename graph_traits< Graph >::vertex_descriptor >,
typedef typename std::conditional<
is_same< Key, typename graph_traits< Graph >::vertex_descriptor >::value,
vertex_indexer< Graph >, edge_indexer< Graph > >::type indexer_type;
typedef typename indexer_type::index_type index_type;
};
@@ -24,7 +24,6 @@
#include <boost/integer.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/property_map/property_map.hpp>
#include <boost/mpl/if.hpp>
namespace boost
{
@@ -15,13 +15,13 @@
#ifndef BOOST_GRAPH_DETAIL_IS_DISTRIBUTED_SELECTOR_HPP
#define BOOST_GRAPH_DETAIL_IS_DISTRIBUTED_SELECTOR_HPP
#include <boost/mpl/bool.hpp>
#include <type_traits>
namespace boost
{
namespace detail
{
template < typename > struct is_distributed_selector : boost::mpl::false_
template < typename > struct is_distributed_selector : std::false_type
{
};
}
@@ -9,6 +9,8 @@
#include <boost/graph/graph_mutability_traits.hpp>
#include <type_traits>
namespace boost
{
@@ -84,7 +86,7 @@ struct labeled_add_only_property_graph_tag
template < typename Graph >
struct graph_has_add_vertex_by_label
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
labeled_add_vertex_tag >::value >
{
@@ -92,7 +94,7 @@ struct graph_has_add_vertex_by_label
template < typename Graph >
struct graph_has_add_vertex_by_label_with_property
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
labeled_add_vertex_property_tag >::value >
{
@@ -100,7 +102,7 @@ struct graph_has_add_vertex_by_label_with_property
template < typename Graph >
struct graph_has_remove_vertex_by_label
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
labeled_remove_vertex_tag >::value >
{
@@ -108,7 +110,7 @@ struct graph_has_remove_vertex_by_label
template < typename Graph >
struct graph_has_add_edge_by_label
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
labeled_add_edge_tag >::value >
{
@@ -116,7 +118,7 @@ struct graph_has_add_edge_by_label
template < typename Graph >
struct graph_has_add_edge_by_label_with_property
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
labeled_add_edge_property_tag >::value >
{
@@ -124,7 +126,7 @@ struct graph_has_add_edge_by_label_with_property
template < typename Graph >
struct graph_has_remove_edge_by_label
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
labeled_remove_edge_tag >::value >
{
@@ -132,49 +134,55 @@ struct graph_has_remove_edge_by_label
template < typename Graph >
struct is_labeled_mutable_vertex_graph
: mpl::and_< graph_has_add_vertex_by_label< Graph >,
graph_has_remove_vertex_by_label< Graph > >
: std::integral_constant< bool,
graph_has_add_vertex_by_label< Graph >::value
&& graph_has_remove_vertex_by_label< Graph >::value >
{
};
template < typename Graph >
struct is_labeled_mutable_vertex_property_graph
: mpl::and_< graph_has_add_vertex_by_label< Graph >,
graph_has_remove_vertex_by_label< Graph > >
: std::integral_constant< bool,
graph_has_add_vertex_by_label< Graph >::value
&& graph_has_remove_vertex_by_label< Graph >::value >
{
};
template < typename Graph >
struct is_labeled_mutable_edge_graph
: mpl::and_< graph_has_add_edge_by_label< Graph >,
graph_has_remove_edge_by_label< Graph > >
: std::integral_constant< bool,
graph_has_add_edge_by_label< Graph >::value
&& graph_has_remove_edge_by_label< Graph >::value >
{
};
template < typename Graph >
struct is_labeled_mutable_edge_property_graph
: mpl::and_< graph_has_add_edge_by_label< Graph >,
graph_has_remove_edge_by_label< Graph > >
: std::integral_constant< bool,
graph_has_add_edge_by_label< Graph >::value
&& graph_has_remove_edge_by_label< Graph >::value >
{
};
template < typename Graph >
struct is_labeled_mutable_graph
: mpl::and_< is_labeled_mutable_vertex_graph< Graph >,
is_labeled_mutable_edge_graph< Graph > >
: std::integral_constant< bool,
is_labeled_mutable_vertex_graph< Graph >::value
&& is_labeled_mutable_edge_graph< Graph >::value >
{
};
template < typename Graph >
struct is_labeled_mutable_property_graph
: mpl::and_< is_labeled_mutable_vertex_property_graph< Graph >,
is_labeled_mutable_edge_property_graph< Graph > >
: std::integral_constant< bool,
is_labeled_mutable_vertex_property_graph< Graph >::value
&& is_labeled_mutable_edge_property_graph< Graph >::value >
{
};
template < typename Graph >
struct is_labeled_add_only_property_graph
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
labeled_add_only_property_graph_tag >::value >
{
@@ -182,7 +190,7 @@ struct is_labeled_add_only_property_graph
template < typename Graph >
struct is_labeled_graph
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
label_vertex_tag >::value >
{
@@ -197,13 +205,15 @@ namespace graph_detail
// graph_mutability_traits specialization below.
template < typename Graph > struct determine_mutability
{
typedef typename mpl::if_< is_add_only_property_graph< Graph >,
typedef typename std::conditional<
is_add_only_property_graph< Graph >::value,
labeled_add_only_property_graph_tag,
typename mpl::if_< is_mutable_property_graph< Graph >,
typename std::conditional< is_mutable_property_graph< Graph >::value,
labeled_mutable_property_graph_tag,
typename mpl::if_< is_mutable_graph< Graph >,
typename std::conditional< is_mutable_graph< Graph >::value,
labeled_mutable_graph_tag,
typename mpl::if_< is_mutable_edge_graph< Graph >,
typename std::conditional<
is_mutable_edge_graph< Graph >::value,
labeled_graph_tag,
typename graph_mutability_traits< Graph >::category >::
type >::type >::type >::type type;
-1
View File
@@ -12,7 +12,6 @@
#include <boost/pending/property.hpp>
#include <boost/property_map/transform_value_property_map.hpp>
#include <boost/type_traits.hpp>
#include <boost/mpl/if.hpp>
namespace boost
{
+4 -5
View File
@@ -13,8 +13,7 @@
#include <iterator>
#include <boost/config.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/bool.hpp>
#include <type_traits>
#include <boost/range/irange.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/properties.hpp>
@@ -264,7 +263,7 @@ template < class Cat > struct is_random
{
RET = false
};
typedef mpl::false_ type;
typedef std::false_type type;
};
template <> struct is_random< std::random_access_iterator_tag >
{
@@ -272,7 +271,7 @@ template <> struct is_random< std::random_access_iterator_tag >
{
RET = true
};
typedef mpl::true_ type;
typedef std::true_type type;
};
// The edge_list class conditionally inherits from one of the
@@ -287,7 +286,7 @@ template < class EdgeIter,
class T, class D, class Cat >
#endif
class edge_list
: public mpl::if_< typename is_random< Cat >::type,
: public std::conditional< is_random< Cat >::type::value,
edge_list_impl_ra< edge_list< EdgeIter, T, D, Cat >, EdgeIter, T, D >,
edge_list_impl< edge_list< EdgeIter, T, D, Cat >, EdgeIter, T, D > >::type
{
+10 -17
View File
@@ -21,7 +21,6 @@
#include <boost/graph/buffer_concepts.hpp>
#include <boost/concept_check.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/not.hpp>
#include <boost/static_assert.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/concept/assert.hpp>
@@ -79,10 +78,8 @@ BOOST_concept(IncidenceGraph, (G)) : Graph< G >
typedef typename graph_traits< G >::degree_size_type degree_size_type;
typedef typename graph_traits< G >::traversal_category traversal_category;
BOOST_STATIC_ASSERT(
(boost::mpl::not_< boost::is_same< out_edge_iterator, void > >::value));
BOOST_STATIC_ASSERT(
(boost::mpl::not_< boost::is_same< degree_size_type, void > >::value));
BOOST_STATIC_ASSERT((!boost::is_same< out_edge_iterator, void >::value));
BOOST_STATIC_ASSERT((!boost::is_same< degree_size_type, void >::value));
BOOST_CONCEPT_USAGE(IncidenceGraph)
{
@@ -126,8 +123,7 @@ BOOST_concept(BidirectionalGraph, (G)) : IncidenceGraph< G >
BOOST_CONCEPT_ASSERT(
(Convertible< traversal_category, bidirectional_graph_tag >));
BOOST_STATIC_ASSERT((boost::mpl::not_<
boost::is_same< in_edge_iterator, void > >::value));
BOOST_STATIC_ASSERT((!boost::is_same< in_edge_iterator, void >::value));
p = in_edges(v, g);
n = in_degree(v, g);
@@ -160,8 +156,8 @@ BOOST_concept(AdjacencyGraph, (G)) : Graph< G >
BOOST_CONCEPT_ASSERT(
(Convertible< traversal_category, adjacency_graph_tag >));
BOOST_STATIC_ASSERT((boost::mpl::not_<
boost::is_same< adjacency_iterator, void > >::value));
BOOST_STATIC_ASSERT(
(!boost::is_same< adjacency_iterator, void >::value));
p = adjacent_vertices(v, g);
v = *p.first;
@@ -185,10 +181,9 @@ BOOST_concept(VertexListGraph, (G)) : Graph< G >
BOOST_CONCEPT_ASSERT(
(Convertible< traversal_category, vertex_list_graph_tag >));
BOOST_STATIC_ASSERT((boost::mpl::not_<
boost::is_same< vertex_iterator, void > >::value));
BOOST_STATIC_ASSERT((boost::mpl::not_<
boost::is_same< vertices_size_type, void > >::value));
BOOST_STATIC_ASSERT((!boost::is_same< vertex_iterator, void >::value));
BOOST_STATIC_ASSERT(
(!boost::is_same< vertices_size_type, void >::value));
#ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK
// dwa 2003/7/11 -- This clearly shouldn't be necessary, but if
@@ -239,10 +234,8 @@ BOOST_concept(EdgeListGraph, (G)) : Graph< G >
BOOST_CONCEPT_ASSERT(
(Convertible< traversal_category, edge_list_graph_tag >));
BOOST_STATIC_ASSERT(
(boost::mpl::not_< boost::is_same< edge_iterator, void > >::value));
BOOST_STATIC_ASSERT((boost::mpl::not_<
boost::is_same< edges_size_type, void > >::value));
BOOST_STATIC_ASSERT((!boost::is_same< edge_iterator, void >::value));
BOOST_STATIC_ASSERT((!boost::is_same< edges_size_type, void >::value));
p = edges(g);
e = *p.first;
+26 -19
View File
@@ -8,9 +8,7 @@
#define BOOST_GRAPH_MUTABILITY_TRAITS_HPP
#include <boost/config.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/bool.hpp>
#include <type_traits>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/is_same.hpp>
@@ -90,7 +88,7 @@ template < typename Graph > struct graph_mutability_traits
template < typename Graph >
struct graph_has_add_vertex
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
add_vertex_tag >::value >
{
@@ -98,7 +96,7 @@ struct graph_has_add_vertex
template < typename Graph >
struct graph_has_add_vertex_with_property
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
add_vertex_property_tag >::value >
{
@@ -106,7 +104,7 @@ struct graph_has_add_vertex_with_property
template < typename Graph >
struct graph_has_remove_vertex
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
remove_vertex_tag >::value >
{
@@ -114,7 +112,7 @@ struct graph_has_remove_vertex
template < typename Graph >
struct graph_has_add_edge
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
add_edge_tag >::value >
{
@@ -122,7 +120,7 @@ struct graph_has_add_edge
template < typename Graph >
struct graph_has_add_edge_with_property
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
add_edge_property_tag >::value >
{
@@ -130,7 +128,7 @@ struct graph_has_add_edge_with_property
template < typename Graph >
struct graph_has_remove_edge
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
remove_edge_tag >::value >
{
@@ -138,46 +136,55 @@ struct graph_has_remove_edge
template < typename Graph >
struct is_mutable_vertex_graph
: mpl::and_< graph_has_add_vertex< Graph >, graph_has_remove_vertex< Graph > >
: std::integral_constant< bool,
graph_has_add_vertex< Graph >::value
&& graph_has_remove_vertex< Graph >::value >
{
};
template < typename Graph >
struct is_mutable_vertex_property_graph
: mpl::and_< graph_has_add_vertex_with_property< Graph >,
graph_has_remove_vertex< Graph > >
: std::integral_constant< bool,
graph_has_add_vertex_with_property< Graph >::value
&& graph_has_remove_vertex< Graph >::value >
{
};
template < typename Graph >
struct is_mutable_edge_graph
: mpl::and_< graph_has_add_edge< Graph >, graph_has_remove_edge< Graph > >
: std::integral_constant< bool,
graph_has_add_edge< Graph >::value
&& graph_has_remove_edge< Graph >::value >
{
};
template < typename Graph >
struct is_mutable_edge_property_graph
: mpl::and_< graph_has_add_edge_with_property< Graph >,
graph_has_remove_edge< Graph > >
: std::integral_constant< bool,
graph_has_add_edge_with_property< Graph >::value
&& graph_has_remove_edge< Graph >::value >
{
};
template < typename Graph >
struct is_mutable_graph
: mpl::and_< is_mutable_vertex_graph< Graph >, is_mutable_edge_graph< Graph > >
: std::integral_constant< bool,
is_mutable_vertex_graph< Graph >::value
&& is_mutable_edge_graph< Graph >::value >
{
};
template < typename Graph >
struct is_mutable_property_graph
: mpl::and_< is_mutable_vertex_property_graph< Graph >,
is_mutable_edge_property_graph< Graph > >
: std::integral_constant< bool,
is_mutable_vertex_property_graph< Graph >::value
&& is_mutable_edge_property_graph< Graph >::value >
{
};
template < typename Graph >
struct is_add_only_property_graph
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
add_only_property_graph_tag >::value >
{
+7 -7
View File
@@ -10,7 +10,7 @@
#ifndef BOOST_GRAPH_SELECTORS_HPP
#define BOOST_GRAPH_SELECTORS_HPP
#include <boost/mpl/bool.hpp>
#include <type_traits>
namespace boost
{
@@ -26,8 +26,8 @@ struct directedS
is_directed = true,
is_bidir = false
};
typedef mpl::true_ is_directed_t;
typedef mpl::false_ is_bidir_t;
using is_directed_t = std::true_type;
using is_bidir_t = std::false_type;
};
struct undirectedS
{
@@ -36,8 +36,8 @@ struct undirectedS
is_directed = false,
is_bidir = false
};
typedef mpl::false_ is_directed_t;
typedef mpl::false_ is_bidir_t;
using is_directed_t = std::false_type;
using is_bidir_t = std::false_type;
};
struct bidirectionalS
{
@@ -46,8 +46,8 @@ struct bidirectionalS
is_directed = true,
is_bidir = true
};
typedef mpl::true_ is_directed_t;
typedef mpl::true_ is_bidir_t;
using is_directed_t = std::true_type;
using is_bidir_t = std::true_type;
};
} // namespace boost
+79 -63
View File
@@ -14,15 +14,9 @@
#include <iterator>
#include <utility> /* Primarily for std::pair */
#include <boost/tuple/tuple.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/not.hpp>
#include <boost/mpl/has_xxx.hpp>
#include <boost/mpl/void.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/and.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/make_void.hpp>
#include <type_traits>
#include <boost/iterator/iterator_categories.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
#include <boost/pending/property.hpp>
@@ -33,16 +27,18 @@ namespace boost
namespace detail
{
#define BOOST_GRAPH_MEMBER_OR_VOID(name) \
BOOST_MPL_HAS_XXX_TRAIT_DEF(name) \
template < typename T > struct BOOST_JOIN(get_member_, name) \
{ \
typedef typename T::name type; \
}; \
template < typename T > \
struct BOOST_JOIN(get_opt_member_, name) \
: boost::mpl::eval_if_c< BOOST_JOIN(has_, name) < T >::value, BOOST_JOIN(get_member_, name)< T >, boost::mpl::identity< void > >\
{ \
// get_opt_member_##name<T>::type is T::name when that member type exists, void otherwise.
#define BOOST_GRAPH_MEMBER_OR_VOID(name) \
template < typename T, typename = void > \
struct BOOST_JOIN(get_opt_member_, name) \
{ \
using type = void; \
}; \
template < typename T > \
struct BOOST_JOIN(get_opt_member_, name)< T, \
boost::void_t< typename T::name > > \
{ \
using type = typename T::name; \
};
BOOST_GRAPH_MEMBER_OR_VOID(adjacency_iterator)
BOOST_GRAPH_MEMBER_OR_VOID(out_edge_iterator)
@@ -122,7 +118,7 @@ namespace graph_detail
{
template < typename Tag >
struct is_directed_tag
: mpl::bool_< is_convertible< Tag, directed_tag >::value >
: std::integral_constant< bool, is_convertible< Tag, directed_tag >::value >
{
};
} // namespace graph_detail
@@ -135,7 +131,8 @@ struct is_directed_graph
};
template < typename Graph >
struct is_undirected_graph : mpl::not_< is_directed_graph< Graph > >
struct is_undirected_graph
: std::integral_constant< bool, !is_directed_graph< Graph >::value >
{
};
//@}
@@ -170,8 +167,9 @@ template < typename Graph > bool allows_parallel_edges(const Graph&)
*/
template < typename Graph >
struct is_multigraph
: mpl::bool_< is_same< typename graph_traits< Graph >::edge_parallel_category,
allow_parallel_edge_tag >::value >
: std::integral_constant< bool,
is_same< typename graph_traits< Graph >::edge_parallel_category,
allow_parallel_edge_tag >::value >
{
};
//@}
@@ -218,7 +216,7 @@ struct distributed_edge_list_graph_tag
//@{
template < typename Graph >
struct is_incidence_graph
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_traits< Graph >::traversal_category,
incidence_graph_tag >::value >
{
@@ -226,7 +224,7 @@ struct is_incidence_graph
template < typename Graph >
struct is_bidirectional_graph
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_traits< Graph >::traversal_category,
bidirectional_graph_tag >::value >
{
@@ -234,7 +232,7 @@ struct is_bidirectional_graph
template < typename Graph >
struct is_vertex_list_graph
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_traits< Graph >::traversal_category,
vertex_list_graph_tag >::value >
{
@@ -242,7 +240,7 @@ struct is_vertex_list_graph
template < typename Graph >
struct is_edge_list_graph
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_traits< Graph >::traversal_category,
edge_list_graph_tag >::value >
{
@@ -250,7 +248,7 @@ struct is_edge_list_graph
template < typename Graph >
struct is_adjacency_matrix
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_traits< Graph >::traversal_category,
adjacency_matrix_tag >::value >
{
@@ -265,14 +263,17 @@ struct is_adjacency_matrix
//@{
template < typename Graph >
struct is_directed_unidirectional_graph
: mpl::and_< is_directed_graph< Graph >,
mpl::not_< is_bidirectional_graph< Graph > > >
: std::integral_constant< bool,
is_directed_graph< Graph >::value
&& !is_bidirectional_graph< Graph >::value >
{
};
template < typename Graph >
struct is_directed_bidirectional_graph
: mpl::and_< is_directed_graph< Graph >, is_bidirectional_graph< Graph > >
: std::integral_constant< bool,
is_directed_graph< Graph >::value
&& is_bidirectional_graph< Graph >::value >
{
};
//@}
@@ -282,40 +283,47 @@ typedef boost::forward_traversal_tag multi_pass_input_iterator_tag;
namespace detail
{
BOOST_MPL_HAS_XXX_TRAIT_DEF(graph_property_type)
BOOST_MPL_HAS_XXX_TRAIT_DEF(edge_property_type)
BOOST_MPL_HAS_XXX_TRAIT_DEF(vertex_property_type)
template < typename G > struct get_graph_property_type
// When the member type is present these expose it as ::type
// when absent they inherit no_property and expose no nested ::type.
template < typename G, typename = void >
struct get_graph_property_type : no_property
{
typedef typename G::graph_property_type type;
};
template < typename G > struct get_edge_property_type
template < typename G >
struct get_graph_property_type< G, boost::void_t< typename G::graph_property_type > >
{
typedef typename G::edge_property_type type;
using type = typename G::graph_property_type;
};
template < typename G > struct get_vertex_property_type
template < typename G, typename = void >
struct get_edge_property_type : no_property
{
typedef typename G::vertex_property_type type;
};
template < typename G >
struct get_edge_property_type< G, boost::void_t< typename G::edge_property_type > >
{
using type = typename G::edge_property_type;
};
template < typename G, typename = void >
struct get_vertex_property_type : no_property
{
};
template < typename G >
struct get_vertex_property_type< G, boost::void_t< typename G::vertex_property_type > >
{
using type = typename G::vertex_property_type;
};
}
template < typename G >
struct graph_property_type
: boost::mpl::eval_if< detail::has_graph_property_type< G >,
detail::get_graph_property_type< G >, no_property >
struct graph_property_type : detail::get_graph_property_type< G >
{
};
template < typename G >
struct edge_property_type
: boost::mpl::eval_if< detail::has_edge_property_type< G >,
detail::get_edge_property_type< G >, no_property >
struct edge_property_type : detail::get_edge_property_type< G >
{
};
template < typename G >
struct vertex_property_type
: boost::mpl::eval_if< detail::has_vertex_property_type< G >,
detail::get_vertex_property_type< G >, no_property >
struct vertex_property_type : detail::get_vertex_property_type< G >
{
};
@@ -341,7 +349,8 @@ namespace graph
template < typename Graph, typename Descriptor > class bundled_result
{
typedef typename graph_traits< Graph >::vertex_descriptor Vertex;
typedef typename mpl::if_c< (is_same< Descriptor, Vertex >::value),
typedef typename std::conditional<
(is_same< Descriptor, Vertex >::value),
vertex_bundle_type< Graph >, edge_bundle_type< Graph > >::type
bundler;
@@ -367,7 +376,8 @@ namespace graph_detail
// A helper metafunction for determining whether or not a type is
// bundled.
template < typename T >
struct is_no_bundle : mpl::bool_< is_same< T, no_property >::value >
struct is_no_bundle
: std::integral_constant< bool, is_same< T, no_property >::value >
{
};
} // namespace graph_detail
@@ -380,43 +390,49 @@ namespace graph_detail
//@{
template < typename Graph >
struct has_graph_property
: mpl::not_< typename detail::is_no_property<
typename graph_property_type< Graph >::type >::type >::type
: std::integral_constant< bool,
!detail::is_no_property<
typename graph_property_type< Graph >::type >::value >
{
};
template < typename Graph >
struct has_bundled_graph_property
: mpl::not_<
graph_detail::is_no_bundle< typename graph_bundle_type< Graph >::type > >
: std::integral_constant< bool,
!graph_detail::is_no_bundle<
typename graph_bundle_type< Graph >::type >::value >
{
};
template < typename Graph >
struct has_vertex_property
: mpl::not_< typename detail::is_no_property<
typename vertex_property_type< Graph >::type > >::type
: std::integral_constant< bool,
!detail::is_no_property<
typename vertex_property_type< Graph >::type >::value >
{
};
template < typename Graph >
struct has_bundled_vertex_property
: mpl::not_<
graph_detail::is_no_bundle< typename vertex_bundle_type< Graph >::type > >
: std::integral_constant< bool,
!graph_detail::is_no_bundle<
typename vertex_bundle_type< Graph >::type >::value >
{
};
template < typename Graph >
struct has_edge_property
: mpl::not_< typename detail::is_no_property<
typename edge_property_type< Graph >::type > >::type
: std::integral_constant< bool,
!detail::is_no_property<
typename edge_property_type< Graph >::type >::value >
{
};
template < typename Graph >
struct has_bundled_edge_property
: mpl::not_<
graph_detail::is_no_bundle< typename edge_bundle_type< Graph >::type > >
: std::integral_constant< bool,
!graph_detail::is_no_bundle<
typename edge_bundle_type< Graph >::type >::value >
{
};
//@}
+14 -20
View File
@@ -15,16 +15,13 @@
#include <boost/config.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/any.hpp>
#include <boost/mp11/algorithm.hpp>
#include <boost/mp11/list.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dll_import_export.hpp>
#include <boost/graph/exception.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/find.hpp>
#include <boost/mpl/for_each.hpp>
#include <boost/property_map/dynamic_property_map.hpp>
#include <boost/property_tree/detail/xml_parser_utils.hpp>
#include <boost/throw_exception.hpp>
@@ -111,7 +108,7 @@ public:
bool type_found = false;
try
{
mpl::for_each< value_types >(
mp11::mp_for_each< value_types >(
put_property< MutableGraph*, value_types >(name, m_dp, &m_g,
value, value_type, m_type_names, type_found));
}
@@ -133,7 +130,7 @@ public:
bool type_found = false;
try
{
mpl::for_each< value_types >(
mp11::mp_for_each< value_types >(
put_property< vertex_descriptor, value_types >(name, m_dp,
any_cast< vertex_descriptor >(vertex), value, value_type,
m_type_names, type_found));
@@ -156,7 +153,7 @@ public:
bool type_found = false;
try
{
mpl::for_each< value_types >(
mp11::mp_for_each< value_types >(
put_property< edge_descriptor, value_types >(name, m_dp,
any_cast< edge_descriptor >(edge), value, value_type,
m_type_names, type_found));
@@ -192,8 +189,7 @@ public:
template < class Value > void operator()(Value)
{
if (m_value_type
== m_type_names[mpl::find< ValueVector,
Value >::type::pos::value])
== m_type_names[mp11::mp_find< ValueVector, Value >::value])
{
put(m_name, m_dp, m_key, lexical_cast< Value >(m_value));
m_type_found = true;
@@ -213,8 +209,7 @@ public:
protected:
MutableGraph& m_g;
dynamic_properties& m_dp;
typedef mpl::vector< bool, int, long, float, double, std::string >
value_types;
using value_types = mp11::mp_list< bool, int, long, float, double, std::string >;
static const char* m_type_names[];
};
@@ -244,8 +239,7 @@ public:
template < typename Type > void operator()(Type)
{
if (typeid(Type) == m_type)
m_type_name
= m_type_names[mpl::find< Types, Type >::type::pos::value];
m_type_name = m_type_names[mp11::mp_find< Types, Type >::value];
}
private:
@@ -275,10 +269,9 @@ void write_graphml(std::ostream& out, const Graph& g,
"xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns "
"http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd\">\n";
typedef mpl::vector< bool, short, unsigned short, int, unsigned int, long,
unsigned long, long long, unsigned long long, float, double,
long double, std::string >
value_types;
using value_types = mp11::mp_list< bool, short,
unsigned short, int, unsigned int, long, unsigned long, long long,
unsigned long long, float, double, long double, std::string >;
const char* type_names[] = { "boolean", "int", "int", "int", "int", "long",
"long", "long", "long", "float", "double", "double", "string" };
std::map< std::string, std::string > graph_key_ids;
@@ -299,8 +292,9 @@ void write_graphml(std::ostream& out, const Graph& g,
else
continue;
std::string type_name = "string";
mpl::for_each< value_types >(get_type_name< value_types >(
i->second->value(), type_names, type_name));
mp11::mp_for_each< value_types >(
get_type_name< value_types >(
i->second->value(), type_names, type_name));
out << " <key id=\"" << encode_char_entities(key_id) << "\" for=\""
<< (i->second->key() == typeid(Graph*)
? "graph"
+2 -3
View File
@@ -34,7 +34,6 @@
#include <boost/static_assert.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/xpressive/xpressive_static.hpp>
#include <boost/foreach.hpp>
namespace boost
{
@@ -843,13 +842,13 @@ namespace detail
edge_permutation_from_sorting[temp[e]] = e;
}
typedef boost::tuple< id_t, bgl_vertex_t, id_t > v_prop;
BOOST_FOREACH (const v_prop& t, vertex_props)
for (const v_prop& t : vertex_props)
{
put(boost::get< 0 >(t), dp_, boost::get< 1 >(t),
boost::get< 2 >(t));
}
typedef boost::tuple< id_t, bgl_edge_t, id_t > e_prop;
BOOST_FOREACH (const e_prop& t, edge_props)
for (const e_prop& t : edge_props)
{
put(boost::get< 0 >(t), dp_,
edge_permutation_from_sorting[boost::get< 1 >(t)],
+21 -22
View File
@@ -9,15 +9,14 @@
#include <algorithm>
#include <boost/assert.hpp>
#include <boost/foreach.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/one_bit_color_map.hpp>
#include <boost/graph/properties.hpp>
#include <boost/move/utility.hpp>
#include <boost/property_map/property_map.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/iterator.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/tuple/tuple.hpp> // for boost::tie
#include <boost/type_traits/remove_reference.hpp>
#include <boost/utility/result_of.hpp>
@@ -48,11 +47,11 @@ namespace hawick_circuits_detail
template < typename Vertex, typename Graph >
typename result< get_all_adjacent_vertices(
BOOST_FWD_REF(Vertex), BOOST_FWD_REF(Graph)) >::type
operator()(BOOST_FWD_REF(Vertex) v, BOOST_FWD_REF(Graph) g) const
Vertex&&, Graph&&) >::type
operator()(Vertex&& v, Graph&& g) const
{
return adjacent_vertices(
boost::forward< Vertex >(v), boost::forward< Graph >(g));
std::forward< Vertex >(v), std::forward< Graph >(g));
}
};
@@ -134,7 +133,7 @@ namespace hawick_circuits_detail
// documented above.
bool blocked_map_starts_all_unblocked() const
{
BOOST_FOREACH (Vertex v, vertices(graph_))
for (Vertex v : boost::make_iterator_range(vertices(graph_)))
if (is_blocked(v))
return false;
return true;
@@ -144,7 +143,7 @@ namespace hawick_circuits_detail
// sharing data structures between iterations does not break the code.
bool all_closed_rows_are_empty() const
{
BOOST_FOREACH (typename ClosedMatrix::reference row, closed_)
for (typename ClosedMatrix::reference row : closed_)
if (!row.empty())
return false;
return true;
@@ -347,34 +346,34 @@ namespace hawick_circuits_detail
template < typename GetAdjacentVertices, typename Graph, typename Visitor >
void call_hawick_circuits(
Graph const& graph, BOOST_FWD_REF(Visitor) visitor,
Graph const& graph, Visitor&& visitor,
unsigned int max_length)
{
call_hawick_circuits< GetAdjacentVertices >(graph,
boost::forward< Visitor >(visitor), get(vertex_index, graph),
std::forward< Visitor >(visitor), get(vertex_index, graph),
max_length);
}
} // end namespace hawick_circuits_detail
//! Enumerate all the elementary circuits in a directed multigraph.
template < typename Graph, typename Visitor, typename VertexIndexMap >
void hawick_circuits(BOOST_FWD_REF(Graph) graph, BOOST_FWD_REF(Visitor) visitor,
BOOST_FWD_REF(VertexIndexMap) vertex_index_map,
void hawick_circuits(Graph&& graph, Visitor&& visitor,
VertexIndexMap&& vertex_index_map,
unsigned int max_length = 0)
{
hawick_circuits_detail::call_hawick_circuits<
hawick_circuits_detail::get_all_adjacent_vertices >(
boost::forward< Graph >(graph), boost::forward< Visitor >(visitor),
boost::forward< VertexIndexMap >(vertex_index_map), max_length);
std::forward< Graph >(graph), std::forward< Visitor >(visitor),
std::forward< VertexIndexMap >(vertex_index_map), max_length);
}
template < typename Graph, typename Visitor >
void hawick_circuits(BOOST_FWD_REF(Graph) graph, BOOST_FWD_REF(Visitor) visitor,
void hawick_circuits(Graph&& graph, Visitor&& visitor,
unsigned int max_length = 0)
{
hawick_circuits_detail::call_hawick_circuits<
hawick_circuits_detail::get_all_adjacent_vertices >(
boost::forward< Graph >(graph), boost::forward< Visitor >(visitor),
std::forward< Graph >(graph), std::forward< Visitor >(visitor),
max_length);
}
@@ -383,25 +382,25 @@ void hawick_circuits(BOOST_FWD_REF(Graph) graph, BOOST_FWD_REF(Visitor) visitor,
* edges will not be considered. Each circuit will be considered only once.
*/
template < typename Graph, typename Visitor, typename VertexIndexMap >
void hawick_unique_circuits(BOOST_FWD_REF(Graph) graph,
BOOST_FWD_REF(Visitor) visitor,
BOOST_FWD_REF(VertexIndexMap) vertex_index_map,
void hawick_unique_circuits(Graph&& graph,
Visitor&& visitor,
VertexIndexMap&& vertex_index_map,
unsigned int max_length = 0)
{
hawick_circuits_detail::call_hawick_circuits<
hawick_circuits_detail::get_unique_adjacent_vertices >(
boost::forward< Graph >(graph), boost::forward< Visitor >(visitor),
boost::forward< VertexIndexMap >(vertex_index_map), max_length);
std::forward< Graph >(graph), std::forward< Visitor >(visitor),
std::forward< VertexIndexMap >(vertex_index_map), max_length);
}
template < typename Graph, typename Visitor >
void hawick_unique_circuits(
BOOST_FWD_REF(Graph) graph, BOOST_FWD_REF(Visitor) visitor,
Graph&& graph, Visitor&& visitor,
unsigned int max_length = 0)
{
hawick_circuits_detail::call_hawick_circuits<
hawick_circuits_detail::get_unique_adjacent_vertices >(
boost::forward< Graph >(graph), boost::forward< Visitor >(visitor),
std::forward< Graph >(graph), std::forward< Visitor >(visitor),
max_length);
}
} // end namespace boost
@@ -16,7 +16,6 @@
#include <boost/graph/properties.hpp>
#include <boost/graph/planar_detail/bucket_sort.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <algorithm>
#include <vector>
+7 -6
View File
@@ -10,10 +10,9 @@
#include <boost/config.hpp>
#include <vector>
#include <map>
#include <type_traits>
#include <boost/static_assert.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/unordered_map.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_unsigned.hpp>
@@ -38,7 +37,8 @@ namespace graph_detail
{
/** Returns true if the selector is the default selector. */
template < typename Selector >
struct is_default : mpl::bool_< is_same< Selector, defaultS >::value >
struct is_default
: std::integral_constant< bool, is_same< Selector, defaultS >::value >
{
};
@@ -48,7 +48,8 @@ namespace graph_detail
*/
template < typename Label, typename Vertex > struct choose_default_map
{
typedef typename mpl::if_< is_unsigned< Label >, std::vector< Vertex >,
typedef typename std::conditional< is_unsigned< Label >::value,
std::vector< Vertex >,
std::map< Label, Vertex > // TODO: Should use unordered_map?
>::type type;
};
@@ -111,9 +112,9 @@ namespace graph_detail
template < typename Selector, typename Label, typename Vertex >
struct choose_map
{
typedef typename mpl::eval_if< is_default< Selector >,
typedef typename std::conditional< is_default< Selector >::value,
choose_default_map< Label, Vertex >,
choose_custom_map< Selector, Label, Vertex > >::type type;
choose_custom_map< Selector, Label, Vertex > >::type::type type;
};
/** @name Insert Labeled Vertex */
@@ -10,7 +10,6 @@
#define __FACE_ITERATORS_HPP__
#include <boost/iterator/iterator_facade.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/graph/graph_traits.hpp>
namespace boost
+5 -5
View File
@@ -17,7 +17,7 @@
#include <vector>
#include <map>
#include <boost/config/no_tr1/cmath.hpp>
#include <boost/mpl/if.hpp>
#include <type_traits>
namespace boost
{
@@ -248,15 +248,15 @@ private:
template < typename RandomGenerator, typename Graph >
class plod_iterator
: public mpl::if_<
: public std::conditional<
is_convertible< typename graph_traits< Graph >::directed_category,
directed_tag >,
directed_tag >::value,
out_directed_plod_iterator< RandomGenerator >,
undirected_plod_iterator< RandomGenerator > >::type
{
typedef typename mpl::if_<
typedef typename std::conditional<
is_convertible< typename graph_traits< Graph >::directed_category,
directed_tag >,
directed_tag >::value,
out_directed_plod_iterator< RandomGenerator >,
undirected_plod_iterator< RandomGenerator > >::type inherited;
+10 -12
View File
@@ -23,9 +23,7 @@
#include <boost/graph/graph_traits.hpp>
#include <boost/type_traits.hpp>
#include <boost/limits.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/not.hpp>
#include <boost/mpl/if.hpp>
#include <type_traits>
namespace boost
{
@@ -150,15 +148,15 @@ namespace detail
template < typename G, typename R, typename T >
struct property_kind_from_graph< G, R T::* >
{
typedef typename boost::mpl::if_<
boost::is_base_of< T, typename vertex_bundle_type< G >::type >,
typedef typename std::conditional<
boost::is_base_of< T, typename vertex_bundle_type< G >::type >::value,
vertex_property_tag,
typename boost::mpl::if_<
boost::is_base_of< T, typename edge_bundle_type< G >::type >,
typename std::conditional<
boost::is_base_of< T, typename edge_bundle_type< G >::type >::value,
edge_property_tag,
typename boost::mpl::if_<
typename std::conditional<
boost::is_base_of< T,
typename graph_bundle_type< G >::type >,
typename graph_bundle_type< G >::type >::value,
graph_property_tag, void >::type >::type >::type type;
};
#endif
@@ -232,9 +230,9 @@ namespace detail
template < class Graph, class Property, class Enable = void >
struct property_map
: mpl::if_< is_same< typename detail::property_kind_from_graph< Graph,
Property >::type,
edge_property_tag >,
: std::conditional< is_same< typename detail::property_kind_from_graph< Graph,
Property >::type,
edge_property_tag >::value,
detail::edge_property_map< Graph, Property >,
detail::vertex_property_map< Graph, Property > >::type
{
+2 -2
View File
@@ -20,7 +20,7 @@
#include <boost/property_map/property_map_iterator.hpp>
#include <boost/graph/properties.hpp>
#include <boost/mpl/if.hpp>
#include <type_traits>
#include <boost/type_traits/same_traits.hpp>
namespace boost
@@ -35,7 +35,7 @@ template < class Graph, class PropertyTag > class graph_property_iter_range
typedef
typename property_map< Graph, PropertyTag >::const_type const_map_type;
typedef typename property_kind< PropertyTag >::type Kind;
typedef typename mpl::if_c< is_same< Kind, vertex_property_tag >::value,
typedef typename std::conditional< is_same< Kind, vertex_property_tag >::value,
typename graph_traits< Graph >::vertex_iterator,
typename graph_traits< Graph >::edge_iterator >::type iter;
+2 -2
View File
@@ -22,7 +22,7 @@
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/copy.hpp>
#include <boost/mpl/if.hpp>
#include <type_traits>
#include <boost/type_traits/is_convertible.hpp>
#include <iostream>
@@ -152,7 +152,7 @@ void generate_random_graph1(MutableGraph& g,
typedef
typename boost::graph_traits< MutableGraph >::directed_category dir;
typedef typename mpl::if_< is_convertible< dir, directed_tag >,
typedef typename std::conditional< is_convertible< dir, directed_tag >::value,
directedS, undirectedS >::type select;
adjacency_list< setS, vecS, select > g2;
generate_random_graph1(g2, V, E, gen, true, self_edges);
-1
View File
@@ -14,7 +14,6 @@
#include <boost/random/uniform_01.hpp>
#include <boost/random/uniform_real.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/mpl/if.hpp>
#include <boost/graph/iteration_macros.hpp>
namespace boost
+9 -9
View File
@@ -11,7 +11,7 @@
#include <boost/iterator/transform_iterator.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/type_traits.hpp>
#include <boost/mpl/if.hpp>
#include <type_traits>
namespace boost
{
@@ -477,15 +477,15 @@ struct property_map< reverse_graph< BidirGraph, GRef >, Property >
is_edge_prop;
typedef boost::is_const< typename boost::remove_reference< GRef >::type >
is_ref_const;
typedef typename boost::mpl::if_< is_ref_const,
typedef typename std::conditional< is_ref_const::value,
typename property_map< BidirGraph, Property >::const_type,
typename property_map< BidirGraph, Property >::type >::type orig_type;
typedef typename property_map< BidirGraph, Property >::const_type
orig_const_type;
typedef typename boost::mpl::if_< is_edge_prop,
typedef typename std::conditional< is_edge_prop::value,
detail::reverse_graph_edge_property_map< orig_type >, orig_type >::type
type;
typedef typename boost::mpl::if_< is_edge_prop,
typedef typename std::conditional< is_edge_prop::value,
detail::reverse_graph_edge_property_map< orig_const_type >,
orig_const_type >::type const_type;
};
@@ -499,7 +499,7 @@ struct property_map< const reverse_graph< BidirGraph, GRef >, Property >
is_edge_prop;
typedef typename property_map< BidirGraph, Property >::const_type
orig_const_type;
typedef typename boost::mpl::if_< is_edge_prop,
typedef typename std::conditional< is_edge_prop::value,
detail::reverse_graph_edge_property_map< orig_const_type >,
orig_const_type >::type const_type;
typedef const_type type;
@@ -585,11 +585,11 @@ public:
typedef detail::underlying_edge_desc_map_type< ed > const_type;
};
template < typename T > struct is_reverse_graph : boost::mpl::false_
template < typename T > struct is_reverse_graph : std::false_type
{
};
template < typename G, typename R >
struct is_reverse_graph< reverse_graph< G, R > > : boost::mpl::true_
struct is_reverse_graph< reverse_graph< G, R > > : std::true_type
{
};
@@ -641,8 +641,8 @@ inline void set_property(const reverse_graph< BidirectionalGraph, GRef >& g,
}
template < typename BidirectionalGraph, typename GRef, typename Tag >
inline typename boost::mpl::if_<
boost::is_const< typename boost::remove_reference< GRef >::type >,
inline typename std::conditional<
boost::is_const< typename boost::remove_reference< GRef >::type >::value,
const typename graph_property< BidirectionalGraph, Tag >::type&,
typename graph_property< BidirectionalGraph, Tag >::type& >::type
get_property(const reverse_graph< BidirectionalGraph, GRef >& g, Tag tag)
+19 -13
View File
@@ -25,8 +25,7 @@
#include <boost/static_assert.hpp>
#include <boost/assert.hpp>
#include <boost/type_traits.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/or.hpp>
#include <type_traits>
namespace boost
{
@@ -207,12 +206,14 @@ public:
vertex_descriptor global_to_local(vertex_descriptor u_global) const
{
vertex_descriptor u_local;
bool in_subgraph;
if (is_root())
return u_global;
vertex_descriptor u_local;
bool in_subgraph;
boost::tie(u_local, in_subgraph) = this->find_vertex(u_global);
BOOST_ASSERT(in_subgraph == true);
BOOST_ASSERT_MSG(in_subgraph,
"global_to_local: vertex is not in this subgraph. "
"Use find_vertex() to check membership first.");
return u_local;
}
@@ -225,10 +226,15 @@ public:
edge_descriptor global_to_local(edge_descriptor e_global) const
{
return is_root() ? e_global
: (*m_local_edge.find(
get(get(edge_index, root().m_graph), e_global)))
.second;
if (is_root())
return e_global;
edge_descriptor e_local;
bool in_subgraph;
boost::tie(e_local, in_subgraph) = this->find_edge(e_global);
BOOST_ASSERT_MSG(in_subgraph,
"global_to_local: edge is not in this subgraph. "
"Use find_edge() to check membership first.");
return e_local;
}
// Is vertex u (of the root graph) contained in this subgraph?
@@ -886,8 +892,8 @@ class subgraph_global_property_map
typedef property_traits< PropertyMap > Traits;
public:
typedef typename mpl::if_<
is_const< typename remove_pointer< GraphPtr >::type >,
typedef typename std::conditional<
is_const< typename remove_pointer< GraphPtr >::type >::value,
readable_property_map_tag, typename Traits::category >::type category;
typedef typename Traits::value_type value_type;
typedef typename Traits::key_type key_type;
@@ -919,8 +925,8 @@ class subgraph_local_property_map
typedef property_traits< PropertyMap > Traits;
public:
typedef typename mpl::if_<
is_const< typename remove_pointer< GraphPtr >::type >,
typedef typename std::conditional<
is_const< typename remove_pointer< GraphPtr >::type >::value,
readable_property_map_tag, typename Traits::category >::type category;
typedef typename Traits::value_type value_type;
typedef typename Traits::key_type key_type;
+19 -18
View File
@@ -13,8 +13,7 @@
#include <boost/algorithm/minmax.hpp>
#include <boost/config.hpp> // For BOOST_STATIC_CONSTANT
#include <boost/config/no_tr1/cmath.hpp>
#include <boost/math/constants/constants.hpp> // For root_two
#include <boost/math/special_functions/hypot.hpp>
#include <cmath>
#include <boost/random/uniform_01.hpp>
#include <boost/random/linear_congruential.hpp>
#include <boost/shared_ptr.hpp>
@@ -155,7 +154,7 @@ public:
for (std::size_t i = 0; i < Dims; ++i)
{
double diff = b[i] - a[i];
dist = boost::math::hypot(dist, diff);
dist = std::hypot(dist, diff);
}
// Exact properties of the distance are not important, as long as
// < on what this returns matches real distances; l_2 is used because
@@ -209,7 +208,7 @@ public:
{
double n = 0.;
for (std::size_t i = 0; i < Dims; ++i)
n = boost::math::hypot(n, delta[i]);
n = std::hypot(n, delta[i]);
return n;
}
@@ -476,7 +475,7 @@ public:
BOOST_USING_STD_MAX();
double r = 0.;
for (std::size_t i = 0; i < Dims; ++i)
r = boost::math::hypot(r, a[i]);
r = std::hypot(r, a[i]);
if (r <= radius)
return a;
double scaling_factor = radius / r;
@@ -490,7 +489,7 @@ public:
{
double r = 0.;
for (std::size_t i = 0; i < Dims; ++i)
r = boost::math::hypot(r, a[i]);
r = std::hypot(r, a[i]);
return radius - r;
}
@@ -560,6 +559,8 @@ template < typename RandomNumberGenerator = minstd_rand > class heart_topology
// Circle centered at (500, -500) radius 500*sqrt(2)
// Bounding box (-1000, -2000) - (1000, 500*(sqrt(2) - 1))
static constexpr double root_two = 1.41421356237309504880; // sqrt(2)
struct point
{
point()
@@ -590,11 +591,11 @@ template < typename RandomNumberGenerator = minstd_rand > class heart_topology
return false; // Bottom
if (p[1] <= -1000)
return true; // Diagonal of square
if (boost::math::hypot(p[0] - -500, p[1] - -500)
<= 500. * boost::math::constants::root_two< double >())
if (std::hypot(p[0] - -500, p[1] - -500)
<= 500. * root_two)
return true; // Left circle
if (boost::math::hypot(p[0] - 500, p[1] - -500)
<= 500. * boost::math::constants::root_two< double >())
if (std::hypot(p[0] - 500, p[1] - -500)
<= 500. * root_two)
return true; // Right circle
return false;
}
@@ -635,12 +636,12 @@ public:
{
result[0] = (*rand)()
* (1000
+ 1000 * boost::math::constants::root_two< double >())
- (500 + 500 * boost::math::constants::root_two< double >());
+ 1000 * root_two)
- (500 + 500 * root_two);
result[1] = (*rand)()
* (2000
+ 500
* (boost::math::constants::root_two< double >()
* (root_two
- 1))
- 2000;
} while (!in_heart(result));
@@ -655,13 +656,13 @@ public:
if (segment_within_heart(a, b))
{
// Straight line
return boost::math::hypot(b[0] - a[0], b[1] - a[1]);
return std::hypot(b[0] - a[0], b[1] - a[1]);
}
else
{
// Straight line bending around (0, 0)
return boost::math::hypot(a[0], a[1])
+ boost::math::hypot(b[0], b[1]);
return std::hypot(a[0], a[1])
+ std::hypot(b[0], b[1]);
}
}
@@ -675,8 +676,8 @@ public:
}
else
{
double distance_to_point_a = boost::math::hypot(a[0], a[1]);
double distance_to_point_b = boost::math::hypot(b[0], b[1]);
double distance_to_point_a = std::hypot(a[0], a[1]);
double distance_to_point_b = std::hypot(b[0], b[1]);
double location_of_point = distance_to_point_a
/ (distance_to_point_a + distance_to_point_b);
if (fraction < location_of_point)
-1
View File
@@ -12,7 +12,6 @@
#include <boost/pending/property.hpp>
#include <boost/property_map/transform_value_property_map.hpp>
#include <boost/type_traits.hpp>
#include <boost/mpl/if.hpp>
namespace boost
{
+13 -13
View File
@@ -32,7 +32,7 @@
#include <boost/graph/mcgregor_common_subgraphs.hpp> // for always_equivalent
#include <boost/graph/named_function_params.hpp>
#include <boost/type_traits/has_less.hpp>
#include <boost/mpl/int.hpp>
#include <type_traits>
#include <boost/range/algorithm/sort.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/utility/enable_if.hpp>
@@ -450,21 +450,21 @@ namespace detail
// test terminal set counts when testing for:
// - graph sub-graph monomorphism, or
inline bool comp_term_sets(graph1_size_type a, graph2_size_type b,
boost::mpl::int_< subgraph_mono >) const
std::integral_constant< int, subgraph_mono >) const
{
return a <= b;
}
// - graph sub-graph isomorphism, or
inline bool comp_term_sets(graph1_size_type a, graph2_size_type b,
boost::mpl::int_< subgraph_iso >) const
std::integral_constant< int, subgraph_iso >) const
{
return a <= b;
}
// - graph isomorphism
inline bool comp_term_sets(graph1_size_type a, graph2_size_type b,
boost::mpl::int_< isomorphism >) const
std::integral_constant< int, isomorphism >) const
{
return a == b;
}
@@ -652,22 +652,22 @@ namespace detail
if (problem_selection != subgraph_mono)
{ // subgraph_iso and isomorphism
return comp_term_sets(term_in1_count, term_in2_count,
boost::mpl::int_< problem_selection >())
std::integral_constant< int, problem_selection >())
&& comp_term_sets(term_out1_count, term_out2_count,
boost::mpl::int_< problem_selection >())
std::integral_constant< int, problem_selection >())
&& comp_term_sets(rest1_count, rest2_count,
boost::mpl::int_< problem_selection >());
std::integral_constant< int, problem_selection >());
}
else
{ // subgraph_mono
return comp_term_sets(term_in1_count, term_in2_count,
boost::mpl::int_< problem_selection >())
std::integral_constant< int, problem_selection >())
&& comp_term_sets(term_out1_count, term_out2_count,
boost::mpl::int_< problem_selection >())
std::integral_constant< int, problem_selection >())
&& comp_term_sets(
term_in1_count + term_out1_count + rest1_count,
term_in2_count + term_out2_count + rest2_count,
boost::mpl::int_< problem_selection >());
std::integral_constant< int, problem_selection >());
}
}
@@ -718,13 +718,13 @@ namespace detail
return comp_term_sets(boost::get< 0 >(term1),
boost::get< 0 >(term2),
boost::mpl::int_< problem_selection >())
std::integral_constant< int, problem_selection >())
&& comp_term_sets(boost::get< 1 >(term1),
boost::get< 1 >(term2),
boost::mpl::int_< problem_selection >())
std::integral_constant< int, problem_selection >())
&& comp_term_sets(boost::get< 2 >(term1),
boost::get< 2 >(term2),
boost::mpl::int_< problem_selection >());
std::integral_constant< int, problem_selection >());
}
// Calls the user_callback with a graph (sub)graph mapping
+5 -5
View File
@@ -16,7 +16,7 @@
#include <iosfwd>
#include <boost/config.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/bool.hpp>
#include <type_traits>
#include <boost/property_map/property_map.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/limits.hpp>
@@ -220,13 +220,13 @@ struct null_visitor : public base_visitor< null_visitor >
namespace detail
{
template < class Visitor, class T, class Graph >
inline void invoke_dispatch(Visitor& v, T x, Graph& g, mpl::true_)
inline void invoke_dispatch(Visitor& v, T x, Graph& g, std::true_type)
{
v(x, g);
}
template < class Visitor, class T, class Graph >
inline void invoke_dispatch(Visitor&, T, Graph&, mpl::false_)
inline void invoke_dispatch(Visitor&, T, Graph&, std::false_type)
{
}
} // namespace detail
@@ -236,7 +236,7 @@ inline void invoke_visitors(
std::pair< Visitor, Rest >& vlist, T x, Graph& g, Tag tag)
{
typedef typename Visitor::event_filter Category;
typedef typename is_same< Category, Tag >::type IsSameTag;
typedef typename std::is_same< Category, Tag >::type IsSameTag;
detail::invoke_dispatch(vlist.first, x, g, IsSameTag());
invoke_visitors(vlist.second, x, g, tag);
}
@@ -244,7 +244,7 @@ template < class Visitor, class T, class Graph, class Tag >
inline void invoke_visitors(Visitor& v, T x, Graph& g, Tag)
{
typedef typename Visitor::event_filter Category;
typedef typename is_same< Category, Tag >::type IsSameTag;
typedef typename std::is_same< Category, Tag >::type IsSameTag;
detail::invoke_dispatch(v, x, g, IsSameTag());
}
+6 -6
View File
@@ -7,9 +7,8 @@
#define BOOST_PROPERTY_HPP
#include <boost/config.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/has_xxx.hpp>
#include <type_traits>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -256,10 +255,10 @@ template < typename T, typename Tag > struct lookup_one_property< const T, Tag >
// instead with a nested kind type and num. Also, we may want to
// switch BGL back to using class types for properties at some point.
template < class P > struct has_property : boost::mpl::true_
template < class P > struct has_property : std::true_type
{
};
template <> struct has_property< no_property > : boost::mpl::false_
template <> struct has_property< no_property > : std::false_type
{
};
@@ -294,7 +293,8 @@ namespace detail
/** This trait returns true if T is no_property. */
template < typename T >
struct is_no_property : mpl::bool_< is_same< T, no_property >::value >
struct is_no_property
: std::integral_constant< bool, is_same< T, no_property >::value >
{
};
@@ -358,7 +358,7 @@ namespace detail
typedef typename boost::function_traits< F >::arg1_type a1;
typedef typename boost::remove_reference< a1 >::type non_ref;
typedef typename non_ref::next_type nx;
typedef typename boost::mpl::if_< boost::is_const< non_ref >,
typedef typename std::conditional< boost::is_const< non_ref >::value,
boost::add_const< nx >, nx >::type with_const;
typedef typename boost::add_reference< with_const >::type type;
};
+9 -10
View File
@@ -11,7 +11,6 @@
// Tiago de Paula Peixoto
#define BOOST_GRAPH_SOURCE
#include <boost/foreach.hpp>
#include <boost/optional.hpp>
#include <boost/throw_exception.hpp>
#include <boost/graph/graphml.hpp>
@@ -44,7 +43,7 @@ public:
using boost::property_tree::ptree;
size_t current_idx = 0;
bool is_first = is_root;
BOOST_FOREACH (const ptree::value_type& n, top)
for (const ptree::value_type& n : top)
{
if (n.first == "graph")
{
@@ -54,7 +53,7 @@ public:
if (is_first)
{
is_first = false;
BOOST_FOREACH (const ptree::value_type& attr, n.second)
for (const ptree::value_type& attr : n.second)
{
if (attr.first != "data")
continue;
@@ -83,7 +82,7 @@ public:
| boost::property_tree::xml_parser::trim_whitespace);
ptree gml = pt.get_child(path("graphml"));
// Search for attributes
BOOST_FOREACH (const ptree::value_type& child, gml)
for (const ptree::value_type& child : gml)
{
if (child.first != "key")
continue;
@@ -127,17 +126,17 @@ public:
std::vector< const ptree* > graphs;
handle_graph();
get_graphs(gml, desired_idx, true, graphs);
BOOST_FOREACH (const ptree* gr, graphs)
for (const ptree* gr : graphs)
{
// Search for nodes
BOOST_FOREACH (const ptree::value_type& node, *gr)
for (const ptree::value_type& node : *gr)
{
if (node.first != "node")
continue;
std::string id
= node.second.get< std::string >(path("<xmlattr>/id"));
handle_vertex(id);
BOOST_FOREACH (const ptree::value_type& attr, node.second)
for (const ptree::value_type& attr : node.second)
{
if (attr.first != "data")
continue;
@@ -148,13 +147,13 @@ public:
}
}
}
BOOST_FOREACH (const ptree* gr, graphs)
for (const ptree* gr : graphs)
{
bool default_directed
= gr->get< std::string >(path("<xmlattr>/edgedefault"))
== "directed";
// Search for edges
BOOST_FOREACH (const ptree::value_type& edge, *gr)
for (const ptree::value_type& edge : *gr)
{
if (edge.first != "edge")
continue;
@@ -180,7 +179,7 @@ public:
}
size_t old_edges_size = m_edge.size();
handle_edge(source, target);
BOOST_FOREACH (const ptree::value_type& attr, edge.second)
for (const ptree::value_type& attr : edge.second)
{
if (attr.first != "data")
continue;
-156
View File
@@ -1,156 +0,0 @@
find_package(Boost 1.90.0 REQUIRED COMPONENTS filesystem serialization)
# These use Boost.Core's lightweight_test, one main() function per file.
set(TEST_SOURCES
adj_list_cc.cpp
adj_list_edge_list_set.cpp
# adj_list_invalidation.cpp # ?
adj_list_loops.cpp
adj_matrix_cc.cpp
adjacency_matrix_test.cpp
astar_search_test.cpp
basic_planarity_test.cpp
bellman-test.cpp
betweenness_centrality_test.cpp
bfs.cpp
bfs_cc.cpp
biconnected_components_test.cpp
bidir_remove_edge.cpp
# bidir_vec_remove_edge.cpp # Not tested in Jamfile, fails to compile.
bipartite_test.cpp
boykov_kolmogorov_max_flow_test.cpp
bron_kerbosch_all_cliques.cpp
bundled_properties.cpp
closeness_centrality.cpp
clustering_coefficient.cpp
copy.cpp
core_numbers_test.cpp
csr_graph_test.cpp
cuthill_mckee_ordering.cpp
cycle_canceling_test.cpp
cycle_ratio_tests.cpp
dag_longest_paths.cpp
degree_centrality.cpp
delete_edge.cpp
dfs.cpp
dfs_cc.cpp
dijkstra_cc.cpp
dijkstra_no_color_map_compare.cpp
dimacs.cpp
disjoint_set_test.cpp
dominator_tree_test.cpp
eccentricity.cpp
edge_list_cc.cpp
filter_graph_vp_test.cpp
filtered_graph_cc.cpp
# filtered_graph_properties_dijkstra.cpp # Compile-only, no link test??
find_flow_cost_bundled_properties_and_named_params_test.cpp
finish_edge_bug.cpp
floyd_warshall_test.cpp
generator_test.cpp
graph_concepts.cpp
graphml_test.cpp
graphviz_test.cpp
grid_graph_cc.cpp
grid_graph_test.cpp
gursoy_atun_layout_test.cpp
hawick_circuits.cpp
incremental_components_test.cpp
index_graph.cpp
is_straight_line_draw_test.cpp
isomorphism.cpp
johnson-test.cpp
king_ordering.cpp
labeled_graph.cpp
layout_test.cpp
lvalue_pmap.cpp
make_bicon_planar_test.cpp
make_connected_test.cpp
make_maximal_planar_test.cpp
mas_test.cpp
matching_test.cpp
max_flow_algorithms_bundled_properties_and_named_params.cpp
max_flow_test.cpp
mcgregor_subgraphs_test.cpp
mean_geodesic.cpp
metis_test.cpp
min_degree_empty.cpp
named_vertices_test.cpp
r_c_shortest_paths_test.cpp
random_matching_test.cpp
random_spanning_tree_test.cpp
rcsp_custom_vertex_id.cpp
rcsp_single_solution.cpp
read_propmap.cpp
# reverse_graph_cc.cpp # compile-only
sequential_vertex_coloring.cpp
# serialize.cpp # Fails to link, but why?
stoer_wagner_test.cpp
strong_components_test.cpp
subgraph.cpp
subgraph_add.cpp
subgraph_bundled.cpp
subgraph_props.cpp
successive_shortest_path_nonnegative_weights_test.cpp
swap.cpp
test_graphs.cpp
tiernan_all_cycles.cpp
# transitive_closure_test.cpp # Benchmark and test, need to separate.
transitive_closure_test2.cpp
two_graphs_common_spanning_trees_test.cpp
undirected_dfs.cpp
undirected_dfs_visitor.cpp
# vector_graph_cc.cpp # compile-only
vf2_sub_graph_iso_test.cpp
vf2_sub_graph_iso_test_2.cpp
weighted_matching_test.cpp
)
foreach(SOURCE ${TEST_SOURCES})
cmake_path(GET SOURCE STEM LAST_ONLY TEST)
add_executable(${TEST} ${SOURCE})
target_link_libraries(${TEST} Boost::graph)
add_test(${TEST} ${TEST})
endforeach()
# graph and property_iter are parameterized.
set(PARAMETERIZED_TEST_SOURCES graph.cpp property_iter.cpp)
set(TEST_PARAMETERS 1 2 3 4 5 6 7 8 9)
foreach(SOURCE ${PARAMETERIZED_TEST_SOURCES})
foreach(PARAMETER ${TEST_PARAMETERS})
cmake_path(GET SOURCE STEM LAST_ONLY TEST)
set(TEST_NAME ${TEST}_${PARAMETER})
add_executable(${TEST_NAME} ${SOURCE})
target_compile_definitions(${TEST_NAME} PUBLIC TEST=${PARAMETER})
target_link_libraries(${TEST_NAME} Boost::graph Boost::serialization)
add_test(${TEST_NAME} ${TEST_NAME})
endforeach()
endforeach()
# NOTE: Following note copied verbatim from Jamfile.v2.
# The tests below started failing to compile for xcode with cxxstd=11
# due to issues with constexpr ctors in Boost.Filesystem
# all_planar_input_files_test.cpp
# parallel_edges_loops_test.cpp
# I don't know if these commercial packages have or will ever have a CMake config.
find_package(LEDA QUIET)
if(LEDA_FOUND)
add_executable(leda_graph_cc leda_graph_cc.cpp)
target_compile_definitions(leda_graph_cc)
target_link_libraries(leda_graph_cc Boost::graph LEDA)
add_test(leda_graph_cc leda_graph_cc)
endif()
find_package(StanfordGraphBase QUIET)
if(StanfordGraphBase_FOUND)
add_executable(stanford_graph_cc stanford_graph_cc.cpp)
target_compile_definitions(stanford_graph_cc)
target_link_libraries(stanford_graph_cc Boost::graph StanfordGraphBase)
add_test(stanford_graph_cc stanford_graph_cc)
endif()
+1
View File
@@ -97,6 +97,7 @@ alias graph_test_regular :
[ run subgraph_bundled.cpp ]
[ run subgraph_add.cpp : $(TEST_DIR) ]
[ run subgraph_props.cpp ]
[ run subgraph_global_local.cpp ]
[ run isomorphism.cpp ]
[ run adjacency_matrix_test.cpp ]
+141
View File
@@ -0,0 +1,141 @@
// Copyright (c) 2026 Arnaud Becheler
// 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/core/lightweight_test.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/subgraph.hpp>
#include <utility>
using namespace boost;
template < typename Directedness >
using subgraph_of = subgraph< adjacency_list< vecS, vecS, Directedness,
property< vertex_color_t, int >,
property< edge_index_t, std::size_t, property< edge_weight_t, int > > > >;
template < typename Directedness >
void test_descriptor_conversion()
{
using graph_t = subgraph_of< Directedness >;
using vertex_t = typename graph_traits< graph_t >::vertex_descriptor;
using edge_t = typename graph_traits< graph_t >::edge_descriptor;
using vertex_iterator = typename graph_traits< graph_t >::vertex_iterator;
using edge_iterator = typename graph_traits< graph_t >::edge_iterator;
// root: path 0-1-2-3, with edge indices assigned in insertion order.
graph_t root(4);
add_edge(0, 1, root); // edge index 0
add_edge(1, 2, root); // edge index 1
add_edge(2, 3, root); // edge index 2
// child g1 = {1, 2, 3}: induces edges (1,2) and (2,3), but not (0,1).
graph_t& g1 = root.create_subgraph();
add_vertex(1, g1);
add_vertex(2, g1);
add_vertex(3, g1);
// grandchild g1a = {2, 3}: induces only edge (2,3).
graph_t& g1a = g1.create_subgraph();
add_vertex(2, g1a);
add_vertex(3, g1a);
// invariant: for an edge in the subgraph, global_to_local(local_to_global(e))
// must equal e, and its edge_index must be preserved.
edge_iterator ei, ei_end;
for (boost::tie(ei, ei_end) = edges(g1); ei != ei_end; ++ei)
{
edge_t e_local = *ei;
edge_t e_round = g1.global_to_local(g1.local_to_global(e_local));
BOOST_TEST(e_round == e_local);
BOOST_TEST(get(edge_index, g1, e_local) == get(edge_index, g1, e_round));
}
// invariant: for a vertex in the subgraph, global_to_local(local_to_global(v))
// must equal v, and its vertex_index must be preserved.
vertex_iterator vi, vi_end;
for (boost::tie(vi, vi_end) = vertices(g1); vi != vi_end; ++vi)
{
vertex_t v_local = *vi;
vertex_t v_round = g1.global_to_local(g1.local_to_global(v_local));
BOOST_TEST(v_round == v_local);
BOOST_TEST(get(vertex_index, g1, v_local) == get(vertex_index, g1, v_round));
}
// invariant: a property written through a child must be readable from the
// root, because the whole tree shares one property store.
edge_t some_local = *edges(g1).first;
put(edge_weight, g1, some_local, 42);
BOOST_TEST(get(edge_weight, root, g1.local_to_global(some_local)) == 42);
// invariant: find_vertex must report a present vertex as true, and an absent
// one as false with a null_vertex() descriptor.
BOOST_TEST(g1.find_vertex(1).second); // vertex 1 is in g1
BOOST_TEST(!g1.find_vertex(0).second); // vertex 0 is not in g1
BOOST_TEST(g1.find_vertex(0).first == graph_traits< graph_t >::null_vertex());
// invariant: find_edge must report false with a default descriptor for a
// root edge that is absent from the subgraph.
edge_t e01 = edge(0, 1, root).first;
BOOST_TEST(get(edge_index, root, e01) == 0u);
BOOST_TEST(g1.find_edge(e01).first == edge_t()); // absent -> default
BOOST_TEST(!g1.find_edge(e01).second); // absent -> false
// invariant: edge round-trip identity must hold at any nesting depth,
// not just for direct children.
for (boost::tie(ei, ei_end) = edges(g1a); ei != ei_end; ++ei)
{
edge_t e_local = *ei;
BOOST_TEST(g1a.global_to_local(g1a.local_to_global(e_local)) == e_local);
}
// invariant: a property written through a grandchild must reach the root.
edge_t g1a_local = *edges(g1a).first;
put(edge_weight, g1a, g1a_local, 7);
BOOST_TEST(get(edge_weight, root, g1a.local_to_global(g1a_local)) == 7);
// invariant: an edge present in the parent but not the grandchild must
// report absent from the grandchild.
edge_t e12 = edge(1, 2, root).first;
BOOST_TEST(!g1a.find_edge(e12).second);
}
// idiom: find_edge is the membership query; global_to_local is the transform to
// run once membership is confirmed.
template < typename Directedness >
void test_membership_query_then_convert()
{
using graph_t = subgraph_of< Directedness >;
using edge_t = typename graph_traits< graph_t >::edge_descriptor;
graph_t root(3);
add_edge(0, 1, root); // edge index 0
add_edge(1, 2, root); // edge index 1
// sg = {1, 2}: induces edge (1,2), but not edge (0,1).
graph_t& sg = root.create_subgraph();
add_vertex(1, sg);
add_vertex(2, sg);
// Present edge: the query confirms membership, then the transform agrees
// with the local descriptor the query returned.
edge_t e12 = edge(1, 2, root).first;
std::pair< edge_t, bool > found = sg.find_edge(e12);
BOOST_TEST(found.second);
BOOST_TEST(sg.global_to_local(e12) == found.first);
// Absent edge: the query reports it, so the transform is not run.
edge_t e01 = edge(0, 1, root).first;
BOOST_TEST(!sg.find_edge(e01).second);
}
int main()
{
test_descriptor_conversion< directedS >();
test_descriptor_conversion< bidirectionalS >();
test_membership_query_then_convert< directedS >();
test_membership_query_then_convert< bidirectionalS >();
return boost::report_errors();
}
+6 -5
View File
@@ -7,6 +7,7 @@
#ifndef TEST_CONSTRUCTION_HPP
#define TEST_CONSTRUCTION_HPP
#include <type_traits>
#include <boost/concept/assert.hpp>
#include <utility>
@@ -25,7 +26,7 @@ void build_graph(Graph& g, Add, Label)
// This matches MutableGraph, so just add some vertices.
template < typename Graph >
void build_graph(Graph& g, boost::mpl::true_, boost::mpl::false_)
void build_graph(Graph& g, std::true_type, std::false_type)
{
using namespace boost;
BOOST_CONCEPT_ASSERT((VertexListGraphConcept< Graph >));
@@ -41,7 +42,7 @@ void build_graph(Graph& g, boost::mpl::true_, boost::mpl::false_)
// This will match labeled graphs.
template < typename Graph >
void build_graph(Graph& g, boost::mpl::false_, boost::mpl::true_)
void build_graph(Graph& g, std::false_type, std::true_type)
{
using namespace boost;
BOOST_CONCEPT_ASSERT((VertexListGraphConcept< Graph >));
@@ -69,7 +70,7 @@ void build_property_graph(Graph const& g, Add, Label)
}
template < typename Graph >
void build_property_graph(Graph const&, boost::mpl::true_, boost::mpl::false_)
void build_property_graph(Graph const&, std::true_type, std::false_type)
{
using namespace boost;
BOOST_CONCEPT_ASSERT((VertexMutablePropertyGraphConcept< Graph >));
@@ -93,7 +94,7 @@ void build_property_graph(Graph const&, boost::mpl::true_, boost::mpl::false_)
*/
//@{
template < typename Graph, typename VertexSet >
void connect_graph(Graph& g, VertexSet const& verts, boost::mpl::false_)
void connect_graph(Graph& g, VertexSet const& verts, std::false_type)
{
using namespace boost;
BOOST_CONCEPT_ASSERT((AdjacencyMatrixConcept< Graph >));
@@ -113,7 +114,7 @@ void connect_graph(Graph& g, VertexSet const& verts, boost::mpl::false_)
}
template < typename Graph, typename VertexSet >
void connect_graph(Graph& g, VertexSet const& verts, boost::mpl::true_)
void connect_graph(Graph& g, VertexSet const& verts, std::true_type)
{
using namespace boost;
BOOST_CONCEPT_ASSERT((AdjacencyMatrixConcept< Graph >));
+5 -4
View File
@@ -7,6 +7,7 @@
#ifndef TEST_DESTRUCTION_HPP
#define TEST_DESTRUCTION_HPP
#include <type_traits>
#include <boost/concept/assert.hpp>
#include <utility>
@@ -23,7 +24,7 @@ void destroy_graph(Graph&, VertexSet const&, Remove, Label)
// This matches MutableGraph, so just remove a vertex and then clear.
template < typename Graph, typename VertexSet >
void destroy_graph(
Graph& g, VertexSet const& verts, boost::mpl::true_, boost::mpl::false_)
Graph& g, VertexSet const& verts, std::true_type, std::false_type)
{
using namespace boost;
BOOST_CONCEPT_ASSERT((VertexListGraphConcept< Graph >));
@@ -38,7 +39,7 @@ void destroy_graph(
// This will match labeled graphs.
template < typename Graph, typename VertexSet >
void destroy_graph(
Graph& g, VertexSet const&, boost::mpl::false_, boost::mpl::true_)
Graph& g, VertexSet const&, std::false_type, std::true_type)
{
using namespace boost;
BOOST_CONCEPT_ASSERT((VertexListGraphConcept< Graph >));
@@ -62,7 +63,7 @@ void destroy_graph(
//@{
template < typename Graph, typename VertexSet >
void disconnect_graph(Graph& g, VertexSet const& verts, boost::mpl::false_)
void disconnect_graph(Graph& g, VertexSet const& verts, std::false_type)
{
using namespace boost;
BOOST_CONCEPT_ASSERT((EdgeListGraphConcept< Graph >));
@@ -90,7 +91,7 @@ void disconnect_graph(Graph& g, VertexSet const& verts, boost::mpl::false_)
}
template < typename Graph, typename VertexSet >
void disconnect_graph(Graph& g, VertexSet const&, boost::mpl::true_)
void disconnect_graph(Graph& g, VertexSet const&, std::true_type)
{
using namespace boost;
BOOST_CONCEPT_ASSERT((EdgeListGraphConcept< Graph >));
+7 -6
View File
@@ -7,6 +7,7 @@
#ifndef TEST_DIRECTION_HPP
#define TEST_DIRECTION_HPP
#include <type_traits>
#include <algorithm>
#include <boost/range.hpp>
#include <boost/concept/assert.hpp>
@@ -17,7 +18,7 @@
//@{
template < typename Graph, typename VertexSet >
void test_outdirected_graph(
Graph const& g, VertexSet const& verts, boost::mpl::true_)
Graph const& g, VertexSet const& verts, std::true_type)
{
using namespace boost;
BOOST_CONCEPT_ASSERT((IncidenceGraphConcept< Graph >));
@@ -53,7 +54,7 @@ void test_outdirected_graph(
}
template < typename Graph, typename VertexSet >
void test_outdirected_graph(Graph const&, VertexSet const&, boost::mpl::false_)
void test_outdirected_graph(Graph const&, VertexSet const&, std::false_type)
{
}
//@}
@@ -64,7 +65,7 @@ void test_outdirected_graph(Graph const&, VertexSet const&, boost::mpl::false_)
//@{
template < typename Graph, typename VertexSet >
void test_indirected_graph(
Graph const& g, VertexSet const& verts, boost::mpl::true_)
Graph const& g, VertexSet const& verts, std::true_type)
{
using namespace boost;
BOOST_CONCEPT_ASSERT((BidirectionalGraphConcept< Graph >));
@@ -96,7 +97,7 @@ void test_indirected_graph(
}
template < typename Graph, typename VertexSet >
void test_indirected_graph(Graph const&, VertexSet const&, boost::mpl::false_)
void test_indirected_graph(Graph const&, VertexSet const&, std::false_type)
{
}
//@}
@@ -106,7 +107,7 @@ void test_indirected_graph(Graph const&, VertexSet const&, boost::mpl::false_)
*/
template < typename Graph, typename VertexSet >
void test_undirected_graph(
Graph const& g, VertexSet const& verts, boost::mpl::true_)
Graph const& g, VertexSet const& verts, std::true_type)
{
using namespace boost;
BOOST_CONCEPT_ASSERT((IncidenceGraphConcept< Graph >));
@@ -134,7 +135,7 @@ void test_undirected_graph(
}
template < typename Graph, typename VertexSet >
void test_undirected_graph(Graph const&, VertexSet const&, boost::mpl::false_)
void test_undirected_graph(Graph const&, VertexSet const&, std::false_type)
{
}
//@}
+7 -6
View File
@@ -7,12 +7,13 @@
#ifndef TEST_PROPERTIES_HPP
#define TEST_PROPERTIES_HPP
#include <type_traits>
#include <boost/concept/assert.hpp>
template < typename T > T const& as_const(T& x) { return x; }
template < typename T > void ignore(T const&) {}
template < typename Graph > void test_graph_bundle(Graph& g, boost::mpl::true_)
template < typename Graph > void test_graph_bundle(Graph& g, std::true_type)
{
using namespace boost;
std::cout << "...test_graph_bundle\n";
@@ -28,7 +29,7 @@ template < typename Graph > void test_graph_bundle(Graph& g, boost::mpl::true_)
ignore(cb2);
}
template < typename Graph > void test_graph_bundle(Graph& g, boost::mpl::false_)
template < typename Graph > void test_graph_bundle(Graph& g, std::false_type)
{
}
@@ -38,7 +39,7 @@ template < typename Graph > void test_graph_bundle(Graph& g, boost::mpl::false_)
*/
//@{
template < typename Graph, typename VertexSet >
void test_vertex_bundle(Graph& g, VertexSet const& verts, boost::mpl::true_)
void test_vertex_bundle(Graph& g, VertexSet const& verts, std::true_type)
{
using namespace boost;
BOOST_CONCEPT_ASSERT((GraphConcept< Graph >));
@@ -68,7 +69,7 @@ void test_vertex_bundle(Graph& g, VertexSet const& verts, boost::mpl::true_)
}
template < typename Graph, typename VertexSet >
void test_vertex_bundle(Graph&, VertexSet const&, boost::mpl::false_)
void test_vertex_bundle(Graph&, VertexSet const&, std::false_type)
{
}
//@}
@@ -79,7 +80,7 @@ void test_vertex_bundle(Graph&, VertexSet const&, boost::mpl::false_)
*/
//@{
template < typename Graph, typename VertexSet >
void test_edge_bundle(Graph& g, VertexSet const& verts, boost::mpl::true_)
void test_edge_bundle(Graph& g, VertexSet const& verts, std::true_type)
{
using namespace boost;
BOOST_CONCEPT_ASSERT((GraphConcept< Graph >));
@@ -110,7 +111,7 @@ void test_edge_bundle(Graph& g, VertexSet const& verts, boost::mpl::true_)
}
template < typename Graph, typename VertexSet >
void test_edge_bundle(Graph&, VertexSet const&, boost::mpl::false_)
void test_edge_bundle(Graph&, VertexSet const&, std::false_type)
{
}
//@}