XNetwork 1.7.5; VERSION ${PROJECT_VERSION}
Loading...
Searching...
No Matches
filters.h
Go to the documentation of this file.
1// Copyright (C) 2004-2018 by
2// Wai-Shing Luk <luk036@gmail.com>
3//
4//
5// All rights reserved.
6// BSD license.
7//
8// Author: Wai-Shing Luk (luk036@gmail.com>,
9// Pieter Swart (swart@lanl.gov>,
10// Dan Schult(dschult@colgate.edu>;
11#pragma once
12
13// #include <functional>
14#include <set>
15
21// static const auto __all__ = {
22// "no_filter",
23// "hide_nodes",
24// "hide_edges",
25// "hide_multiedges",
26// "hide_diedges",
27// "hide_multidiedges",
28// "show_nodes",
29// "show_edges",
30// "show_multiedges",
31// "show_diedges",
32// "show_multidiedges",
33// };
34
41 template <typename T> auto no_filter(const T& /*items*/) {
42 return [](const T& /*item*/) { return true; };
43}
44
55template <typename T> auto hide_nodes(const std::set<T>& nodes) {
56 return [nodes](const T& node) { return nodes.find(node) == nodes.end(); };
57}
58
69template <typename T> auto hide_diedges(const std::set<std::pair<T, T>>& edges) {
70 return
71 [edges](const T& u, const T& v) { return edges.find(std::make_pair(u, v)) == edges.end(); };
72}
Read-only map of maps of maps (view into a dict-of-dict-of-dict structure)
Definition coreviews.hpp:109
auto end() const
Get iterator to the end of the view.
Definition coreviews.hpp:61
auto hide_diedges(const std::set< std::pair< T, T > > &edges)
Create a filter that hides specified directed edges.
Definition filters.h:69
auto no_filter(const T &)
A predicate that always returns true (no filtering).
Definition filters.h:41
auto hide_nodes(const std::set< T > &nodes)
Create a filter that hides specified nodes.
Definition filters.h:55