Compare commits

..

63 Commits

Author SHA1 Message Date
Arnaud Becheler 70dd414ccc Merge pull request #537 from Becheler/refactor/modernize-internal-smart-ptr
refactor: drop direct dependency on Boost.SmartPtr
2026-07-21 15:58:39 +02:00
Arnaud Becheler d10a63bbc0 Merge pull request #536 from ldionne/ldionne-ref-wrapper
[hawick] Support passing std::reference_wrapper to boost::hawick_circuits
2026-07-21 15:56:15 +02:00
Louis Dionne 81ac21073b use = delete 2026-07-21 08:15:19 -04:00
Louis Dionne 8b0ad1300f Remove obsolete C++11 guards 2026-07-21 08:14:01 -04:00
Arnaud Becheler ca4c9dfed1 refactor: remove dead includes and modernize smart ptrs to STL where possible 2026-07-21 12:20:17 +02:00
Louis Dionne c63141b63f [hawick] Support passing std::reference_wrapper to boost::hawick_circuits
Reported as ldionne/hawick_circuits#1.
2026-07-20 13:16:56 -04:00
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
Jeremy W. Murphy 7474f49dde Bump requirement to current version 2026-07-02 09:56:24 +09:00
Jeremy W. Murphy 75fc41afd9 Change indentation for easier review 2026-07-02 09:44:25 +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
Jeremy W. Murphy dbbc4ea619 Merge branch 'develop' into CMake 2026-06-25 19:38:05 +09:00
Jeremy W. Murphy 167e619bbb Merge branch 'develop' into CMake 2026-06-09 07:22:33 +09:00
Jeremy W. Murphy f4cf405962 Use FILE_SET HEADERS and bump to 1.90 2026-03-05 09:05:29 +09:00
Jeremy W. Murphy 13b531b037 Merge branch 'develop' into CMake 2025-10-27 09:11:34 +09:00
Jeremy W. Murphy a4326c3dc1 Merge branch 'develop' into CMake 2025-10-08 07:57:15 +09:00
Jeremy W. Murphy 9eed47ce43 Merge branch 'develop' into CMake 2025-08-18 12:15:37 +09:00
Jeremy W. Murphy d4bf882a4a CMAKE_SOURCE_DIR != CMAKE_CURRENT_SOURCE_DIR == Graph developer 2025-01-03 09:50:33 +11:00
Jeremy W. Murphy 3a51b37063 Merge branch 'develop' into CMake 2024-12-21 09:15:28 +11:00
Jeremy W. Murphy 16660dc68f Fix finding Boost for the unit tests 2024-12-21 09:15:24 +11:00
Jeremy Murphy ed3ad56654 Fix compile and link issues 2024-10-31 14:38:37 +11:00
Jeremy Murphy d3f7d136c4 It uses Boost.Core's lightweight_test, not Boost.Test 2024-10-31 13:21:51 +11:00
Jeremy Murphy 7917600ae4 Split CMake identities: superproject and 'developer' 2024-10-31 11:58:18 +11:00
72 changed files with 1006 additions and 678 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==="
+1 -7
View File
@@ -25,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
@@ -46,13 +43,10 @@ target_link_libraries(boost_graph
Boost::random
Boost::range
Boost::serialization
Boost::smart_ptr
Boost::spirit
Boost::throw_exception
Boost::tti
Boost::tuple
Boost::type_traits
Boost::typeof
Boost::unordered
Boost::utility
Boost::xpressive
+1 -8
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
@@ -36,13 +32,10 @@ constant boost_dependencies :
/boost/random//boost_random
/boost/range//boost_range
/boost/serialization//boost_serialization
/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
@@ -120,4 +120,4 @@ The algorithm is described in detail in https://www.researchgate.net/publication
== Notes
* `hawick_circuits` enumerates all elementary circuits including redundant ones caused by parallel edges. Use `hawick_unique_circuits` to suppress those duplicates.
* The visitor is passed by value. If your visitor contains state, consider holding it by pointer or reference so that changes made during the algorithm are visible to the caller.
* The visitor is passed by value. If your visitor contains state, consider holding it by pointer or reference so that changes made during the algorithm are visible to the caller. If `visitor` is a `std::reference_wrapper`, it will be unwrapped before the `.cycle` method is called on it, which allows passing a visitor that shouldn't be copied.
+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}}
+13 -15
View File
@@ -19,18 +19,15 @@
#include <boost/unordered_set.hpp>
#include <boost/scoped_ptr.hpp>
#include <memory>
#include <boost/graph/graph_traits.hpp>
#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;
};
@@ -407,7 +405,7 @@ public:
#endif
// protected: (would be protected if friends were more portable)
typedef scoped_ptr< graph_property_type > property_ptr;
using property_ptr = std::unique_ptr< graph_property_type >;
property_ptr m_property;
};
+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>
+10 -8
View File
@@ -17,7 +17,7 @@
#include <utility>
#include <boost/assert.hpp>
#include <boost/static_assert.hpp>
#include <boost/shared_array.hpp>
#include <memory>
#include <boost/property_map/property_map.hpp>
// WARNING: it is not safe to copy a d_ary_heap_indirect and then modify one of
@@ -45,23 +45,25 @@ namespace detail
{
template < typename Value > class fixed_max_size_vector
{
boost::shared_array< Value > m_data;
// todo : C++17: replace with std::shared_ptr<T[]>
std::shared_ptr< Value > m_data;
std::size_t m_size;
public:
typedef std::size_t size_type;
fixed_max_size_vector(std::size_t max_size)
: m_data(new Value[max_size]), m_size(0)
: m_data(new Value[max_size], std::default_delete< Value[] >())
, m_size(0)
{
}
std::size_t size() const { return m_size; }
bool empty() const { return m_size == 0; }
Value& operator[](std::size_t i) { return m_data[i]; }
const Value& operator[](std::size_t i) const { return m_data[i]; }
void push_back(Value v) { m_data[m_size++] = v; }
Value& operator[](std::size_t i) { return m_data.get()[i]; }
const Value& operator[](std::size_t i) const { return m_data.get()[i]; }
void push_back(Value v) { m_data.get()[m_size++] = v; }
void pop_back() { --m_size; }
Value& back() { return m_data[m_size - 1]; }
const Value& back() const { return m_data[m_size - 1]; }
Value& back() { return m_data.get()[m_size - 1]; }
const Value& back() const { return m_data.get()[m_size - 1]; }
};
}
+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;
@@ -23,7 +23,7 @@
#include <boost/pending/indirect_cmp.hpp>
#include <boost/graph/exception.hpp>
#include <boost/graph/overloading.hpp>
#include <boost/smart_ptr.hpp>
#include <memory>
#include <boost/graph/detail/d_ary_heap.hpp>
#include <boost/graph/two_bit_color_map.hpp>
#include <boost/graph/detail/mpi_include.hpp>
@@ -237,7 +237,7 @@ namespace detail
{
typedef boost::iterator_property_map< Value*, IndexMap > type;
static type build(const Graph& g, const IndexMap& index,
boost::scoped_array< Value >& array_holder)
std::unique_ptr< Value[] >& array_holder)
{
array_holder.reset(new Value[num_vertices(g)]);
std::fill(array_holder.get(), array_holder.get() + num_vertices(g),
@@ -251,7 +251,7 @@ namespace detail
{
typedef boost::vector_property_map< Value, IndexMap > type;
static type build(const Graph& g, const IndexMap& index,
boost::scoped_array< Value >& array_holder)
std::unique_ptr< Value[] >& array_holder)
{
return boost::make_vector_property_map< Value >(index);
}
@@ -268,7 +268,7 @@ namespace detail
helper;
typedef typename helper::type type;
static type build(const Graph& g, const IndexMap& index,
boost::scoped_array< Value >& array_holder)
std::unique_ptr< Value[] >& array_holder)
{
return helper::build(g, index, array_holder);
}
@@ -368,7 +368,7 @@ inline void dijkstra_shortest_paths_no_init(const Graph& g,
typedef typename graph_traits< Graph >::vertex_descriptor Vertex;
// Now the default: use a d-ary heap
boost::scoped_array< std::size_t > index_in_heap_map_holder;
std::unique_ptr< std::size_t[] > index_in_heap_map_holder;
typedef detail::vertex_property_map_generator< Graph, IndexMap,
std::size_t >
IndexInHeapMapHelper;
@@ -16,6 +16,7 @@
#include <boost/graph/detail/d_ary_heap.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/graph/iteration_macros.hpp>
#include <memory>
namespace boost
{
@@ -51,7 +52,7 @@ void dijkstra_shortest_paths_no_color_map_no_init(const Graph& graph,
DistanceCompare >
VertexQueue;
boost::scoped_array< std::size_t > index_in_heap_map_holder;
std::unique_ptr< std::size_t[] > index_in_heap_map_holder;
IndexInHeapMap index_in_heap = IndexInHeapMapHelper::build(
graph, index_map, index_in_heap_map_holder);
VertexQueue vertex_queue(distance_map, index_in_heap, distance_compare);
-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
{
@@ -13,7 +13,7 @@
#include <boost/assert.hpp>
#include <iterator>
#include <utility>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/random/uniform_int.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/random/geometric_distribution.hpp>
@@ -207,7 +207,7 @@ private:
src = (std::numeric_limits< vertices_size_type >::max)();
}
shared_ptr< uniform_01< RandomGenerator* > > gen;
std::shared_ptr< uniform_01< RandomGenerator* > > gen;
geometric_distribution< vertices_size_type > rand_vertex;
vertices_size_type n;
bool allow_self_loops;
+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)],
@@ -27,7 +27,6 @@
#include <boost/graph/properties.hpp>
#include <boost/random/uniform_01.hpp>
#include <boost/random/linear_congruential.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/graph/breadth_first_search.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/graph/named_function_params.hpp>
+34 -23
View File
@@ -9,18 +9,18 @@
#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>
#include <functional> // for std::reference_wrapper
#include <set>
#include <utility> // for std::pair
#include <vector>
@@ -48,11 +48,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));
}
};
@@ -89,6 +89,16 @@ namespace hawick_circuits_detail
return std::find(boost::begin(c), boost::end(c), v) != boost::end(c);
}
template < typename T >
struct unwrap_reference_wrapper {
typedef T type;
};
template < typename T >
struct unwrap_reference_wrapper<std::reference_wrapper<T> > {
typedef T& type;
};
/*!
* @internal
* Algorithm finding all the cycles starting from a given vertex.
@@ -134,7 +144,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 +154,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;
@@ -314,8 +324,9 @@ namespace hawick_circuits_detail
typedef std::vector< Vertex > Stack;
typedef std::vector< std::vector< Vertex > > ClosedMatrix;
typedef typename unwrap_reference_wrapper<Visitor>::type VisitorNoRef;
typedef hawick_circuits_from< Graph, Visitor, VertexIndexMap, Stack,
typedef hawick_circuits_from< Graph, VisitorNoRef, VertexIndexMap, Stack,
ClosedMatrix, GetAdjacentVertices >
SubAlgorithm;
@@ -347,34 +358,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 +394,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,7 @@
#include <boost/tuple/tuple.hpp>
#include <boost/graph/detail/incremental_components.hpp>
#include <boost/iterator/counting_iterator.hpp>
#include <boost/smart_ptr/make_shared.hpp>
#include <memory>
#include <boost/pending/disjoint_sets.hpp>
#include <iterator>
@@ -126,8 +126,8 @@ public:
component_index(ParentIterator parent_start, ParentIterator parent_end,
const ElementIndexMap& index_map)
: m_num_elements(std::distance(parent_start, parent_end))
, m_components(make_shared< IndexContainer >())
, m_index_list(make_shared< IndexContainer >(m_num_elements))
, m_components(std::make_shared< IndexContainer >())
, m_index_list(std::make_shared< IndexContainer >(m_num_elements))
{
build_index_lists(parent_start, index_map);
@@ -137,8 +137,8 @@ public:
template < typename ParentIterator >
component_index(ParentIterator parent_start, ParentIterator parent_end)
: m_num_elements(std::distance(parent_start, parent_end))
, m_components(make_shared< IndexContainer >())
, m_index_list(make_shared< IndexContainer >(m_num_elements))
, m_components(std::make_shared< IndexContainer >())
, m_index_list(std::make_shared< IndexContainer >(m_num_elements))
{
build_index_lists(parent_start, boost::identity_property_map());
@@ -225,7 +225,7 @@ private:
protected:
IndexType m_num_elements;
shared_ptr< IndexContainer > m_components, m_index_list;
std::shared_ptr< IndexContainer > m_components, m_index_list;
}; // class component_index
@@ -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>
-1
View File
@@ -12,7 +12,6 @@
#include <algorithm>
#include <boost/config.hpp>
#include <boost/assert.hpp>
#include <boost/smart_ptr.hpp>
#include <boost/graph/depth_first_search.hpp>
#include <boost/detail/algorithm.hpp>
#include <boost/unordered_map.hpp>
+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 */
@@ -14,7 +14,7 @@
#include <vector>
#include <stack>
#include <boost/make_shared.hpp>
#include <memory>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/filtered_graph.hpp>
#include <boost/graph/graph_utility.hpp>
@@ -559,7 +559,7 @@ namespace detail
, m_graph2(graph2)
, m_vindex_map1(vindex_map1)
, m_vindex_map2(vindex_map2)
, m_subgraphs(make_shared< SubGraphList >())
, m_subgraphs(std::make_shared< SubGraphList >())
, m_user_callback(user_callback)
{
}
@@ -627,7 +627,7 @@ namespace detail
const GraphFirst& m_graph2;
const VertexIndexMapFirst m_vindex_map1;
const VertexIndexMapSecond m_vindex_map2;
shared_ptr< SubGraphList > m_subgraphs;
std::shared_ptr< SubGraphList > m_subgraphs;
SubGraphCallback m_user_callback;
};
@@ -732,8 +732,8 @@ namespace detail
, m_graph2(graph2)
, m_vindex_map1(vindex_map1)
, m_vindex_map2(vindex_map2)
, m_subgraphs(make_shared< SubGraphList >())
, m_largest_size_so_far(make_shared< VertexSizeFirst >(0))
, m_subgraphs(std::make_shared< SubGraphList >())
, m_largest_size_so_far(std::make_shared< VertexSizeFirst >(0))
, m_user_callback(user_callback)
{
}
@@ -801,8 +801,8 @@ namespace detail
const GraphFirst& m_graph2;
const VertexIndexMapFirst m_vindex_map1;
const VertexIndexMapSecond m_vindex_map2;
shared_ptr< SubGraphList > m_subgraphs;
shared_ptr< VertexSizeFirst > m_largest_size_so_far;
std::shared_ptr< SubGraphList > m_subgraphs;
std::shared_ptr< VertexSizeFirst > m_largest_size_so_far;
SubGraphCallback m_user_callback;
};
@@ -910,8 +910,8 @@ namespace detail
, m_graph2(graph2)
, m_vindex_map1(vindex_map1)
, m_vindex_map2(vindex_map2)
, m_subgraphs(make_shared< SubGraphList >())
, m_largest_size_so_far(make_shared< VertexSizeFirst >(0))
, m_subgraphs(std::make_shared< SubGraphList >())
, m_largest_size_so_far(std::make_shared< VertexSizeFirst >(0))
, m_user_callback(user_callback)
{
}
@@ -996,8 +996,8 @@ namespace detail
const GraphFirst& m_graph2;
const VertexIndexMapFirst m_vindex_map1;
const VertexIndexMapSecond m_vindex_map2;
shared_ptr< SubGraphList > m_subgraphs;
shared_ptr< VertexSizeFirst > m_largest_size_so_far;
std::shared_ptr< SubGraphList > m_subgraphs;
std::shared_ptr< VertexSizeFirst > m_largest_size_so_far;
SubGraphCallback m_user_callback;
};
@@ -28,7 +28,6 @@
#include <vector>
#include <boost/shared_ptr.hpp>
#include <boost/concept_check.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/graph_as_tree.hpp>
+5 -3
View File
@@ -17,7 +17,7 @@
#include <boost/property_map/property_map.hpp>
#include <boost/graph/properties.hpp>
#include <boost/graph/detail/mpi_include.hpp>
#include <boost/shared_array.hpp>
#include <memory>
#include <boost/config.hpp>
#include <boost/assert.hpp>
#include <algorithm>
@@ -45,7 +45,8 @@ template < typename IndexMap = identity_property_map > struct one_bit_color_map
int, bits_per_char = std::numeric_limits< unsigned char >::digits);
std::size_t n;
IndexMap index;
shared_array< unsigned char > data;
// todo : C++17: replace with std::shared_ptr<T[]>
std::shared_ptr< unsigned char > data;
typedef typename property_traits< IndexMap >::key_type key_type;
typedef one_bit_color_type value_type;
@@ -56,7 +57,8 @@ template < typename IndexMap = identity_property_map > struct one_bit_color_map
std::size_t n, const IndexMap& index = IndexMap())
: n(n)
, index(index)
, data(new unsigned char[(n + bits_per_char - 1) / bits_per_char]())
, data(new unsigned char[(n + bits_per_char - 1) / bits_per_char](),
std::default_delete< unsigned char[] >())
{
}
};
@@ -12,7 +12,7 @@
#include <list>
#include <boost/next_prior.hpp>
#include <boost/config.hpp> //for std::min macros
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/tuple/tuple.hpp>
#include <boost/property_map/property_map.hpp>
#include <boost/graph/graph_traits.hpp>
@@ -150,8 +150,8 @@ class boyer_myrvold_impl
typedef std::vector< edge_t > edge_vector_t;
typedef std::list< vertex_t > vertex_list_t;
typedef std::list< face_handle_t > face_handle_list_t;
typedef boost::shared_ptr< face_handle_list_t > face_handle_list_ptr_t;
typedef boost::shared_ptr< vertex_list_t > vertex_list_ptr_t;
using face_handle_list_ptr_t = std::shared_ptr< face_handle_list_t >;
using vertex_list_ptr_t = std::shared_ptr< vertex_list_t >;
typedef boost::tuple< vertex_t, bool, bool > merge_stack_frame_t;
typedef std::vector< merge_stack_frame_t > merge_stack_t;
@@ -11,7 +11,7 @@
#include <list>
#include <boost/graph/graph_traits.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
// A "face handle" is an optimization meant to serve two purposes in
// the implementation of the Boyer-Myrvold planarity test: (1) it holds
@@ -74,7 +74,7 @@ namespace graph
template < typename DataType > struct lazy_list_node
{
typedef shared_ptr< lazy_list_node< DataType > > ptr_t;
using ptr_t = std::shared_ptr< lazy_list_node< DataType > >;
lazy_list_node(const DataType& data)
: m_reversed(false), m_data(data), m_has_data(true)
@@ -92,8 +92,8 @@ namespace graph
bool m_reversed;
DataType m_data;
bool m_has_data;
shared_ptr< lazy_list_node > m_left_child;
shared_ptr< lazy_list_node > m_right_child;
std::shared_ptr< lazy_list_node > m_left_child;
std::shared_ptr< lazy_list_node > m_right_child;
};
template < typename StoreOldHandlesPolicy, typename Vertex,
@@ -136,7 +136,7 @@ namespace graph
struct edge_list_storage< recursive_lazy_list, Edge >
{
typedef lazy_list_node< Edge > node_type;
typedef shared_ptr< node_type > type;
using type = std::shared_ptr< node_type >;
type value;
void push_back(Edge e)
@@ -443,7 +443,7 @@ namespace graph
void store_old_face_handles_dispatch(no_old_handles) {}
boost::shared_ptr< impl_t > pimpl;
std::shared_ptr< impl_t > pimpl;
};
} /* namespace detail */
@@ -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
+7 -7
View File
@@ -12,12 +12,12 @@
#include <iterator>
#include <utility>
#include <boost/random/uniform_int.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/graph/graph_traits.hpp>
#include <vector>
#include <map>
#include <boost/config/no_tr1/cmath.hpp>
#include <boost/mpl/if.hpp>
#include <type_traits>
namespace boost
{
@@ -240,7 +240,7 @@ private:
RandomGenerator* gen;
std::size_t n;
shared_ptr< out_degrees_t > out_degrees;
std::shared_ptr< out_degrees_t > out_degrees;
std::size_t degrees_left;
bool allow_self_loops;
value_type current;
@@ -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;
+22 -54
View File
@@ -13,8 +13,7 @@
#include <vector>
#include <list>
#include <boost/make_shared.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <memory>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/iteration_macros.hpp>
#include <boost/property_map/property_map.hpp>
@@ -25,15 +24,13 @@ namespace boost
// r_c_shortest_paths_label struct
template < class Graph, class Resource_Container >
struct r_c_shortest_paths_label
: public boost::enable_shared_from_this<
r_c_shortest_paths_label< Graph, Resource_Container > >
{
r_c_shortest_paths_label(const unsigned long n,
const Resource_Container& rc = Resource_Container(),
const boost::shared_ptr<
const std::shared_ptr<
r_c_shortest_paths_label< Graph, Resource_Container > >
pl
= boost::shared_ptr<
= std::shared_ptr<
r_c_shortest_paths_label< Graph, Resource_Container > >(),
const typename graph_traits< Graph >::edge_descriptor& ed
= graph_traits< Graph >::edge_descriptor(),
@@ -59,7 +56,7 @@ struct r_c_shortest_paths_label
}
const unsigned long num;
Resource_Container cumulated_resource_consumption;
const boost::shared_ptr<
const std::shared_ptr<
r_c_shortest_paths_label< Graph, Resource_Container > >
p_pred_label;
const typename graph_traits< Graph >::edge_descriptor pred_edge;
@@ -119,49 +116,19 @@ inline bool operator>=(
return l2 < l1 || l1 == l2;
}
template < typename Graph, typename Resource_Container >
inline bool operator<(
const boost::shared_ptr<
r_c_shortest_paths_label< Graph, Resource_Container > >& t,
const boost::shared_ptr<
r_c_shortest_paths_label< Graph, Resource_Container > >& u)
{
return *t < *u;
}
template < typename Graph, typename Resource_Container >
inline bool operator<=(
const boost::shared_ptr<
r_c_shortest_paths_label< Graph, Resource_Container > >& t,
const boost::shared_ptr<
r_c_shortest_paths_label< Graph, Resource_Container > >& u)
{
return *t <= *u;
}
template < typename Graph, typename Resource_Container >
inline bool operator>(
const boost::shared_ptr<
r_c_shortest_paths_label< Graph, Resource_Container > >& t,
const boost::shared_ptr<
r_c_shortest_paths_label< Graph, Resource_Container > >& u)
{
return *t > *u;
}
template < typename Graph, typename Resource_Container >
inline bool operator>=(
const boost::shared_ptr<
r_c_shortest_paths_label< Graph, Resource_Container > >& t,
const boost::shared_ptr<
r_c_shortest_paths_label< Graph, Resource_Container > >& u)
{
return *t >= *u;
}
namespace detail
{
// Order by the pointed-to value, not by pointer identity. Works on any
// dereferenceable type.
template < class Pointer > struct deref_greater
{
bool operator()(const Pointer& a, const Pointer& b) const
{
return *a > *b;
}
};
// r_c_shortest_paths_dispatch function (body/implementation)
template < class Graph, class VertexIndexMap, class EdgeIndexMap,
class Resource_Container, class Resource_Extension_Function,
@@ -200,18 +167,18 @@ namespace detail
typedef std::allocator_traits< LAlloc > LTraits;
#endif
LAlloc l_alloc;
typedef boost::shared_ptr<
typedef std::shared_ptr<
r_c_shortest_paths_label< Graph, Resource_Container > >
Splabel;
std::priority_queue< Splabel, std::vector< Splabel >,
std::greater< Splabel > >
deref_greater< Splabel > >
unprocessed_labels;
bool b_feasible = true;
Splabel splabel_first_label = boost::allocate_shared<
Splabel splabel_first_label = std::allocate_shared<
r_c_shortest_paths_label< Graph, Resource_Container > >(l_alloc,
i_label_num++, rc,
boost::shared_ptr<
std::shared_ptr<
r_c_shortest_paths_label< Graph, Resource_Container > >(),
typename graph_traits< Graph >::edge_descriptor(), s);
@@ -400,7 +367,7 @@ namespace detail
oei != oei_end; ++oei)
{
b_feasible = true;
Splabel new_label = boost::allocate_shared<
Splabel new_label = std::allocate_shared<
r_c_shortest_paths_label< Graph, Resource_Container > >(
l_alloc, i_label_num++,
cur_label->cumulated_resource_consumption, cur_label,
@@ -433,7 +400,8 @@ namespace detail
std::list< Splabel > dsplabels = get(vec_vertex_labels, t);
if(!b_all_pareto_optimal_solutions)
{
dsplabels.sort();
dsplabels.sort([](const Splabel& a, const Splabel& b)
{ return *a < *b; });
}
typename std::list< Splabel >::const_iterator csi = dsplabels.begin();
typename std::list< Splabel >::const_iterator csi_end = dsplabels.end();
@@ -444,7 +412,7 @@ namespace detail
{
std::vector< typename graph_traits< Graph >::edge_descriptor >
cur_pareto_optimal_path;
boost::shared_ptr<
std::shared_ptr<
r_c_shortest_paths_label< Graph, Resource_Container > >
p_cur_label = *csi;
pareto_optimal_resource_containers.push_back(
+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)
+7 -7
View File
@@ -15,7 +15,7 @@
#include <vector>
#include <queue>
#include <map>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/assert.hpp>
#include <boost/random/uniform_int.hpp>
#include <boost/random/uniform_01.hpp>
@@ -25,7 +25,6 @@
#include <boost/type_traits/is_same.hpp>
// #include <boost/test/floating_point_comparison.hpp>
using boost::shared_ptr;
using boost::uniform_01;
// Returns floor(log_2(n)), and -1 when n is 0
@@ -84,7 +83,8 @@ void generate_permutation_vector(
template < typename RandomGenerator, typename T >
std::pair< T, T > generate_edge(
shared_ptr< uniform_01< RandomGenerator > > prob, T n, unsigned int SCALE,
std::shared_ptr< uniform_01< RandomGenerator > > prob, T n,
unsigned int SCALE,
double a, double b, double c, double d)
{
T u = 0, v = 0;
@@ -233,7 +233,7 @@ public:
private:
// Parameters
shared_ptr< uniform_01< RandomGenerator > > gen;
std::shared_ptr< uniform_01< RandomGenerator > > gen;
vertices_size_type n;
double a, b, c, d;
int edge;
@@ -359,7 +359,7 @@ public:
private:
// Parameters
shared_ptr< uniform_01< RandomGenerator > > gen;
std::shared_ptr< uniform_01< RandomGenerator > > gen;
bool permute_vertices;
// Internal data structures
@@ -484,7 +484,7 @@ public:
private:
// Parameters
shared_ptr< uniform_01< RandomGenerator > > gen;
std::shared_ptr< uniform_01< RandomGenerator > > gen;
// Internal data structures
std::vector< value_type > values;
@@ -645,7 +645,7 @@ public:
private:
// Parameters
shared_ptr< uniform_01< RandomGenerator > > gen;
std::shared_ptr< uniform_01< RandomGenerator > > gen;
bool bidirectional;
// Internal data structures
+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;
+28 -27
View File
@@ -13,11 +13,10 @@
#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>
#include <memory>
#include <cmath>
@@ -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;
}
@@ -303,8 +302,8 @@ public:
}
private:
shared_ptr< RandomNumberGenerator > gen_ptr;
shared_ptr< rand_t > rand;
std::shared_ptr< RandomNumberGenerator > gen_ptr;
std::shared_ptr< rand_t > rand;
double scaling;
};
@@ -412,8 +411,8 @@ public:
}
private:
shared_ptr< RandomNumberGenerator > gen_ptr;
shared_ptr< rand_t > rand;
std::shared_ptr< RandomNumberGenerator > gen_ptr;
std::shared_ptr< rand_t > rand;
double left, top, right, bottom;
};
@@ -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;
}
@@ -519,8 +518,8 @@ public:
}
private:
shared_ptr< RandomNumberGenerator > gen_ptr;
shared_ptr< rand_t > rand;
std::shared_ptr< RandomNumberGenerator > gen_ptr;
std::shared_ptr< rand_t > rand;
double radius;
};
@@ -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)
@@ -693,8 +694,8 @@ public:
}
private:
shared_ptr< RandomNumberGenerator > gen_ptr;
shared_ptr< rand_t > rand;
std::shared_ptr< RandomNumberGenerator > gen_ptr;
std::shared_ptr< rand_t > rand;
};
} // namespace boost
+5 -3
View File
@@ -16,7 +16,7 @@
#include <boost/property_map/property_map.hpp>
#include <boost/graph/properties.hpp>
#include <boost/graph/detail/mpi_include.hpp>
#include <boost/shared_array.hpp>
#include <memory>
#include <boost/config.hpp>
#include <boost/assert.hpp>
#include <algorithm>
@@ -45,7 +45,8 @@ template < typename IndexMap = identity_property_map > struct two_bit_color_map
{
std::size_t n;
IndexMap index;
shared_array< unsigned char > data;
// todo : C++17: replace with std::shared_ptr<T[]>
std::shared_ptr< unsigned char > data;
BOOST_STATIC_CONSTANT(
int, bits_per_char = std::numeric_limits< unsigned char >::digits);
@@ -59,7 +60,8 @@ template < typename IndexMap = identity_property_map > struct two_bit_color_map
std::size_t n, const IndexMap& index = IndexMap())
: n(n)
, index(index)
, data(new unsigned char[(n + elements_per_char - 1) / elements_per_char]())
, data(new unsigned char[(n + elements_per_char - 1) / elements_per_char](),
std::default_delete< unsigned char[] >())
{
}
};
-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;
+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 ]
+32
View File
@@ -6,6 +6,8 @@
#include "cycle_test.hpp"
#include <boost/graph/hawick_circuits.hpp>
#include <cstddef>
#include <functional>
#include <iostream>
struct call_hawick_circuits
@@ -32,6 +34,18 @@ struct call_hawick_unique_circuits
}
};
struct not_copyable
{
not_copyable() { }
not_copyable(not_copyable const&) = delete;
template < typename Path, typename Graph >
void cycle(Path const&, Graph const&)
{
}
};
int main()
{
// The last two arguments to cycle_test() are the expected (correct)
@@ -62,6 +76,24 @@ int main()
cycle_test(call_hawick_unique_circuits(ml), nc3[ml], nc4[ml]);
}
// Make sure we can pass a reference_wrapper to the algorithm.
{
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS> Graph;
typedef std::pair<std::size_t, std::size_t> Pair;
Pair edges[3] = {
Pair(0, 1), // a->b
Pair(1, 2), // b->c
Pair(2, 0), // c->a
};
Graph G(3);
for (int i = 0; i < 3; ++i)
add_edge(edges[i].first, edges[i].second, G);
not_copyable visitor;
boost::hawick_circuits(G, std::ref(visitor));
}
std::cout << "\n\n";
return boost::report_errors();
}
+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)
{
}
//@}