mirror of
https://github.com/boostorg/graph.git
synced 2026-07-21 13:23:42 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6c04b5e4ac | |||
| de2bffe7b0 | |||
| 1d06b64f49 | |||
| 54a94911e6 | |||
| 198616d896 |
@@ -1,131 +0,0 @@
|
||||
#!/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])
|
||||
@@ -56,7 +56,7 @@ jobs:
|
||||
run: ../../../b2 toolset=$TOOLSET cxxstd=${{ matrix.cxxstd }}
|
||||
working-directory: ../boost-root/libs/graph/test
|
||||
macos:
|
||||
runs-on: macos-15
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -71,8 +71,6 @@ 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
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
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
|
||||
@@ -1,42 +0,0 @@
|
||||
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==="
|
||||
+6
-1
@@ -25,13 +25,16 @@ 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::mp11
|
||||
Boost::math
|
||||
Boost::move
|
||||
Boost::mpl
|
||||
Boost::multi_index
|
||||
Boost::multiprecision
|
||||
@@ -46,8 +49,10 @@ target_link_libraries(boost_graph
|
||||
Boost::smart_ptr
|
||||
Boost::spirit
|
||||
Boost::throw_exception
|
||||
Boost::tti
|
||||
Boost::tuple
|
||||
Boost::type_traits
|
||||
Boost::typeof
|
||||
Boost::unordered
|
||||
Boost::utility
|
||||
Boost::xpressive
|
||||
|
||||
@@ -11,16 +11,20 @@ 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/mp11//boost_mp11
|
||||
/boost/math//boost_math_tr1
|
||||
/boost/move//boost_move
|
||||
/boost/mpl//boost_mpl
|
||||
/boost/multi_index//boost_multi_index
|
||||
/boost/multiprecision//boost_multiprecision
|
||||
@@ -35,8 +39,10 @@ constant boost_dependencies :
|
||||
/boost/smart_ptr//boost_smart_ptr
|
||||
/boost/spirit//boost_spirit
|
||||
/boost/throw_exception//boost_throw_exception
|
||||
/boost/tti//boost_tti
|
||||
/boost/tuple//boost_tuple
|
||||
/boost/type_traits//boost_type_traits
|
||||
/boost/typeof//boost_typeof
|
||||
/boost/unordered//boost_unordered
|
||||
/boost/utility//boost_utility
|
||||
/boost/xpressive//boost_xpressive ;
|
||||
|
||||
@@ -6,8 +6,5 @@ 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
|
||||
|
||||
@@ -30,47 +30,18 @@ template <typename Graph>
|
||||
class subgraph;
|
||||
----
|
||||
|
||||
`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.
|
||||
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.
|
||||
|
||||
[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.
|
||||
====
|
||||
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.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
== Template Parameters
|
||||
|
||||
@@ -131,49 +102,16 @@ 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;
|
||||
----
|
||||
|
||||
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.
|
||||
====
|
||||
Returns `(local_descriptor, true)` if the global vertex is in this subgraph,
|
||||
`(_, false)` otherwise.
|
||||
|
||||
=== Hierarchy Navigation
|
||||
|
||||
|
||||
+4
-1
@@ -20,8 +20,11 @@ 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/graph-ui-bundle/raw/c80db72a7ba804256beb36e3a46d9c7df265d8d7/ui-bundle.zip
|
||||
url: https://github.com/boostorg/website-v2-docs/releases/download/ui-master/ui-bundle.zip
|
||||
snapshot: true
|
||||
supplemental_files: ./supplemental-ui
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
{{!--
|
||||
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&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>
|
||||
@@ -0,0 +1,89 @@
|
||||
{{!--
|
||||
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}}
|
||||
@@ -25,9 +25,12 @@
|
||||
#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>
|
||||
@@ -184,7 +187,7 @@ namespace detail
|
||||
{
|
||||
value = false
|
||||
};
|
||||
typedef std::false_type type;
|
||||
typedef mpl::false_ type;
|
||||
};
|
||||
template <> struct is_random_access< vecS >
|
||||
{
|
||||
@@ -192,12 +195,12 @@ namespace detail
|
||||
{
|
||||
value = true
|
||||
};
|
||||
typedef std::true_type type;
|
||||
typedef mpl::true_ type;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template < typename Selector > struct is_distributed_selector : std::false_type
|
||||
template < typename Selector > struct is_distributed_selector : mpl::false_
|
||||
{
|
||||
};
|
||||
|
||||
@@ -217,8 +220,8 @@ struct adjacency_list_traits
|
||||
typedef typename DirectedS::is_bidir_t is_bidir;
|
||||
typedef typename DirectedS::is_directed_t is_directed;
|
||||
|
||||
typedef typename std::conditional< is_bidir::value, bidirectional_tag,
|
||||
typename std::conditional< is_directed::value, directed_tag,
|
||||
typedef typename mpl::if_< is_bidir, bidirectional_tag,
|
||||
typename mpl::if_< is_directed, directed_tag,
|
||||
undirected_tag >::type >::type directed_category;
|
||||
|
||||
typedef typename parallel_edge_traits< OutEdgeListS >::type
|
||||
@@ -226,7 +229,7 @@ struct adjacency_list_traits
|
||||
|
||||
typedef std::size_t vertices_size_type;
|
||||
typedef void* vertex_ptr;
|
||||
typedef typename std::conditional< is_rand_access::value, vertices_size_type,
|
||||
typedef typename mpl::if_< is_rand_access, vertices_size_type,
|
||||
vertex_ptr >::type vertex_descriptor;
|
||||
typedef detail::edge_desc_impl< directed_category, vertex_descriptor >
|
||||
edge_descriptor;
|
||||
@@ -239,12 +242,11 @@ private:
|
||||
typedef typename container_gen< EdgeListS, dummy >::type EdgeContainer;
|
||||
typedef typename DirectedS::is_bidir_t BidirectionalT;
|
||||
typedef typename DirectedS::is_directed_t DirectedT;
|
||||
typedef std::integral_constant< bool,
|
||||
DirectedT::value && !BidirectionalT::value >
|
||||
on_edge_storage;
|
||||
typedef typename mpl::and_< DirectedT,
|
||||
typename mpl::not_< BidirectionalT >::type >::type on_edge_storage;
|
||||
|
||||
public:
|
||||
typedef typename std::conditional< on_edge_storage::value, std::size_t,
|
||||
typedef typename mpl::if_< on_edge_storage, std::size_t,
|
||||
typename EdgeContainer::size_type >::type edges_size_type;
|
||||
};
|
||||
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
#include <boost/graph/graph_mutability_traits.hpp>
|
||||
#include <boost/graph/graph_selectors.hpp>
|
||||
#include <type_traits>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/graph/adjacency_iterator.hpp>
|
||||
#include <boost/graph/detail/edge.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
@@ -412,7 +413,7 @@ public:
|
||||
// in_degree, etc.).
|
||||
BOOST_STATIC_ASSERT(!(is_same< Directed, bidirectionalS >::value));
|
||||
|
||||
typedef typename std::conditional< is_directed::value, bidirectional_tag,
|
||||
typedef typename mpl::if_< is_directed, bidirectional_tag,
|
||||
undirected_tag >::type directed_category;
|
||||
|
||||
typedef disallow_parallel_edge_tag edge_parallel_category;
|
||||
@@ -469,7 +470,7 @@ public:
|
||||
|
||||
public: // should be private
|
||||
typedef
|
||||
typename std::conditional< has_property< edge_property_type >::type::value,
|
||||
typename mpl::if_< typename has_property< edge_property_type >::type,
|
||||
std::pair< bool, edge_property_type >, char >::type StoredEdge;
|
||||
#if defined(BOOST_NO_STD_ALLOCATOR)
|
||||
typedef std::vector< StoredEdge > Matrix;
|
||||
@@ -509,7 +510,7 @@ public:
|
||||
MatrixIter, size_type, edge_descriptor >
|
||||
UnDirOutEdgeIter;
|
||||
|
||||
typedef typename std::conditional< Directed::is_directed_t::value, DirOutEdgeIter,
|
||||
typedef typename mpl::if_< typename Directed::is_directed_t, DirOutEdgeIter,
|
||||
UnDirOutEdgeIter >::type unfiltered_out_edge_iter;
|
||||
|
||||
typedef detail::dir_adj_matrix_in_edge_iter< vertex_descriptor, MatrixIter,
|
||||
@@ -520,7 +521,7 @@ public:
|
||||
MatrixIter, size_type, edge_descriptor >
|
||||
UnDirInEdgeIter;
|
||||
|
||||
typedef typename std::conditional< Directed::is_directed_t::value, DirInEdgeIter,
|
||||
typedef typename mpl::if_< typename Directed::is_directed_t, DirInEdgeIter,
|
||||
UnDirInEdgeIter >::type unfiltered_in_edge_iter;
|
||||
|
||||
typedef detail::adj_matrix_edge_iter< Directed, MatrixIter, size_type,
|
||||
@@ -1102,7 +1103,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 std::conditional< IsConst::value, const EP, EP >::type
|
||||
typedef typename boost::mpl::if_< IsConst, const EP, EP >::type
|
||||
ep_type_nonref;
|
||||
typedef ep_type_nonref& ep_type;
|
||||
typedef typename lookup_one_property< ep_type_nonref, Tag >::type&
|
||||
@@ -1115,20 +1116,20 @@ struct adj_mat_pm_helper< D, VP, EP, GP, A, Tag, edge_property_tag >
|
||||
};
|
||||
|
||||
typedef function_property_map<
|
||||
lookup_property_from_edge< std::false_type >,
|
||||
lookup_property_from_edge< boost::mpl::false_ >,
|
||||
typename graph_traits<
|
||||
adjacency_matrix< D, VP, EP, GP, A > >::edge_descriptor >
|
||||
type;
|
||||
typedef function_property_map<
|
||||
lookup_property_from_edge< std::true_type >,
|
||||
lookup_property_from_edge< boost::mpl::true_ >,
|
||||
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< std::false_type >::result_type
|
||||
typename lookup_property_from_edge< boost::mpl::false_ >::result_type
|
||||
single_nonconst_type;
|
||||
typedef typename lookup_property_from_edge< std::true_type >::result_type
|
||||
typedef typename lookup_property_from_edge< boost::mpl::true_ >::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 <type_traits>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#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 std::conditional<
|
||||
typedef typename mpl::if_c<
|
||||
(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 std::conditional<
|
||||
typedef typename mpl::if_c<
|
||||
(is_same< CentralityMap, dummy_property_map >::value),
|
||||
EdgeCentralityMap, CentralityMap >::type a_centrality_map;
|
||||
typedef typename property_traits< a_centrality_map >::value_type
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#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>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#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>
|
||||
@@ -33,7 +34,7 @@ void circle_graph_layout(
|
||||
{
|
||||
BOOST_STATIC_ASSERT(
|
||||
property_traits< PositionMap >::value_type::dimensions >= 2);
|
||||
const double pi = 3.14159265358979323846;
|
||||
const double pi = boost::math::constants::pi< double >();
|
||||
|
||||
#ifndef BOOST_NO_STDC_NAMESPACE
|
||||
using std::cos;
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#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>
|
||||
@@ -44,6 +45,7 @@
|
||||
#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
|
||||
{
|
||||
|
||||
@@ -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/type_traits/make_void.hpp>
|
||||
#include <type_traits>
|
||||
#include <boost/tti/has_member_function.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
@@ -69,19 +69,7 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
// 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
|
||||
{
|
||||
};
|
||||
BOOST_TTI_HAS_MEMBER_FUNCTION(finish_edge)
|
||||
|
||||
template < bool IsCallable > struct do_call_finish_edge
|
||||
{
|
||||
@@ -102,9 +90,18 @@ namespace detail
|
||||
|
||||
template < typename E, typename G, typename Vis >
|
||||
void call_finish_edge(Vis& vis, E e, const G& g)
|
||||
{ // 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);
|
||||
{ // 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
|
||||
}
|
||||
|
||||
// Define BOOST_RECURSIVE_DFS to use older, recursive version.
|
||||
@@ -278,7 +275,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 = *ui;
|
||||
Vertex u = implicit_cast< Vertex >(*ui);
|
||||
put(color, u, Color::white());
|
||||
vis.initialize_vertex(u, g);
|
||||
}
|
||||
@@ -292,7 +289,7 @@ void depth_first_search(const VertexListGraph& g, DFSVisitor vis,
|
||||
|
||||
for (boost::tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui)
|
||||
{
|
||||
Vertex u = *ui;
|
||||
Vertex u = implicit_cast< Vertex >(*ui);
|
||||
ColorValue u_color = get(color, u);
|
||||
if (u_color == Color::white())
|
||||
{
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/graph/graph_concepts.hpp>
|
||||
#include <boost/pending/container_traits.hpp>
|
||||
#include <boost/graph/detail/adj_list_edge_iterator.hpp>
|
||||
@@ -2341,8 +2343,8 @@ namespace detail
|
||||
typedef typename container_gen< VertexListS, vertex_ptr >::type
|
||||
SeqVertexList;
|
||||
typedef boost::integer_range< vertex_descriptor > RandVertexList;
|
||||
typedef typename std::conditional< is_rand_access::value,
|
||||
RandVertexList, SeqVertexList >::type VertexList;
|
||||
typedef typename mpl::if_< is_rand_access, RandVertexList,
|
||||
SeqVertexList >::type VertexList;
|
||||
|
||||
typedef typename VertexList::iterator vertex_iterator;
|
||||
|
||||
@@ -2352,22 +2354,21 @@ namespace detail
|
||||
list_edge< vertex_descriptor, EdgeProperty > >::type
|
||||
EdgeContainer;
|
||||
|
||||
typedef std::integral_constant< bool,
|
||||
DirectedT::value && !BidirectionalT::value >
|
||||
typedef typename mpl::and_< DirectedT,
|
||||
typename mpl::not_< BidirectionalT >::type >::type
|
||||
on_edge_storage;
|
||||
|
||||
typedef typename std::conditional< on_edge_storage::value,
|
||||
std::size_t, typename EdgeContainer::size_type >::type
|
||||
edges_size_type;
|
||||
typedef typename mpl::if_< on_edge_storage, 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 std::conditional< on_edge_storage::value,
|
||||
typedef typename mpl::if_< on_edge_storage,
|
||||
stored_edge_property< vertex_descriptor, EdgeProperty >,
|
||||
typename std::conditional< is_edge_ra::value,
|
||||
typename mpl::if_< is_edge_ra,
|
||||
stored_ra_edge_iter< vertex_descriptor, EdgeContainer,
|
||||
EdgeProperty >,
|
||||
stored_edge_iter< vertex_descriptor, EdgeIter,
|
||||
@@ -2420,8 +2421,8 @@ namespace detail
|
||||
graph_type >
|
||||
DirectedEdgeIter;
|
||||
|
||||
typedef typename std::conditional< on_edge_storage::value,
|
||||
DirectedEdgeIter, UndirectedEdgeIter >::type edge_iterator;
|
||||
typedef typename mpl::if_< on_edge_storage, DirectedEdgeIter,
|
||||
UndirectedEdgeIter >::type edge_iterator;
|
||||
|
||||
// stored_vertex and StoredVertexList
|
||||
typedef typename container_gen< VertexListS, vertex_ptr >::type
|
||||
@@ -2463,12 +2464,11 @@ namespace detail
|
||||
InEdgeList m_in_edges;
|
||||
VertexProperty m_property;
|
||||
};
|
||||
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;
|
||||
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;
|
||||
struct stored_vertex : public StoredVertex
|
||||
{
|
||||
stored_vertex() {}
|
||||
@@ -2477,19 +2477,17 @@ namespace detail
|
||||
|
||||
typedef typename container_gen< VertexListS, stored_vertex >::type
|
||||
RandStoredVertexList;
|
||||
typedef typename std::conditional< is_rand_access::value,
|
||||
RandStoredVertexList, SeqStoredVertexList >::type
|
||||
StoredVertexList;
|
||||
typedef typename mpl::if_< is_rand_access, RandStoredVertexList,
|
||||
SeqStoredVertexList >::type StoredVertexList;
|
||||
}; // end of config
|
||||
|
||||
typedef typename std::conditional< BidirectionalT::value,
|
||||
typedef typename mpl::if_< BidirectionalT,
|
||||
bidirectional_graph_helper_with_property< config >,
|
||||
typename std::conditional< DirectedT::value,
|
||||
directed_graph_helper< config >,
|
||||
typename mpl::if_< DirectedT, directed_graph_helper< config >,
|
||||
undirected_graph_helper< config > >::type >::type
|
||||
DirectedHelper;
|
||||
|
||||
typedef typename std::conditional< is_rand_access::value,
|
||||
typedef typename mpl::if_< is_rand_access,
|
||||
vec_adj_list_impl< Graph, config, DirectedHelper >,
|
||||
adj_list_impl< Graph, config, DirectedHelper > >::type type;
|
||||
};
|
||||
@@ -2689,7 +2687,7 @@ namespace detail
|
||||
{
|
||||
template < class Tag, class Graph, class Property >
|
||||
struct adj_list_choose_vertex_pa
|
||||
: std::conditional< boost::is_same< Tag, vertex_all_t >::value,
|
||||
: boost::mpl::if_< boost::is_same< Tag, vertex_all_t >,
|
||||
adj_list_all_vertex_pa, adj_list_any_vertex_pa >::type ::
|
||||
template bind_< Tag, Graph, Property >
|
||||
{
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#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>
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#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
|
||||
@@ -68,8 +67,8 @@ namespace detail
|
||||
// VertexEdgeGraph - whichever type Key is selecting.
|
||||
template < typename Graph, typename Key > struct choose_indexer
|
||||
{
|
||||
typedef typename std::conditional<
|
||||
is_same< Key, typename graph_traits< Graph >::vertex_descriptor >::value,
|
||||
typedef typename mpl::if_<
|
||||
is_same< Key, typename graph_traits< Graph >::vertex_descriptor >,
|
||||
vertex_indexer< Graph >, edge_indexer< Graph > >::type indexer_type;
|
||||
typedef typename indexer_type::index_type index_type;
|
||||
};
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#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 <type_traits>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template < typename > struct is_distributed_selector : std::false_type
|
||||
template < typename > struct is_distributed_selector : boost::mpl::false_
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
#include <boost/graph/graph_mutability_traits.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
@@ -86,7 +84,7 @@ struct labeled_add_only_property_graph_tag
|
||||
|
||||
template < typename Graph >
|
||||
struct graph_has_add_vertex_by_label
|
||||
: std::integral_constant< bool,
|
||||
: mpl::bool_<
|
||||
is_convertible< typename graph_mutability_traits< Graph >::category,
|
||||
labeled_add_vertex_tag >::value >
|
||||
{
|
||||
@@ -94,7 +92,7 @@ struct graph_has_add_vertex_by_label
|
||||
|
||||
template < typename Graph >
|
||||
struct graph_has_add_vertex_by_label_with_property
|
||||
: std::integral_constant< bool,
|
||||
: mpl::bool_<
|
||||
is_convertible< typename graph_mutability_traits< Graph >::category,
|
||||
labeled_add_vertex_property_tag >::value >
|
||||
{
|
||||
@@ -102,7 +100,7 @@ struct graph_has_add_vertex_by_label_with_property
|
||||
|
||||
template < typename Graph >
|
||||
struct graph_has_remove_vertex_by_label
|
||||
: std::integral_constant< bool,
|
||||
: mpl::bool_<
|
||||
is_convertible< typename graph_mutability_traits< Graph >::category,
|
||||
labeled_remove_vertex_tag >::value >
|
||||
{
|
||||
@@ -110,7 +108,7 @@ struct graph_has_remove_vertex_by_label
|
||||
|
||||
template < typename Graph >
|
||||
struct graph_has_add_edge_by_label
|
||||
: std::integral_constant< bool,
|
||||
: mpl::bool_<
|
||||
is_convertible< typename graph_mutability_traits< Graph >::category,
|
||||
labeled_add_edge_tag >::value >
|
||||
{
|
||||
@@ -118,7 +116,7 @@ struct graph_has_add_edge_by_label
|
||||
|
||||
template < typename Graph >
|
||||
struct graph_has_add_edge_by_label_with_property
|
||||
: std::integral_constant< bool,
|
||||
: mpl::bool_<
|
||||
is_convertible< typename graph_mutability_traits< Graph >::category,
|
||||
labeled_add_edge_property_tag >::value >
|
||||
{
|
||||
@@ -126,7 +124,7 @@ struct graph_has_add_edge_by_label_with_property
|
||||
|
||||
template < typename Graph >
|
||||
struct graph_has_remove_edge_by_label
|
||||
: std::integral_constant< bool,
|
||||
: mpl::bool_<
|
||||
is_convertible< typename graph_mutability_traits< Graph >::category,
|
||||
labeled_remove_edge_tag >::value >
|
||||
{
|
||||
@@ -134,55 +132,49 @@ struct graph_has_remove_edge_by_label
|
||||
|
||||
template < typename Graph >
|
||||
struct is_labeled_mutable_vertex_graph
|
||||
: std::integral_constant< bool,
|
||||
graph_has_add_vertex_by_label< Graph >::value
|
||||
&& graph_has_remove_vertex_by_label< Graph >::value >
|
||||
: mpl::and_< graph_has_add_vertex_by_label< Graph >,
|
||||
graph_has_remove_vertex_by_label< Graph > >
|
||||
{
|
||||
};
|
||||
|
||||
template < typename Graph >
|
||||
struct is_labeled_mutable_vertex_property_graph
|
||||
: std::integral_constant< bool,
|
||||
graph_has_add_vertex_by_label< Graph >::value
|
||||
&& graph_has_remove_vertex_by_label< Graph >::value >
|
||||
: mpl::and_< graph_has_add_vertex_by_label< Graph >,
|
||||
graph_has_remove_vertex_by_label< Graph > >
|
||||
{
|
||||
};
|
||||
|
||||
template < typename Graph >
|
||||
struct is_labeled_mutable_edge_graph
|
||||
: std::integral_constant< bool,
|
||||
graph_has_add_edge_by_label< Graph >::value
|
||||
&& graph_has_remove_edge_by_label< Graph >::value >
|
||||
: mpl::and_< graph_has_add_edge_by_label< Graph >,
|
||||
graph_has_remove_edge_by_label< Graph > >
|
||||
{
|
||||
};
|
||||
|
||||
template < typename Graph >
|
||||
struct is_labeled_mutable_edge_property_graph
|
||||
: std::integral_constant< bool,
|
||||
graph_has_add_edge_by_label< Graph >::value
|
||||
&& graph_has_remove_edge_by_label< Graph >::value >
|
||||
: mpl::and_< graph_has_add_edge_by_label< Graph >,
|
||||
graph_has_remove_edge_by_label< Graph > >
|
||||
{
|
||||
};
|
||||
|
||||
template < typename Graph >
|
||||
struct is_labeled_mutable_graph
|
||||
: std::integral_constant< bool,
|
||||
is_labeled_mutable_vertex_graph< Graph >::value
|
||||
&& is_labeled_mutable_edge_graph< Graph >::value >
|
||||
: mpl::and_< is_labeled_mutable_vertex_graph< Graph >,
|
||||
is_labeled_mutable_edge_graph< Graph > >
|
||||
{
|
||||
};
|
||||
|
||||
template < typename Graph >
|
||||
struct is_labeled_mutable_property_graph
|
||||
: std::integral_constant< bool,
|
||||
is_labeled_mutable_vertex_property_graph< Graph >::value
|
||||
&& is_labeled_mutable_edge_property_graph< Graph >::value >
|
||||
: mpl::and_< is_labeled_mutable_vertex_property_graph< Graph >,
|
||||
is_labeled_mutable_edge_property_graph< Graph > >
|
||||
{
|
||||
};
|
||||
|
||||
template < typename Graph >
|
||||
struct is_labeled_add_only_property_graph
|
||||
: std::integral_constant< bool,
|
||||
: mpl::bool_<
|
||||
is_convertible< typename graph_mutability_traits< Graph >::category,
|
||||
labeled_add_only_property_graph_tag >::value >
|
||||
{
|
||||
@@ -190,7 +182,7 @@ struct is_labeled_add_only_property_graph
|
||||
|
||||
template < typename Graph >
|
||||
struct is_labeled_graph
|
||||
: std::integral_constant< bool,
|
||||
: mpl::bool_<
|
||||
is_convertible< typename graph_mutability_traits< Graph >::category,
|
||||
label_vertex_tag >::value >
|
||||
{
|
||||
@@ -205,15 +197,13 @@ namespace graph_detail
|
||||
// graph_mutability_traits specialization below.
|
||||
template < typename Graph > struct determine_mutability
|
||||
{
|
||||
typedef typename std::conditional<
|
||||
is_add_only_property_graph< Graph >::value,
|
||||
typedef typename mpl::if_< is_add_only_property_graph< Graph >,
|
||||
labeled_add_only_property_graph_tag,
|
||||
typename std::conditional< is_mutable_property_graph< Graph >::value,
|
||||
typename mpl::if_< is_mutable_property_graph< Graph >,
|
||||
labeled_mutable_property_graph_tag,
|
||||
typename std::conditional< is_mutable_graph< Graph >::value,
|
||||
typename mpl::if_< is_mutable_graph< Graph >,
|
||||
labeled_mutable_graph_tag,
|
||||
typename std::conditional<
|
||||
is_mutable_edge_graph< Graph >::value,
|
||||
typename mpl::if_< is_mutable_edge_graph< Graph >,
|
||||
labeled_graph_tag,
|
||||
typename graph_mutability_traits< Graph >::category >::
|
||||
type >::type >::type >::type type;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#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,7 +13,8 @@
|
||||
|
||||
#include <iterator>
|
||||
#include <boost/config.hpp>
|
||||
#include <type_traits>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/range/irange.hpp>
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
#include <boost/graph/properties.hpp>
|
||||
@@ -263,7 +264,7 @@ template < class Cat > struct is_random
|
||||
{
|
||||
RET = false
|
||||
};
|
||||
typedef std::false_type type;
|
||||
typedef mpl::false_ type;
|
||||
};
|
||||
template <> struct is_random< std::random_access_iterator_tag >
|
||||
{
|
||||
@@ -271,7 +272,7 @@ template <> struct is_random< std::random_access_iterator_tag >
|
||||
{
|
||||
RET = true
|
||||
};
|
||||
typedef std::true_type type;
|
||||
typedef mpl::true_ type;
|
||||
};
|
||||
|
||||
// The edge_list class conditionally inherits from one of the
|
||||
@@ -286,7 +287,7 @@ template < class EdgeIter,
|
||||
class T, class D, class Cat >
|
||||
#endif
|
||||
class edge_list
|
||||
: public std::conditional< is_random< Cat >::type::value,
|
||||
: public mpl::if_< typename is_random< Cat >::type,
|
||||
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
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#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>
|
||||
@@ -78,8 +79,10 @@ 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::is_same< out_edge_iterator, void >::value));
|
||||
BOOST_STATIC_ASSERT((!boost::is_same< degree_size_type, void >::value));
|
||||
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_CONCEPT_USAGE(IncidenceGraph)
|
||||
{
|
||||
@@ -123,7 +126,8 @@ BOOST_concept(BidirectionalGraph, (G)) : IncidenceGraph< G >
|
||||
BOOST_CONCEPT_ASSERT(
|
||||
(Convertible< traversal_category, bidirectional_graph_tag >));
|
||||
|
||||
BOOST_STATIC_ASSERT((!boost::is_same< in_edge_iterator, void >::value));
|
||||
BOOST_STATIC_ASSERT((boost::mpl::not_<
|
||||
boost::is_same< in_edge_iterator, void > >::value));
|
||||
|
||||
p = in_edges(v, g);
|
||||
n = in_degree(v, g);
|
||||
@@ -156,8 +160,8 @@ BOOST_concept(AdjacencyGraph, (G)) : Graph< G >
|
||||
BOOST_CONCEPT_ASSERT(
|
||||
(Convertible< traversal_category, adjacency_graph_tag >));
|
||||
|
||||
BOOST_STATIC_ASSERT(
|
||||
(!boost::is_same< adjacency_iterator, void >::value));
|
||||
BOOST_STATIC_ASSERT((boost::mpl::not_<
|
||||
boost::is_same< adjacency_iterator, void > >::value));
|
||||
|
||||
p = adjacent_vertices(v, g);
|
||||
v = *p.first;
|
||||
@@ -181,9 +185,10 @@ BOOST_concept(VertexListGraph, (G)) : Graph< G >
|
||||
BOOST_CONCEPT_ASSERT(
|
||||
(Convertible< traversal_category, vertex_list_graph_tag >));
|
||||
|
||||
BOOST_STATIC_ASSERT((!boost::is_same< vertex_iterator, void >::value));
|
||||
BOOST_STATIC_ASSERT(
|
||||
(!boost::is_same< vertices_size_type, void >::value));
|
||||
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));
|
||||
|
||||
#ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK
|
||||
// dwa 2003/7/11 -- This clearly shouldn't be necessary, but if
|
||||
@@ -234,8 +239,10 @@ BOOST_concept(EdgeListGraph, (G)) : Graph< G >
|
||||
BOOST_CONCEPT_ASSERT(
|
||||
(Convertible< traversal_category, edge_list_graph_tag >));
|
||||
|
||||
BOOST_STATIC_ASSERT((!boost::is_same< edge_iterator, void >::value));
|
||||
BOOST_STATIC_ASSERT((!boost::is_same< edges_size_type, void >::value));
|
||||
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));
|
||||
|
||||
p = edges(g);
|
||||
e = *p.first;
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
#define BOOST_GRAPH_MUTABILITY_TRAITS_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <type_traits>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
@@ -88,7 +90,7 @@ template < typename Graph > struct graph_mutability_traits
|
||||
|
||||
template < typename Graph >
|
||||
struct graph_has_add_vertex
|
||||
: std::integral_constant< bool,
|
||||
: mpl::bool_<
|
||||
is_convertible< typename graph_mutability_traits< Graph >::category,
|
||||
add_vertex_tag >::value >
|
||||
{
|
||||
@@ -96,7 +98,7 @@ struct graph_has_add_vertex
|
||||
|
||||
template < typename Graph >
|
||||
struct graph_has_add_vertex_with_property
|
||||
: std::integral_constant< bool,
|
||||
: mpl::bool_<
|
||||
is_convertible< typename graph_mutability_traits< Graph >::category,
|
||||
add_vertex_property_tag >::value >
|
||||
{
|
||||
@@ -104,7 +106,7 @@ struct graph_has_add_vertex_with_property
|
||||
|
||||
template < typename Graph >
|
||||
struct graph_has_remove_vertex
|
||||
: std::integral_constant< bool,
|
||||
: mpl::bool_<
|
||||
is_convertible< typename graph_mutability_traits< Graph >::category,
|
||||
remove_vertex_tag >::value >
|
||||
{
|
||||
@@ -112,7 +114,7 @@ struct graph_has_remove_vertex
|
||||
|
||||
template < typename Graph >
|
||||
struct graph_has_add_edge
|
||||
: std::integral_constant< bool,
|
||||
: mpl::bool_<
|
||||
is_convertible< typename graph_mutability_traits< Graph >::category,
|
||||
add_edge_tag >::value >
|
||||
{
|
||||
@@ -120,7 +122,7 @@ struct graph_has_add_edge
|
||||
|
||||
template < typename Graph >
|
||||
struct graph_has_add_edge_with_property
|
||||
: std::integral_constant< bool,
|
||||
: mpl::bool_<
|
||||
is_convertible< typename graph_mutability_traits< Graph >::category,
|
||||
add_edge_property_tag >::value >
|
||||
{
|
||||
@@ -128,7 +130,7 @@ struct graph_has_add_edge_with_property
|
||||
|
||||
template < typename Graph >
|
||||
struct graph_has_remove_edge
|
||||
: std::integral_constant< bool,
|
||||
: mpl::bool_<
|
||||
is_convertible< typename graph_mutability_traits< Graph >::category,
|
||||
remove_edge_tag >::value >
|
||||
{
|
||||
@@ -136,55 +138,46 @@ struct graph_has_remove_edge
|
||||
|
||||
template < typename Graph >
|
||||
struct is_mutable_vertex_graph
|
||||
: std::integral_constant< bool,
|
||||
graph_has_add_vertex< Graph >::value
|
||||
&& graph_has_remove_vertex< Graph >::value >
|
||||
: mpl::and_< graph_has_add_vertex< Graph >, graph_has_remove_vertex< Graph > >
|
||||
{
|
||||
};
|
||||
|
||||
template < typename Graph >
|
||||
struct is_mutable_vertex_property_graph
|
||||
: std::integral_constant< bool,
|
||||
graph_has_add_vertex_with_property< Graph >::value
|
||||
&& graph_has_remove_vertex< Graph >::value >
|
||||
: mpl::and_< graph_has_add_vertex_with_property< Graph >,
|
||||
graph_has_remove_vertex< Graph > >
|
||||
{
|
||||
};
|
||||
|
||||
template < typename Graph >
|
||||
struct is_mutable_edge_graph
|
||||
: std::integral_constant< bool,
|
||||
graph_has_add_edge< Graph >::value
|
||||
&& graph_has_remove_edge< Graph >::value >
|
||||
: mpl::and_< graph_has_add_edge< Graph >, graph_has_remove_edge< Graph > >
|
||||
{
|
||||
};
|
||||
|
||||
template < typename Graph >
|
||||
struct is_mutable_edge_property_graph
|
||||
: std::integral_constant< bool,
|
||||
graph_has_add_edge_with_property< Graph >::value
|
||||
&& graph_has_remove_edge< Graph >::value >
|
||||
: mpl::and_< graph_has_add_edge_with_property< Graph >,
|
||||
graph_has_remove_edge< Graph > >
|
||||
{
|
||||
};
|
||||
|
||||
template < typename Graph >
|
||||
struct is_mutable_graph
|
||||
: std::integral_constant< bool,
|
||||
is_mutable_vertex_graph< Graph >::value
|
||||
&& is_mutable_edge_graph< Graph >::value >
|
||||
: mpl::and_< is_mutable_vertex_graph< Graph >, is_mutable_edge_graph< Graph > >
|
||||
{
|
||||
};
|
||||
|
||||
template < typename Graph >
|
||||
struct is_mutable_property_graph
|
||||
: std::integral_constant< bool,
|
||||
is_mutable_vertex_property_graph< Graph >::value
|
||||
&& is_mutable_edge_property_graph< Graph >::value >
|
||||
: mpl::and_< is_mutable_vertex_property_graph< Graph >,
|
||||
is_mutable_edge_property_graph< Graph > >
|
||||
{
|
||||
};
|
||||
|
||||
template < typename Graph >
|
||||
struct is_add_only_property_graph
|
||||
: std::integral_constant< bool,
|
||||
: mpl::bool_<
|
||||
is_convertible< typename graph_mutability_traits< Graph >::category,
|
||||
add_only_property_graph_tag >::value >
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#ifndef BOOST_GRAPH_SELECTORS_HPP
|
||||
#define BOOST_GRAPH_SELECTORS_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -26,8 +26,8 @@ struct directedS
|
||||
is_directed = true,
|
||||
is_bidir = false
|
||||
};
|
||||
using is_directed_t = std::true_type;
|
||||
using is_bidir_t = std::false_type;
|
||||
typedef mpl::true_ is_directed_t;
|
||||
typedef mpl::false_ is_bidir_t;
|
||||
};
|
||||
struct undirectedS
|
||||
{
|
||||
@@ -36,8 +36,8 @@ struct undirectedS
|
||||
is_directed = false,
|
||||
is_bidir = false
|
||||
};
|
||||
using is_directed_t = std::false_type;
|
||||
using is_bidir_t = std::false_type;
|
||||
typedef mpl::false_ is_directed_t;
|
||||
typedef mpl::false_ is_bidir_t;
|
||||
};
|
||||
struct bidirectionalS
|
||||
{
|
||||
@@ -46,8 +46,8 @@ struct bidirectionalS
|
||||
is_directed = true,
|
||||
is_bidir = true
|
||||
};
|
||||
using is_directed_t = std::true_type;
|
||||
using is_bidir_t = std::true_type;
|
||||
typedef mpl::true_ is_directed_t;
|
||||
typedef mpl::true_ is_bidir_t;
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
@@ -14,9 +14,15 @@
|
||||
#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>
|
||||
@@ -27,18 +33,16 @@ namespace boost
|
||||
|
||||
namespace detail
|
||||
{
|
||||
// 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; \
|
||||
#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 > >\
|
||||
{ \
|
||||
};
|
||||
BOOST_GRAPH_MEMBER_OR_VOID(adjacency_iterator)
|
||||
BOOST_GRAPH_MEMBER_OR_VOID(out_edge_iterator)
|
||||
@@ -118,7 +122,7 @@ namespace graph_detail
|
||||
{
|
||||
template < typename Tag >
|
||||
struct is_directed_tag
|
||||
: std::integral_constant< bool, is_convertible< Tag, directed_tag >::value >
|
||||
: mpl::bool_< is_convertible< Tag, directed_tag >::value >
|
||||
{
|
||||
};
|
||||
} // namespace graph_detail
|
||||
@@ -131,8 +135,7 @@ struct is_directed_graph
|
||||
};
|
||||
|
||||
template < typename Graph >
|
||||
struct is_undirected_graph
|
||||
: std::integral_constant< bool, !is_directed_graph< Graph >::value >
|
||||
struct is_undirected_graph : mpl::not_< is_directed_graph< Graph > >
|
||||
{
|
||||
};
|
||||
//@}
|
||||
@@ -167,9 +170,8 @@ template < typename Graph > bool allows_parallel_edges(const Graph&)
|
||||
*/
|
||||
template < typename Graph >
|
||||
struct is_multigraph
|
||||
: std::integral_constant< bool,
|
||||
is_same< typename graph_traits< Graph >::edge_parallel_category,
|
||||
allow_parallel_edge_tag >::value >
|
||||
: mpl::bool_< is_same< typename graph_traits< Graph >::edge_parallel_category,
|
||||
allow_parallel_edge_tag >::value >
|
||||
{
|
||||
};
|
||||
//@}
|
||||
@@ -216,7 +218,7 @@ struct distributed_edge_list_graph_tag
|
||||
//@{
|
||||
template < typename Graph >
|
||||
struct is_incidence_graph
|
||||
: std::integral_constant< bool,
|
||||
: mpl::bool_<
|
||||
is_convertible< typename graph_traits< Graph >::traversal_category,
|
||||
incidence_graph_tag >::value >
|
||||
{
|
||||
@@ -224,7 +226,7 @@ struct is_incidence_graph
|
||||
|
||||
template < typename Graph >
|
||||
struct is_bidirectional_graph
|
||||
: std::integral_constant< bool,
|
||||
: mpl::bool_<
|
||||
is_convertible< typename graph_traits< Graph >::traversal_category,
|
||||
bidirectional_graph_tag >::value >
|
||||
{
|
||||
@@ -232,7 +234,7 @@ struct is_bidirectional_graph
|
||||
|
||||
template < typename Graph >
|
||||
struct is_vertex_list_graph
|
||||
: std::integral_constant< bool,
|
||||
: mpl::bool_<
|
||||
is_convertible< typename graph_traits< Graph >::traversal_category,
|
||||
vertex_list_graph_tag >::value >
|
||||
{
|
||||
@@ -240,7 +242,7 @@ struct is_vertex_list_graph
|
||||
|
||||
template < typename Graph >
|
||||
struct is_edge_list_graph
|
||||
: std::integral_constant< bool,
|
||||
: mpl::bool_<
|
||||
is_convertible< typename graph_traits< Graph >::traversal_category,
|
||||
edge_list_graph_tag >::value >
|
||||
{
|
||||
@@ -248,7 +250,7 @@ struct is_edge_list_graph
|
||||
|
||||
template < typename Graph >
|
||||
struct is_adjacency_matrix
|
||||
: std::integral_constant< bool,
|
||||
: mpl::bool_<
|
||||
is_convertible< typename graph_traits< Graph >::traversal_category,
|
||||
adjacency_matrix_tag >::value >
|
||||
{
|
||||
@@ -263,17 +265,14 @@ struct is_adjacency_matrix
|
||||
//@{
|
||||
template < typename Graph >
|
||||
struct is_directed_unidirectional_graph
|
||||
: std::integral_constant< bool,
|
||||
is_directed_graph< Graph >::value
|
||||
&& !is_bidirectional_graph< Graph >::value >
|
||||
: mpl::and_< is_directed_graph< Graph >,
|
||||
mpl::not_< is_bidirectional_graph< Graph > > >
|
||||
{
|
||||
};
|
||||
|
||||
template < typename Graph >
|
||||
struct is_directed_bidirectional_graph
|
||||
: std::integral_constant< bool,
|
||||
is_directed_graph< Graph >::value
|
||||
&& is_bidirectional_graph< Graph >::value >
|
||||
: mpl::and_< is_directed_graph< Graph >, is_bidirectional_graph< Graph > >
|
||||
{
|
||||
};
|
||||
//@}
|
||||
@@ -283,47 +282,40 @@ typedef boost::forward_traversal_tag multi_pass_input_iterator_tag;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
// 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
|
||||
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
|
||||
{
|
||||
typedef typename G::graph_property_type type;
|
||||
};
|
||||
template < typename G >
|
||||
struct get_graph_property_type< G, boost::void_t< typename G::graph_property_type > >
|
||||
template < typename G > struct get_edge_property_type
|
||||
{
|
||||
using type = typename G::graph_property_type;
|
||||
typedef typename G::edge_property_type type;
|
||||
};
|
||||
template < typename G, typename = void >
|
||||
struct get_edge_property_type : no_property
|
||||
template < typename G > struct get_vertex_property_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;
|
||||
typedef typename G::vertex_property_type type;
|
||||
};
|
||||
}
|
||||
|
||||
template < typename G >
|
||||
struct graph_property_type : detail::get_graph_property_type< G >
|
||||
struct graph_property_type
|
||||
: boost::mpl::eval_if< detail::has_graph_property_type< G >,
|
||||
detail::get_graph_property_type< G >, no_property >
|
||||
{
|
||||
};
|
||||
template < typename G >
|
||||
struct edge_property_type : detail::get_edge_property_type< G >
|
||||
struct edge_property_type
|
||||
: boost::mpl::eval_if< detail::has_edge_property_type< G >,
|
||||
detail::get_edge_property_type< G >, no_property >
|
||||
{
|
||||
};
|
||||
template < typename G >
|
||||
struct vertex_property_type : detail::get_vertex_property_type< G >
|
||||
struct vertex_property_type
|
||||
: boost::mpl::eval_if< detail::has_vertex_property_type< G >,
|
||||
detail::get_vertex_property_type< G >, no_property >
|
||||
{
|
||||
};
|
||||
|
||||
@@ -349,8 +341,7 @@ namespace graph
|
||||
template < typename Graph, typename Descriptor > class bundled_result
|
||||
{
|
||||
typedef typename graph_traits< Graph >::vertex_descriptor Vertex;
|
||||
typedef typename std::conditional<
|
||||
(is_same< Descriptor, Vertex >::value),
|
||||
typedef typename mpl::if_c< (is_same< Descriptor, Vertex >::value),
|
||||
vertex_bundle_type< Graph >, edge_bundle_type< Graph > >::type
|
||||
bundler;
|
||||
|
||||
@@ -376,8 +367,7 @@ namespace graph_detail
|
||||
// A helper metafunction for determining whether or not a type is
|
||||
// bundled.
|
||||
template < typename T >
|
||||
struct is_no_bundle
|
||||
: std::integral_constant< bool, is_same< T, no_property >::value >
|
||||
struct is_no_bundle : mpl::bool_< is_same< T, no_property >::value >
|
||||
{
|
||||
};
|
||||
} // namespace graph_detail
|
||||
@@ -390,49 +380,43 @@ namespace graph_detail
|
||||
//@{
|
||||
template < typename Graph >
|
||||
struct has_graph_property
|
||||
: std::integral_constant< bool,
|
||||
!detail::is_no_property<
|
||||
typename graph_property_type< Graph >::type >::value >
|
||||
: mpl::not_< typename detail::is_no_property<
|
||||
typename graph_property_type< Graph >::type >::type >::type
|
||||
{
|
||||
};
|
||||
|
||||
template < typename Graph >
|
||||
struct has_bundled_graph_property
|
||||
: std::integral_constant< bool,
|
||||
!graph_detail::is_no_bundle<
|
||||
typename graph_bundle_type< Graph >::type >::value >
|
||||
: mpl::not_<
|
||||
graph_detail::is_no_bundle< typename graph_bundle_type< Graph >::type > >
|
||||
{
|
||||
};
|
||||
|
||||
template < typename Graph >
|
||||
struct has_vertex_property
|
||||
: std::integral_constant< bool,
|
||||
!detail::is_no_property<
|
||||
typename vertex_property_type< Graph >::type >::value >
|
||||
: mpl::not_< typename detail::is_no_property<
|
||||
typename vertex_property_type< Graph >::type > >::type
|
||||
{
|
||||
};
|
||||
|
||||
template < typename Graph >
|
||||
struct has_bundled_vertex_property
|
||||
: std::integral_constant< bool,
|
||||
!graph_detail::is_no_bundle<
|
||||
typename vertex_bundle_type< Graph >::type >::value >
|
||||
: mpl::not_<
|
||||
graph_detail::is_no_bundle< typename vertex_bundle_type< Graph >::type > >
|
||||
{
|
||||
};
|
||||
|
||||
template < typename Graph >
|
||||
struct has_edge_property
|
||||
: std::integral_constant< bool,
|
||||
!detail::is_no_property<
|
||||
typename edge_property_type< Graph >::type >::value >
|
||||
: mpl::not_< typename detail::is_no_property<
|
||||
typename edge_property_type< Graph >::type > >::type
|
||||
{
|
||||
};
|
||||
|
||||
template < typename Graph >
|
||||
struct has_bundled_edge_property
|
||||
: std::integral_constant< bool,
|
||||
!graph_detail::is_no_bundle<
|
||||
typename edge_bundle_type< Graph >::type >::value >
|
||||
: mpl::not_<
|
||||
graph_detail::is_no_bundle< typename edge_bundle_type< Graph >::type > >
|
||||
{
|
||||
};
|
||||
//@}
|
||||
|
||||
@@ -15,13 +15,16 @@
|
||||
#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>
|
||||
@@ -108,7 +111,7 @@ public:
|
||||
bool type_found = false;
|
||||
try
|
||||
{
|
||||
mp11::mp_for_each< value_types >(
|
||||
mpl::for_each< value_types >(
|
||||
put_property< MutableGraph*, value_types >(name, m_dp, &m_g,
|
||||
value, value_type, m_type_names, type_found));
|
||||
}
|
||||
@@ -130,7 +133,7 @@ public:
|
||||
bool type_found = false;
|
||||
try
|
||||
{
|
||||
mp11::mp_for_each< value_types >(
|
||||
mpl::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));
|
||||
@@ -153,7 +156,7 @@ public:
|
||||
bool type_found = false;
|
||||
try
|
||||
{
|
||||
mp11::mp_for_each< value_types >(
|
||||
mpl::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));
|
||||
@@ -189,7 +192,8 @@ public:
|
||||
template < class Value > void operator()(Value)
|
||||
{
|
||||
if (m_value_type
|
||||
== m_type_names[mp11::mp_find< ValueVector, Value >::value])
|
||||
== m_type_names[mpl::find< ValueVector,
|
||||
Value >::type::pos::value])
|
||||
{
|
||||
put(m_name, m_dp, m_key, lexical_cast< Value >(m_value));
|
||||
m_type_found = true;
|
||||
@@ -209,7 +213,8 @@ public:
|
||||
protected:
|
||||
MutableGraph& m_g;
|
||||
dynamic_properties& m_dp;
|
||||
using value_types = mp11::mp_list< bool, int, long, float, double, std::string >;
|
||||
typedef mpl::vector< bool, int, long, float, double, std::string >
|
||||
value_types;
|
||||
static const char* m_type_names[];
|
||||
};
|
||||
|
||||
@@ -239,7 +244,8 @@ public:
|
||||
template < typename Type > void operator()(Type)
|
||||
{
|
||||
if (typeid(Type) == m_type)
|
||||
m_type_name = m_type_names[mp11::mp_find< Types, Type >::value];
|
||||
m_type_name
|
||||
= m_type_names[mpl::find< Types, Type >::type::pos::value];
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -269,9 +275,10 @@ 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";
|
||||
|
||||
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 >;
|
||||
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;
|
||||
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;
|
||||
@@ -292,9 +299,8 @@ void write_graphml(std::ostream& out, const Graph& g,
|
||||
else
|
||||
continue;
|
||||
std::string type_name = "string";
|
||||
mp11::mp_for_each< value_types >(
|
||||
get_type_name< value_types >(
|
||||
i->second->value(), type_names, type_name));
|
||||
mpl::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"
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include <boost/xpressive/xpressive_static.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -842,13 +843,13 @@ namespace detail
|
||||
edge_permutation_from_sorting[temp[e]] = e;
|
||||
}
|
||||
typedef boost::tuple< id_t, bgl_vertex_t, id_t > v_prop;
|
||||
for (const v_prop& t : vertex_props)
|
||||
BOOST_FOREACH (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;
|
||||
for (const e_prop& t : edge_props)
|
||||
BOOST_FOREACH (const e_prop& t, edge_props)
|
||||
{
|
||||
put(boost::get< 0 >(t), dp_,
|
||||
edge_permutation_from_sorting[boost::get< 1 >(t)],
|
||||
|
||||
@@ -9,14 +9,15 @@
|
||||
|
||||
#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>
|
||||
@@ -47,11 +48,11 @@ namespace hawick_circuits_detail
|
||||
|
||||
template < typename Vertex, typename Graph >
|
||||
typename result< get_all_adjacent_vertices(
|
||||
Vertex&&, Graph&&) >::type
|
||||
operator()(Vertex&& v, Graph&& g) const
|
||||
BOOST_FWD_REF(Vertex), BOOST_FWD_REF(Graph)) >::type
|
||||
operator()(BOOST_FWD_REF(Vertex) v, BOOST_FWD_REF(Graph) g) const
|
||||
{
|
||||
return adjacent_vertices(
|
||||
std::forward< Vertex >(v), std::forward< Graph >(g));
|
||||
boost::forward< Vertex >(v), boost::forward< Graph >(g));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -133,7 +134,7 @@ namespace hawick_circuits_detail
|
||||
// documented above.
|
||||
bool blocked_map_starts_all_unblocked() const
|
||||
{
|
||||
for (Vertex v : boost::make_iterator_range(vertices(graph_)))
|
||||
BOOST_FOREACH (Vertex v, vertices(graph_))
|
||||
if (is_blocked(v))
|
||||
return false;
|
||||
return true;
|
||||
@@ -143,7 +144,7 @@ namespace hawick_circuits_detail
|
||||
// sharing data structures between iterations does not break the code.
|
||||
bool all_closed_rows_are_empty() const
|
||||
{
|
||||
for (typename ClosedMatrix::reference row : closed_)
|
||||
BOOST_FOREACH (typename ClosedMatrix::reference row, closed_)
|
||||
if (!row.empty())
|
||||
return false;
|
||||
return true;
|
||||
@@ -346,34 +347,34 @@ namespace hawick_circuits_detail
|
||||
|
||||
template < typename GetAdjacentVertices, typename Graph, typename Visitor >
|
||||
void call_hawick_circuits(
|
||||
Graph const& graph, Visitor&& visitor,
|
||||
Graph const& graph, BOOST_FWD_REF(Visitor) visitor,
|
||||
unsigned int max_length)
|
||||
{
|
||||
call_hawick_circuits< GetAdjacentVertices >(graph,
|
||||
std::forward< Visitor >(visitor), get(vertex_index, graph),
|
||||
boost::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(Graph&& graph, Visitor&& visitor,
|
||||
VertexIndexMap&& vertex_index_map,
|
||||
void hawick_circuits(BOOST_FWD_REF(Graph) graph, BOOST_FWD_REF(Visitor) visitor,
|
||||
BOOST_FWD_REF(VertexIndexMap) vertex_index_map,
|
||||
unsigned int max_length = 0)
|
||||
{
|
||||
hawick_circuits_detail::call_hawick_circuits<
|
||||
hawick_circuits_detail::get_all_adjacent_vertices >(
|
||||
std::forward< Graph >(graph), std::forward< Visitor >(visitor),
|
||||
std::forward< VertexIndexMap >(vertex_index_map), max_length);
|
||||
boost::forward< Graph >(graph), boost::forward< Visitor >(visitor),
|
||||
boost::forward< VertexIndexMap >(vertex_index_map), max_length);
|
||||
}
|
||||
|
||||
template < typename Graph, typename Visitor >
|
||||
void hawick_circuits(Graph&& graph, Visitor&& visitor,
|
||||
void hawick_circuits(BOOST_FWD_REF(Graph) graph, BOOST_FWD_REF(Visitor) visitor,
|
||||
unsigned int max_length = 0)
|
||||
{
|
||||
hawick_circuits_detail::call_hawick_circuits<
|
||||
hawick_circuits_detail::get_all_adjacent_vertices >(
|
||||
std::forward< Graph >(graph), std::forward< Visitor >(visitor),
|
||||
boost::forward< Graph >(graph), boost::forward< Visitor >(visitor),
|
||||
max_length);
|
||||
}
|
||||
|
||||
@@ -382,25 +383,25 @@ void hawick_circuits(Graph&& graph, 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(Graph&& graph,
|
||||
Visitor&& visitor,
|
||||
VertexIndexMap&& vertex_index_map,
|
||||
void hawick_unique_circuits(BOOST_FWD_REF(Graph) graph,
|
||||
BOOST_FWD_REF(Visitor) visitor,
|
||||
BOOST_FWD_REF(VertexIndexMap) vertex_index_map,
|
||||
unsigned int max_length = 0)
|
||||
{
|
||||
hawick_circuits_detail::call_hawick_circuits<
|
||||
hawick_circuits_detail::get_unique_adjacent_vertices >(
|
||||
std::forward< Graph >(graph), std::forward< Visitor >(visitor),
|
||||
std::forward< VertexIndexMap >(vertex_index_map), max_length);
|
||||
boost::forward< Graph >(graph), boost::forward< Visitor >(visitor),
|
||||
boost::forward< VertexIndexMap >(vertex_index_map), max_length);
|
||||
}
|
||||
|
||||
template < typename Graph, typename Visitor >
|
||||
void hawick_unique_circuits(
|
||||
Graph&& graph, Visitor&& visitor,
|
||||
BOOST_FWD_REF(Graph) graph, BOOST_FWD_REF(Visitor) visitor,
|
||||
unsigned int max_length = 0)
|
||||
{
|
||||
hawick_circuits_detail::call_hawick_circuits<
|
||||
hawick_circuits_detail::get_unique_adjacent_vertices >(
|
||||
std::forward< Graph >(graph), std::forward< Visitor >(visitor),
|
||||
boost::forward< Graph >(graph), boost::forward< Visitor >(visitor),
|
||||
max_length);
|
||||
}
|
||||
} // end namespace boost
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#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>
|
||||
|
||||
@@ -10,9 +10,10 @@
|
||||
#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>
|
||||
@@ -37,8 +38,7 @@ namespace graph_detail
|
||||
{
|
||||
/** Returns true if the selector is the default selector. */
|
||||
template < typename Selector >
|
||||
struct is_default
|
||||
: std::integral_constant< bool, is_same< Selector, defaultS >::value >
|
||||
struct is_default : mpl::bool_< is_same< Selector, defaultS >::value >
|
||||
{
|
||||
};
|
||||
|
||||
@@ -48,8 +48,7 @@ namespace graph_detail
|
||||
*/
|
||||
template < typename Label, typename Vertex > struct choose_default_map
|
||||
{
|
||||
typedef typename std::conditional< is_unsigned< Label >::value,
|
||||
std::vector< Vertex >,
|
||||
typedef typename mpl::if_< is_unsigned< Label >, std::vector< Vertex >,
|
||||
std::map< Label, Vertex > // TODO: Should use unordered_map?
|
||||
>::type type;
|
||||
};
|
||||
@@ -112,9 +111,9 @@ namespace graph_detail
|
||||
template < typename Selector, typename Label, typename Vertex >
|
||||
struct choose_map
|
||||
{
|
||||
typedef typename std::conditional< is_default< Selector >::value,
|
||||
typedef typename mpl::eval_if< is_default< Selector >,
|
||||
choose_default_map< Label, Vertex >,
|
||||
choose_custom_map< Selector, Label, Vertex > >::type::type type;
|
||||
choose_custom_map< Selector, Label, Vertex > >::type type;
|
||||
};
|
||||
|
||||
/** @name Insert Labeled Vertex */
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#define __FACE_ITERATORS_HPP__
|
||||
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
|
||||
namespace boost
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <boost/config/no_tr1/cmath.hpp>
|
||||
#include <type_traits>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -248,15 +248,15 @@ private:
|
||||
|
||||
template < typename RandomGenerator, typename Graph >
|
||||
class plod_iterator
|
||||
: public std::conditional<
|
||||
: public mpl::if_<
|
||||
is_convertible< typename graph_traits< Graph >::directed_category,
|
||||
directed_tag >::value,
|
||||
directed_tag >,
|
||||
out_directed_plod_iterator< RandomGenerator >,
|
||||
undirected_plod_iterator< RandomGenerator > >::type
|
||||
{
|
||||
typedef typename std::conditional<
|
||||
typedef typename mpl::if_<
|
||||
is_convertible< typename graph_traits< Graph >::directed_category,
|
||||
directed_tag >::value,
|
||||
directed_tag >,
|
||||
out_directed_plod_iterator< RandomGenerator >,
|
||||
undirected_plod_iterator< RandomGenerator > >::type inherited;
|
||||
|
||||
|
||||
@@ -23,7 +23,9 @@
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include <type_traits>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -148,15 +150,15 @@ namespace detail
|
||||
template < typename G, typename R, typename T >
|
||||
struct property_kind_from_graph< G, R T::* >
|
||||
{
|
||||
typedef typename std::conditional<
|
||||
boost::is_base_of< T, typename vertex_bundle_type< G >::type >::value,
|
||||
typedef typename boost::mpl::if_<
|
||||
boost::is_base_of< T, typename vertex_bundle_type< G >::type >,
|
||||
vertex_property_tag,
|
||||
typename std::conditional<
|
||||
boost::is_base_of< T, typename edge_bundle_type< G >::type >::value,
|
||||
typename boost::mpl::if_<
|
||||
boost::is_base_of< T, typename edge_bundle_type< G >::type >,
|
||||
edge_property_tag,
|
||||
typename std::conditional<
|
||||
typename boost::mpl::if_<
|
||||
boost::is_base_of< T,
|
||||
typename graph_bundle_type< G >::type >::value,
|
||||
typename graph_bundle_type< G >::type >,
|
||||
graph_property_tag, void >::type >::type >::type type;
|
||||
};
|
||||
#endif
|
||||
@@ -230,9 +232,9 @@ namespace detail
|
||||
|
||||
template < class Graph, class Property, class Enable = void >
|
||||
struct property_map
|
||||
: std::conditional< is_same< typename detail::property_kind_from_graph< Graph,
|
||||
Property >::type,
|
||||
edge_property_tag >::value,
|
||||
: mpl::if_< is_same< typename detail::property_kind_from_graph< Graph,
|
||||
Property >::type,
|
||||
edge_property_tag >,
|
||||
detail::edge_property_map< Graph, Property >,
|
||||
detail::vertex_property_map< Graph, Property > >::type
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include <boost/property_map/property_map_iterator.hpp>
|
||||
#include <boost/graph/properties.hpp>
|
||||
#include <type_traits>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#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 std::conditional< is_same< Kind, vertex_property_tag >::value,
|
||||
typedef typename mpl::if_c< is_same< Kind, vertex_property_tag >::value,
|
||||
typename graph_traits< Graph >::vertex_iterator,
|
||||
typename graph_traits< Graph >::edge_iterator >::type iter;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <boost/graph/copy.hpp>
|
||||
#include <type_traits>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#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 std::conditional< is_convertible< dir, directed_tag >::value,
|
||||
typedef typename mpl::if_< is_convertible< dir, directed_tag >,
|
||||
directedS, undirectedS >::type select;
|
||||
adjacency_list< setS, vecS, select > g2;
|
||||
generate_random_graph1(g2, V, E, gen, true, self_edges);
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#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
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <boost/iterator/transform_iterator.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <type_traits>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
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 std::conditional< is_ref_const::value,
|
||||
typedef typename boost::mpl::if_< is_ref_const,
|
||||
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 std::conditional< is_edge_prop::value,
|
||||
typedef typename boost::mpl::if_< is_edge_prop,
|
||||
detail::reverse_graph_edge_property_map< orig_type >, orig_type >::type
|
||||
type;
|
||||
typedef typename std::conditional< is_edge_prop::value,
|
||||
typedef typename boost::mpl::if_< is_edge_prop,
|
||||
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 std::conditional< is_edge_prop::value,
|
||||
typedef typename boost::mpl::if_< is_edge_prop,
|
||||
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 : std::false_type
|
||||
template < typename T > struct is_reverse_graph : boost::mpl::false_
|
||||
{
|
||||
};
|
||||
template < typename G, typename R >
|
||||
struct is_reverse_graph< reverse_graph< G, R > > : std::true_type
|
||||
struct is_reverse_graph< reverse_graph< G, R > > : boost::mpl::true_
|
||||
{
|
||||
};
|
||||
|
||||
@@ -641,8 +641,8 @@ inline void set_property(const reverse_graph< BidirectionalGraph, GRef >& g,
|
||||
}
|
||||
|
||||
template < typename BidirectionalGraph, typename GRef, typename Tag >
|
||||
inline typename std::conditional<
|
||||
boost::is_const< typename boost::remove_reference< GRef >::type >::value,
|
||||
inline typename boost::mpl::if_<
|
||||
boost::is_const< typename boost::remove_reference< GRef >::type >,
|
||||
const typename graph_property< BidirectionalGraph, Tag >::type&,
|
||||
typename graph_property< BidirectionalGraph, Tag >::type& >::type
|
||||
get_property(const reverse_graph< BidirectionalGraph, GRef >& g, Tag tag)
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <type_traits>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -206,14 +207,12 @@ public:
|
||||
|
||||
vertex_descriptor global_to_local(vertex_descriptor u_global) const
|
||||
{
|
||||
if (is_root())
|
||||
return u_global;
|
||||
vertex_descriptor u_local;
|
||||
bool in_subgraph;
|
||||
if (is_root())
|
||||
return u_global;
|
||||
boost::tie(u_local, in_subgraph) = this->find_vertex(u_global);
|
||||
BOOST_ASSERT_MSG(in_subgraph,
|
||||
"global_to_local: vertex is not in this subgraph. "
|
||||
"Use find_vertex() to check membership first.");
|
||||
BOOST_ASSERT(in_subgraph == true);
|
||||
return u_local;
|
||||
}
|
||||
|
||||
@@ -226,15 +225,10 @@ public:
|
||||
|
||||
edge_descriptor global_to_local(edge_descriptor e_global) const
|
||||
{
|
||||
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;
|
||||
return is_root() ? e_global
|
||||
: (*m_local_edge.find(
|
||||
get(get(edge_index, root().m_graph), e_global)))
|
||||
.second;
|
||||
}
|
||||
|
||||
// Is vertex u (of the root graph) contained in this subgraph?
|
||||
@@ -892,8 +886,8 @@ class subgraph_global_property_map
|
||||
typedef property_traits< PropertyMap > Traits;
|
||||
|
||||
public:
|
||||
typedef typename std::conditional<
|
||||
is_const< typename remove_pointer< GraphPtr >::type >::value,
|
||||
typedef typename mpl::if_<
|
||||
is_const< typename remove_pointer< GraphPtr >::type >,
|
||||
readable_property_map_tag, typename Traits::category >::type category;
|
||||
typedef typename Traits::value_type value_type;
|
||||
typedef typename Traits::key_type key_type;
|
||||
@@ -925,8 +919,8 @@ class subgraph_local_property_map
|
||||
typedef property_traits< PropertyMap > Traits;
|
||||
|
||||
public:
|
||||
typedef typename std::conditional<
|
||||
is_const< typename remove_pointer< GraphPtr >::type >::value,
|
||||
typedef typename mpl::if_<
|
||||
is_const< typename remove_pointer< GraphPtr >::type >,
|
||||
readable_property_map_tag, typename Traits::category >::type category;
|
||||
typedef typename Traits::value_type value_type;
|
||||
typedef typename Traits::key_type key_type;
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
#include <boost/algorithm/minmax.hpp>
|
||||
#include <boost/config.hpp> // For BOOST_STATIC_CONSTANT
|
||||
#include <boost/config/no_tr1/cmath.hpp>
|
||||
#include <cmath>
|
||||
#include <boost/math/constants/constants.hpp> // For root_two
|
||||
#include <boost/math/special_functions/hypot.hpp>
|
||||
#include <boost/random/uniform_01.hpp>
|
||||
#include <boost/random/linear_congruential.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
@@ -154,7 +155,7 @@ public:
|
||||
for (std::size_t i = 0; i < Dims; ++i)
|
||||
{
|
||||
double diff = b[i] - a[i];
|
||||
dist = std::hypot(dist, diff);
|
||||
dist = boost::math::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
|
||||
@@ -208,7 +209,7 @@ public:
|
||||
{
|
||||
double n = 0.;
|
||||
for (std::size_t i = 0; i < Dims; ++i)
|
||||
n = std::hypot(n, delta[i]);
|
||||
n = boost::math::hypot(n, delta[i]);
|
||||
return n;
|
||||
}
|
||||
|
||||
@@ -475,7 +476,7 @@ public:
|
||||
BOOST_USING_STD_MAX();
|
||||
double r = 0.;
|
||||
for (std::size_t i = 0; i < Dims; ++i)
|
||||
r = std::hypot(r, a[i]);
|
||||
r = boost::math::hypot(r, a[i]);
|
||||
if (r <= radius)
|
||||
return a;
|
||||
double scaling_factor = radius / r;
|
||||
@@ -489,7 +490,7 @@ public:
|
||||
{
|
||||
double r = 0.;
|
||||
for (std::size_t i = 0; i < Dims; ++i)
|
||||
r = std::hypot(r, a[i]);
|
||||
r = boost::math::hypot(r, a[i]);
|
||||
return radius - r;
|
||||
}
|
||||
|
||||
@@ -559,8 +560,6 @@ 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()
|
||||
@@ -591,11 +590,11 @@ template < typename RandomNumberGenerator = minstd_rand > class heart_topology
|
||||
return false; // Bottom
|
||||
if (p[1] <= -1000)
|
||||
return true; // Diagonal of square
|
||||
if (std::hypot(p[0] - -500, p[1] - -500)
|
||||
<= 500. * root_two)
|
||||
if (boost::math::hypot(p[0] - -500, p[1] - -500)
|
||||
<= 500. * boost::math::constants::root_two< double >())
|
||||
return true; // Left circle
|
||||
if (std::hypot(p[0] - 500, p[1] - -500)
|
||||
<= 500. * root_two)
|
||||
if (boost::math::hypot(p[0] - 500, p[1] - -500)
|
||||
<= 500. * boost::math::constants::root_two< double >())
|
||||
return true; // Right circle
|
||||
return false;
|
||||
}
|
||||
@@ -636,12 +635,12 @@ public:
|
||||
{
|
||||
result[0] = (*rand)()
|
||||
* (1000
|
||||
+ 1000 * root_two)
|
||||
- (500 + 500 * root_two);
|
||||
+ 1000 * boost::math::constants::root_two< double >())
|
||||
- (500 + 500 * boost::math::constants::root_two< double >());
|
||||
result[1] = (*rand)()
|
||||
* (2000
|
||||
+ 500
|
||||
* (root_two
|
||||
* (boost::math::constants::root_two< double >()
|
||||
- 1))
|
||||
- 2000;
|
||||
} while (!in_heart(result));
|
||||
@@ -656,13 +655,13 @@ public:
|
||||
if (segment_within_heart(a, b))
|
||||
{
|
||||
// Straight line
|
||||
return std::hypot(b[0] - a[0], b[1] - a[1]);
|
||||
return boost::math::hypot(b[0] - a[0], b[1] - a[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Straight line bending around (0, 0)
|
||||
return std::hypot(a[0], a[1])
|
||||
+ std::hypot(b[0], b[1]);
|
||||
return boost::math::hypot(a[0], a[1])
|
||||
+ boost::math::hypot(b[0], b[1]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -676,8 +675,8 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
double distance_to_point_a = std::hypot(a[0], a[1]);
|
||||
double distance_to_point_b = std::hypot(b[0], b[1]);
|
||||
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 location_of_point = distance_to_point_a
|
||||
/ (distance_to_point_a + distance_to_point_b);
|
||||
if (fraction < location_of_point)
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#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
|
||||
{
|
||||
|
||||
@@ -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 <type_traits>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#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,
|
||||
std::integral_constant< int, subgraph_mono >) const
|
||||
boost::mpl::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,
|
||||
std::integral_constant< int, subgraph_iso >) const
|
||||
boost::mpl::int_< subgraph_iso >) const
|
||||
{
|
||||
return a <= b;
|
||||
}
|
||||
|
||||
// - graph isomorphism
|
||||
inline bool comp_term_sets(graph1_size_type a, graph2_size_type b,
|
||||
std::integral_constant< int, isomorphism >) const
|
||||
boost::mpl::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,
|
||||
std::integral_constant< int, problem_selection >())
|
||||
boost::mpl::int_< problem_selection >())
|
||||
&& comp_term_sets(term_out1_count, term_out2_count,
|
||||
std::integral_constant< int, problem_selection >())
|
||||
boost::mpl::int_< problem_selection >())
|
||||
&& comp_term_sets(rest1_count, rest2_count,
|
||||
std::integral_constant< int, problem_selection >());
|
||||
boost::mpl::int_< problem_selection >());
|
||||
}
|
||||
else
|
||||
{ // subgraph_mono
|
||||
return comp_term_sets(term_in1_count, term_in2_count,
|
||||
std::integral_constant< int, problem_selection >())
|
||||
boost::mpl::int_< problem_selection >())
|
||||
&& comp_term_sets(term_out1_count, term_out2_count,
|
||||
std::integral_constant< int, problem_selection >())
|
||||
boost::mpl::int_< problem_selection >())
|
||||
&& comp_term_sets(
|
||||
term_in1_count + term_out1_count + rest1_count,
|
||||
term_in2_count + term_out2_count + rest2_count,
|
||||
std::integral_constant< int, problem_selection >());
|
||||
boost::mpl::int_< problem_selection >());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -718,13 +718,13 @@ namespace detail
|
||||
|
||||
return comp_term_sets(boost::get< 0 >(term1),
|
||||
boost::get< 0 >(term2),
|
||||
std::integral_constant< int, problem_selection >())
|
||||
boost::mpl::int_< problem_selection >())
|
||||
&& comp_term_sets(boost::get< 1 >(term1),
|
||||
boost::get< 1 >(term2),
|
||||
std::integral_constant< int, problem_selection >())
|
||||
boost::mpl::int_< problem_selection >())
|
||||
&& comp_term_sets(boost::get< 2 >(term1),
|
||||
boost::get< 2 >(term2),
|
||||
std::integral_constant< int, problem_selection >());
|
||||
boost::mpl::int_< problem_selection >());
|
||||
}
|
||||
|
||||
// Calls the user_callback with a graph (sub)graph mapping
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <iosfwd>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <type_traits>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#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, std::true_type)
|
||||
inline void invoke_dispatch(Visitor& v, T x, Graph& g, mpl::true_)
|
||||
{
|
||||
v(x, g);
|
||||
}
|
||||
|
||||
template < class Visitor, class T, class Graph >
|
||||
inline void invoke_dispatch(Visitor&, T, Graph&, std::false_type)
|
||||
inline void invoke_dispatch(Visitor&, T, Graph&, mpl::false_)
|
||||
{
|
||||
}
|
||||
} // 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 std::is_same< Category, Tag >::type IsSameTag;
|
||||
typedef typename 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 std::is_same< Category, Tag >::type IsSameTag;
|
||||
typedef typename is_same< Category, Tag >::type IsSameTag;
|
||||
detail::invoke_dispatch(v, x, g, IsSameTag());
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
#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>
|
||||
@@ -255,10 +256,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 : std::true_type
|
||||
template < class P > struct has_property : boost::mpl::true_
|
||||
{
|
||||
};
|
||||
template <> struct has_property< no_property > : std::false_type
|
||||
template <> struct has_property< no_property > : boost::mpl::false_
|
||||
{
|
||||
};
|
||||
|
||||
@@ -293,8 +294,7 @@ namespace detail
|
||||
|
||||
/** This trait returns true if T is no_property. */
|
||||
template < typename T >
|
||||
struct is_no_property
|
||||
: std::integral_constant< bool, is_same< T, no_property >::value >
|
||||
struct is_no_property : mpl::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 std::conditional< boost::is_const< non_ref >::value,
|
||||
typedef typename boost::mpl::if_< boost::is_const< non_ref >,
|
||||
boost::add_const< nx >, nx >::type with_const;
|
||||
typedef typename boost::add_reference< with_const >::type type;
|
||||
};
|
||||
|
||||
+10
-9
@@ -11,6 +11,7 @@
|
||||
// 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>
|
||||
@@ -43,7 +44,7 @@ public:
|
||||
using boost::property_tree::ptree;
|
||||
size_t current_idx = 0;
|
||||
bool is_first = is_root;
|
||||
for (const ptree::value_type& n : top)
|
||||
BOOST_FOREACH (const ptree::value_type& n, top)
|
||||
{
|
||||
if (n.first == "graph")
|
||||
{
|
||||
@@ -53,7 +54,7 @@ public:
|
||||
if (is_first)
|
||||
{
|
||||
is_first = false;
|
||||
for (const ptree::value_type& attr : n.second)
|
||||
BOOST_FOREACH (const ptree::value_type& attr, n.second)
|
||||
{
|
||||
if (attr.first != "data")
|
||||
continue;
|
||||
@@ -82,7 +83,7 @@ public:
|
||||
| boost::property_tree::xml_parser::trim_whitespace);
|
||||
ptree gml = pt.get_child(path("graphml"));
|
||||
// Search for attributes
|
||||
for (const ptree::value_type& child : gml)
|
||||
BOOST_FOREACH (const ptree::value_type& child, gml)
|
||||
{
|
||||
if (child.first != "key")
|
||||
continue;
|
||||
@@ -126,17 +127,17 @@ public:
|
||||
std::vector< const ptree* > graphs;
|
||||
handle_graph();
|
||||
get_graphs(gml, desired_idx, true, graphs);
|
||||
for (const ptree* gr : graphs)
|
||||
BOOST_FOREACH (const ptree* gr, graphs)
|
||||
{
|
||||
// Search for nodes
|
||||
for (const ptree::value_type& node : *gr)
|
||||
BOOST_FOREACH (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);
|
||||
for (const ptree::value_type& attr : node.second)
|
||||
BOOST_FOREACH (const ptree::value_type& attr, node.second)
|
||||
{
|
||||
if (attr.first != "data")
|
||||
continue;
|
||||
@@ -147,13 +148,13 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const ptree* gr : graphs)
|
||||
BOOST_FOREACH (const ptree* gr, graphs)
|
||||
{
|
||||
bool default_directed
|
||||
= gr->get< std::string >(path("<xmlattr>/edgedefault"))
|
||||
== "directed";
|
||||
// Search for edges
|
||||
for (const ptree::value_type& edge : *gr)
|
||||
BOOST_FOREACH (const ptree::value_type& edge, *gr)
|
||||
{
|
||||
if (edge.first != "edge")
|
||||
continue;
|
||||
@@ -179,7 +180,7 @@ public:
|
||||
}
|
||||
size_t old_edges_size = m_edge.size();
|
||||
handle_edge(source, target);
|
||||
for (const ptree::value_type& attr : edge.second)
|
||||
BOOST_FOREACH (const ptree::value_type& attr, edge.second)
|
||||
{
|
||||
if (attr.first != "data")
|
||||
continue;
|
||||
|
||||
@@ -97,7 +97,6 @@ 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 ]
|
||||
|
||||
@@ -1,141 +0,0 @@
|
||||
// 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();
|
||||
}
|
||||
@@ -7,7 +7,6 @@
|
||||
#ifndef TEST_CONSTRUCTION_HPP
|
||||
#define TEST_CONSTRUCTION_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <boost/concept/assert.hpp>
|
||||
#include <utility>
|
||||
|
||||
@@ -26,7 +25,7 @@ void build_graph(Graph& g, Add, Label)
|
||||
|
||||
// This matches MutableGraph, so just add some vertices.
|
||||
template < typename Graph >
|
||||
void build_graph(Graph& g, std::true_type, std::false_type)
|
||||
void build_graph(Graph& g, boost::mpl::true_, boost::mpl::false_)
|
||||
{
|
||||
using namespace boost;
|
||||
BOOST_CONCEPT_ASSERT((VertexListGraphConcept< Graph >));
|
||||
@@ -42,7 +41,7 @@ void build_graph(Graph& g, std::true_type, std::false_type)
|
||||
|
||||
// This will match labeled graphs.
|
||||
template < typename Graph >
|
||||
void build_graph(Graph& g, std::false_type, std::true_type)
|
||||
void build_graph(Graph& g, boost::mpl::false_, boost::mpl::true_)
|
||||
{
|
||||
using namespace boost;
|
||||
BOOST_CONCEPT_ASSERT((VertexListGraphConcept< Graph >));
|
||||
@@ -70,7 +69,7 @@ void build_property_graph(Graph const& g, Add, Label)
|
||||
}
|
||||
|
||||
template < typename Graph >
|
||||
void build_property_graph(Graph const&, std::true_type, std::false_type)
|
||||
void build_property_graph(Graph const&, boost::mpl::true_, boost::mpl::false_)
|
||||
{
|
||||
using namespace boost;
|
||||
BOOST_CONCEPT_ASSERT((VertexMutablePropertyGraphConcept< Graph >));
|
||||
@@ -94,7 +93,7 @@ void build_property_graph(Graph const&, std::true_type, std::false_type)
|
||||
*/
|
||||
//@{
|
||||
template < typename Graph, typename VertexSet >
|
||||
void connect_graph(Graph& g, VertexSet const& verts, std::false_type)
|
||||
void connect_graph(Graph& g, VertexSet const& verts, boost::mpl::false_)
|
||||
{
|
||||
using namespace boost;
|
||||
BOOST_CONCEPT_ASSERT((AdjacencyMatrixConcept< Graph >));
|
||||
@@ -114,7 +113,7 @@ void connect_graph(Graph& g, VertexSet const& verts, std::false_type)
|
||||
}
|
||||
|
||||
template < typename Graph, typename VertexSet >
|
||||
void connect_graph(Graph& g, VertexSet const& verts, std::true_type)
|
||||
void connect_graph(Graph& g, VertexSet const& verts, boost::mpl::true_)
|
||||
{
|
||||
using namespace boost;
|
||||
BOOST_CONCEPT_ASSERT((AdjacencyMatrixConcept< Graph >));
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#ifndef TEST_DESTRUCTION_HPP
|
||||
#define TEST_DESTRUCTION_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <boost/concept/assert.hpp>
|
||||
#include <utility>
|
||||
|
||||
@@ -24,7 +23,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, std::true_type, std::false_type)
|
||||
Graph& g, VertexSet const& verts, boost::mpl::true_, boost::mpl::false_)
|
||||
{
|
||||
using namespace boost;
|
||||
BOOST_CONCEPT_ASSERT((VertexListGraphConcept< Graph >));
|
||||
@@ -39,7 +38,7 @@ void destroy_graph(
|
||||
// This will match labeled graphs.
|
||||
template < typename Graph, typename VertexSet >
|
||||
void destroy_graph(
|
||||
Graph& g, VertexSet const&, std::false_type, std::true_type)
|
||||
Graph& g, VertexSet const&, boost::mpl::false_, boost::mpl::true_)
|
||||
{
|
||||
using namespace boost;
|
||||
BOOST_CONCEPT_ASSERT((VertexListGraphConcept< Graph >));
|
||||
@@ -63,7 +62,7 @@ void destroy_graph(
|
||||
//@{
|
||||
|
||||
template < typename Graph, typename VertexSet >
|
||||
void disconnect_graph(Graph& g, VertexSet const& verts, std::false_type)
|
||||
void disconnect_graph(Graph& g, VertexSet const& verts, boost::mpl::false_)
|
||||
{
|
||||
using namespace boost;
|
||||
BOOST_CONCEPT_ASSERT((EdgeListGraphConcept< Graph >));
|
||||
@@ -91,7 +90,7 @@ void disconnect_graph(Graph& g, VertexSet const& verts, std::false_type)
|
||||
}
|
||||
|
||||
template < typename Graph, typename VertexSet >
|
||||
void disconnect_graph(Graph& g, VertexSet const&, std::true_type)
|
||||
void disconnect_graph(Graph& g, VertexSet const&, boost::mpl::true_)
|
||||
{
|
||||
using namespace boost;
|
||||
BOOST_CONCEPT_ASSERT((EdgeListGraphConcept< Graph >));
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#ifndef TEST_DIRECTION_HPP
|
||||
#define TEST_DIRECTION_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <algorithm>
|
||||
#include <boost/range.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
@@ -18,7 +17,7 @@
|
||||
//@{
|
||||
template < typename Graph, typename VertexSet >
|
||||
void test_outdirected_graph(
|
||||
Graph const& g, VertexSet const& verts, std::true_type)
|
||||
Graph const& g, VertexSet const& verts, boost::mpl::true_)
|
||||
{
|
||||
using namespace boost;
|
||||
BOOST_CONCEPT_ASSERT((IncidenceGraphConcept< Graph >));
|
||||
@@ -54,7 +53,7 @@ void test_outdirected_graph(
|
||||
}
|
||||
|
||||
template < typename Graph, typename VertexSet >
|
||||
void test_outdirected_graph(Graph const&, VertexSet const&, std::false_type)
|
||||
void test_outdirected_graph(Graph const&, VertexSet const&, boost::mpl::false_)
|
||||
{
|
||||
}
|
||||
//@}
|
||||
@@ -65,7 +64,7 @@ void test_outdirected_graph(Graph const&, VertexSet const&, std::false_type)
|
||||
//@{
|
||||
template < typename Graph, typename VertexSet >
|
||||
void test_indirected_graph(
|
||||
Graph const& g, VertexSet const& verts, std::true_type)
|
||||
Graph const& g, VertexSet const& verts, boost::mpl::true_)
|
||||
{
|
||||
using namespace boost;
|
||||
BOOST_CONCEPT_ASSERT((BidirectionalGraphConcept< Graph >));
|
||||
@@ -97,7 +96,7 @@ void test_indirected_graph(
|
||||
}
|
||||
|
||||
template < typename Graph, typename VertexSet >
|
||||
void test_indirected_graph(Graph const&, VertexSet const&, std::false_type)
|
||||
void test_indirected_graph(Graph const&, VertexSet const&, boost::mpl::false_)
|
||||
{
|
||||
}
|
||||
//@}
|
||||
@@ -107,7 +106,7 @@ void test_indirected_graph(Graph const&, VertexSet const&, std::false_type)
|
||||
*/
|
||||
template < typename Graph, typename VertexSet >
|
||||
void test_undirected_graph(
|
||||
Graph const& g, VertexSet const& verts, std::true_type)
|
||||
Graph const& g, VertexSet const& verts, boost::mpl::true_)
|
||||
{
|
||||
using namespace boost;
|
||||
BOOST_CONCEPT_ASSERT((IncidenceGraphConcept< Graph >));
|
||||
@@ -135,7 +134,7 @@ void test_undirected_graph(
|
||||
}
|
||||
|
||||
template < typename Graph, typename VertexSet >
|
||||
void test_undirected_graph(Graph const&, VertexSet const&, std::false_type)
|
||||
void test_undirected_graph(Graph const&, VertexSet const&, boost::mpl::false_)
|
||||
{
|
||||
}
|
||||
//@}
|
||||
|
||||
@@ -7,13 +7,12 @@
|
||||
#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, std::true_type)
|
||||
template < typename Graph > void test_graph_bundle(Graph& g, boost::mpl::true_)
|
||||
{
|
||||
using namespace boost;
|
||||
std::cout << "...test_graph_bundle\n";
|
||||
@@ -29,7 +28,7 @@ template < typename Graph > void test_graph_bundle(Graph& g, std::true_type)
|
||||
ignore(cb2);
|
||||
}
|
||||
|
||||
template < typename Graph > void test_graph_bundle(Graph& g, std::false_type)
|
||||
template < typename Graph > void test_graph_bundle(Graph& g, boost::mpl::false_)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -39,7 +38,7 @@ template < typename Graph > void test_graph_bundle(Graph& g, std::false_type)
|
||||
*/
|
||||
//@{
|
||||
template < typename Graph, typename VertexSet >
|
||||
void test_vertex_bundle(Graph& g, VertexSet const& verts, std::true_type)
|
||||
void test_vertex_bundle(Graph& g, VertexSet const& verts, boost::mpl::true_)
|
||||
{
|
||||
using namespace boost;
|
||||
BOOST_CONCEPT_ASSERT((GraphConcept< Graph >));
|
||||
@@ -69,7 +68,7 @@ void test_vertex_bundle(Graph& g, VertexSet const& verts, std::true_type)
|
||||
}
|
||||
|
||||
template < typename Graph, typename VertexSet >
|
||||
void test_vertex_bundle(Graph&, VertexSet const&, std::false_type)
|
||||
void test_vertex_bundle(Graph&, VertexSet const&, boost::mpl::false_)
|
||||
{
|
||||
}
|
||||
//@}
|
||||
@@ -80,7 +79,7 @@ void test_vertex_bundle(Graph&, VertexSet const&, std::false_type)
|
||||
*/
|
||||
//@{
|
||||
template < typename Graph, typename VertexSet >
|
||||
void test_edge_bundle(Graph& g, VertexSet const& verts, std::true_type)
|
||||
void test_edge_bundle(Graph& g, VertexSet const& verts, boost::mpl::true_)
|
||||
{
|
||||
using namespace boost;
|
||||
BOOST_CONCEPT_ASSERT((GraphConcept< Graph >));
|
||||
@@ -111,7 +110,7 @@ void test_edge_bundle(Graph& g, VertexSet const& verts, std::true_type)
|
||||
}
|
||||
|
||||
template < typename Graph, typename VertexSet >
|
||||
void test_edge_bundle(Graph&, VertexSet const&, std::false_type)
|
||||
void test_edge_bundle(Graph&, VertexSet const&, boost::mpl::false_)
|
||||
{
|
||||
}
|
||||
//@}
|
||||
|
||||
Reference in New Issue
Block a user