24 #ifndef DIGIKAM_ITEM_HISTORY_GRAPH_BOOST_H
25 #define DIGIKAM_ITEM_HISTORY_GRAPH_BOOST_H
28 #include "digikam_config.h"
32 # pragma warning(disable : 4267)
35 #if !defined(Q_OS_DARWIN) && defined(Q_CC_GNU)
36 # pragma GCC diagnostic push
37 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
38 # pragma GCC diagnostic ignored "-Wunused-local-typedefs"
41 #if defined(Q_CC_CLANG)
42 # pragma clang diagnostic push
43 # pragma clang diagnostic ignored "-Wdeprecated-declarations"
44 # pragma clang diagnostic ignored "-Wundef"
45 # pragma clang diagnostic ignored "-Wunused-parameter"
46 # pragma clang diagnostic ignored "-Wcast-align"
47 # pragma clang diagnostic ignored "-Wunused-local-typedef"
61 #define BOOST_BIND_GLOBAL_PLACEHOLDERS
62 #define BOOST_ALLOW_DEPRECATED_HEADERS
64 #include <boost/graph/transitive_closure.hpp>
65 #include <boost/graph/adjacency_list.hpp>
66 #include <boost/graph/topological_sort.hpp>
67 #include <boost/graph/graph_utility.hpp>
68 #include <boost/graph/dag_shortest_paths.hpp>
69 #include <boost/graph/dijkstra_shortest_paths.hpp>
70 #include <boost/graph/reverse_graph.hpp>
71 #include <boost/graph/dominator_tree.hpp>
72 #include <boost/graph/depth_first_search.hpp>
73 #include <boost/graph/breadth_first_search.hpp>
74 #include <boost/graph/transitive_reduction.hpp>
89 BOOST_INSTALL_PROPERTY(vertex, properties);
90 BOOST_INSTALL_PROPERTY(edge, properties);
100 template <
typename Key,
typename Value>
128 template <
class VertexProperties,
class EdgeProperties>
133 typedef boost::adjacency_list<
136 boost::bidirectionalS,
137 boost::property<boost::vertex_index_t, int,
138 boost::property<vertex_properties_t, VertexProperties> >,
139 boost::property<edge_properties_t, EdgeProperties>
147 typedef typename graph_traits::vertex_descriptor
vertex_t;
148 typedef typename graph_traits::edge_descriptor
edge_t;
155 typedef typename boost::inv_adjacency_iterator_generator<
GraphContainer,
159 typedef typename graph_traits::degree_size_type
degree_t;
167 typedef typename boost::property_map<GraphContainer, boost::vertex_index_t>::type
vertex_index_map_t;
217 return (v == graph_traits::null_vertex());
225 class DIGIKAM_DATABASE_EXPORT
Edge
301 : direction(direction)
307 direction(g.direction)
335 Vertex v = boost::add_vertex(graph);
343 setProperties(v, properties);
355 boost::clear_vertex(v, graph);
356 boost::remove_vertex(v, graph);
361 Edge e = edge(v1, v2);
365 e = boost::add_edge(v1, v2, graph).first;
373 std::pair<edge_t, bool> pair = boost::edge(v1, v2, graph);
385 return boost::edge(v1, v2, graph).second;
391 if (boost::edge(v1, v2, graph).second)
396 if (boost::edge(v2, v1, graph).second)
429 for (
vertex_iter it = range.first ; it != range.second ; ++it)
431 const VertexProperties& props = properties(*it);
446 Edge e = edge(v1, v2);
450 return EdgeProperties();
453 return properties(e);
476 return toVertexList(boost::vertices(graph));
481 OutboundEdges = 1 << 0,
482 InboundEdges = 1 << 1,
485 EdgesToLeaf = 1 << 2,
486 EdgesToRoot = 1 << 3,
487 AllEdges = InboundEdges | OutboundEdges
492 if (flags & EdgesToLeaf)
498 if (flags & EdgesToRoot)
506 if (flags & OutboundEdges)
508 verticesLst << toVertexList(boost::adjacent_vertices(v, graph));
511 if (flags & InboundEdges)
513 verticesLst << toVertexList(boost::inv_adjacent_vertices(v, graph));
522 return (
int)boost::num_vertices(graph);
527 return isEmptyRange(boost::vertices(graph));
532 return (
int)boost::out_degree(v, graph);
537 return boost::in_degree(v, graph);
542 return !hasEdges(v, EdgesToRoot);
547 return !hasEdges(v, EdgesToLeaf);
552 return boost::source(e.
toEdge(), graph);
557 return boost::target(e.
toEdge(), graph);
562 if (flags & EdgesToLeaf)
568 if (flags & EdgesToRoot)
576 if (flags & OutboundEdges)
578 es << toEdgeList(boost::out_edges(v, graph));
581 if (flags & InboundEdges)
583 es << toEdgeList(boost::in_edges(v, graph));
591 return boost::num_edges(graph);
596 if (flags & EdgesToLeaf)
602 if (flags & EdgesToRoot)
608 if (flags & OutboundEdges)
610 if (!isEmptyRange(boost::out_edges(v, graph)))
616 if (flags & InboundEdges)
618 if (!isEmptyRange(boost::in_edges(v, graph)))
629 return !isEmptyRange(boost::edges(graph));
634 return toEdgeList(boost::edges(graph));
642 for (
edge_iter it = range.first ; it != range.second ; ++it)
644 pairs <<
VertexPair(boost::source(*it, graph), boost::target(*it, graph));
657 std::list<Vertex> verticesLst;
661 boost::topological_sort(graph, std::back_inserter(verticesLst));
663 catch (boost::bad_graph& e)
665 qCDebug(DIGIKAM_DATABASE_LOG) << e.what();
670 typedef typename std::list<Vertex>::iterator vertex_list_iter;
672 return toVertexList(std::pair<vertex_list_iter, vertex_list_iter>(verticesLst.begin(), verticesLst.end()));
677 CopyVertexProperties = 1 << 0,
678 CopyEdgeProperties = 1 << 1,
679 CopyAllProperties = CopyVertexProperties | CopyEdgeProperties
691 std::vector<vertex_t> copiedVertices(vertexCount(),
Vertex());
696 boost::transitive_closure(
699 orig_to_copy(make_iterator_property_map(copiedVertices.begin(),
700 get(boost::vertex_index, graph)))
703 catch (boost::bad_graph& e)
705 qCDebug(DIGIKAM_DATABASE_LOG) << e.what();
710 copyProperties(closure, flags, copiedVertices);
721 std::vector<vertex_t> copiedVertices(vertexCount(),
Vertex());
728 boost::transitive_reduction(graph, reduction.
graph,
729 make_iterator_property_map(copiedVertices.begin(), get(boost::vertex_index, graph)),
730 get(boost::vertex_index, graph));
732 catch (boost::bad_graph& e)
734 qCDebug(DIGIKAM_DATABASE_LOG) << e.what();
739 copyProperties(reduction, flags, copiedVertices);
743 *removedEdges = edgeDifference(reduction, copiedVertices);
755 return findZeroDegree(direction ==
ParentToChild ?
true :
false);
765 return findZeroDegreeFrom(v, direction ==
ParentToChild ?
true :
false);
774 return findZeroDegree((direction ==
ParentToChild) ?
false :
true);
779 return findZeroDegreeFrom(v, (direction ==
ParentToChild) ?
false :
true);
795 return longestPathTouching(v, alwaysFalse<Vertex>);
798 template <
typename LessThan>
810 path.
longestPath(boost::make_reverse_graph(graph), v);
814 if (!rootCandidates.isEmpty())
816 std::stable_sort(rootCandidates.begin(), rootCandidates.end(), lessThan);
817 Vertex root = rootCandidates.first();
825 if (!leaveCandidates.isEmpty())
827 std::stable_sort(leaveCandidates.begin(), leaveCandidates.end(), lessThan);
828 Vertex leave = leaveCandidates.first();
834 return (fromRoot << v << toLeave);
838 return (toLeave << v << fromRoot);
863 verticesLst.prepend(v1);
874 verticesLst.append(v2);
900 typename QMap<Vertex, int>::iterator it;
904 if (it.value() == std::numeric_limits<int>::max())
928 if (v.
isNull() || isEmpty())
935 if (order == BreadthFirstOrder)
944 return verticesDominatedBy(v, root, search.
vertices);
952 template <
typename LessThan>
957 return verticesDominatedBy(v, root, verticesDepthFirstSorted(root, lessThan));
971 if (v.
isNull() || isEmpty())
977 tree.
enter(graph, root, direction);
985 foreach (
const Vertex& vv, presortedVertices)
987 if (dominatedTree.contains(vv))
1012 ref = roots().first();
1016 verticesLst << rootsOf(ref);
1018 if (verticesLst.size() == vertexCount())
1027 foreach (
const Vertex& v, verticesLst)
1034 if (verticesLst.size() == vertexCount())
1043 for (
vertex_iter it = range.first ; it != range.second ; ++it)
1045 if (!verticesLst.contains(*it))
1054 int minIndex = verticesLst.size();
1056 foreach (
const Vertex& c, childBfs)
1058 int foundAt = verticesLst.indexOf(c);
1066 minIndex = qMin(foundAt, minIndex);
1070 foreach (
const Vertex& c, toInsert)
1072 verticesLst.insert(minIndex++, c);
1086 template <
typename LessThan>
1098 ref = roots().first();
1102 verticesLst = rootsOf(ref);
1104 if ((verticesLst.size() == vertexCount()) || verticesLst.isEmpty())
1113 foreach (
const Vertex& v, verticesLst)
1129 treeFromPredecessorsRecursive(v, verticesLst, predecessors);
1139 vertices << children;
1141 foreach (
const Vertex& child, children)
1143 treeFromPredecessorsRecursive(child, vertices, predecessors);
1150 template <
typename Value,
typename range_t>
1153 typedef typename range_t::first_type iterator_t;
1156 for (iterator_t it = range.first ; it != range.second ; ++it)
1166 return toList<Vertex, range_t>(range);
1171 return toList<Edge, range_t>(range);
1174 template <
typename range_t>
1177 return (range.first == range.second);
1188 if (flags & CopyVertexProperties)
1193 for (
vertex_iter it = range.first ; it != range.second ; ++it)
1195 Vertex copiedVertex = copiedVertices[boost::get(indexMap, *it)];
1197 if (copiedVertex.
isNull())
1206 if (flags & CopyEdgeProperties)
1211 for (
edge_iter it = range.first ; it != range.second ; ++it)
1213 Vertex s = boost::source(*it, graph);
1214 Vertex t = boost::target(*it, graph);
1215 Vertex copiedS = copiedVertices[boost::get(indexMap, s)];
1216 Vertex copiedT = copiedVertices[boost::get(indexMap, t)];
1223 Edge copiedEdge = other.
edge(copiedS, copiedT);
1225 if (!copiedEdge.
isNull())
1243 for (
edge_iter it = range.first ; it != range.second ; ++it)
1245 Vertex s = boost::source(*it, graph);
1246 Vertex t = boost::target(*it, graph);
1247 Vertex copiedS = copiedVertices[boost::get(indexMap, s)];
1248 Vertex copiedT = copiedVertices[boost::get(indexMap, t)];
1255 Edge copiedEdge = other.
edge(copiedS, copiedT);
1274 for (
vertex_iter it = range.first ; it != range.second ; ++it)
1276 if ((inOrOut ? in_degree(*it, graph)
1277 : out_degree(*it, graph)) == 0)
1292 invertGraph = !invertGraph;
1302 if ((inOrOut ? in_degree(candidate, graph)
1303 : out_degree(candidate, graph)) == 0)
1305 verticesLst << candidate;
1320 template <
class GraphType>
1327 boost::dag_shortest_paths(graph, v,
1329 weight_map(boost::ref_property_map<
typename boost::graph_traits<GraphType>::edge_descriptor,
int>(weight)).
1336 catch (boost::bad_graph& e)
1338 qCDebug(DIGIKAM_DATABASE_LOG) << e.what();
1342 template <
class GraphType>
1349 boost::dag_shortest_paths(graph, v,
1351 weight_map(boost::ref_property_map<
typename boost::graph_traits<GraphType>::edge_descriptor,
int>(weight)).
1354 distance_compare(std::greater<int>()).
1364 catch (boost::bad_graph& e)
1366 qCDebug(DIGIKAM_DATABASE_LOG) << e.what();
1372 return (predecessors.value(v, v) != v);
1383 template <
class GraphType>
1394 boost::lengauer_tarjan_dominator_tree(boost::make_reverse_graph(graph), v,
1398 catch (boost::bad_graph& e)
1400 qCDebug(DIGIKAM_DATABASE_LOG) << e.what();
1411 template <
class GraphType>
1422 boost::depth_first_search(boost::make_reverse_graph(graph), visitor(vis).root_vertex(v));
1426 boost::depth_first_search(graph, visitor(vis).root_vertex(v));
1429 catch (boost::bad_graph& e)
1431 qCDebug(DIGIKAM_DATABASE_LOG) << e.what();
1435 template <
class GraphType,
typename LessThan>
1441 std::vector<boost::default_color_type> color_vec(boost::num_vertices(graph), boost::white_color);
1447 depth_first_search_sorted(boost::make_reverse_graph(graph), v, vis,
1448 make_iterator_property_map(color_vec.begin(), get(boost::vertex_index, graph)), lessThan);
1452 depth_first_search_sorted(graph, v, vis,
1453 make_iterator_property_map(color_vec.begin(), get(boost::vertex_index, graph)), lessThan);
1456 catch (boost::bad_graph& e)
1458 qCDebug(DIGIKAM_DATABASE_LOG) << e.what();
1462 template <
class GraphType>
1471 boost::breadth_first_search(boost::make_reverse_graph(graph), v, visitor(vis));
1475 boost::breadth_first_search(graph, v, visitor(vis));
1478 catch (boost::bad_graph& e)
1480 qCDebug(DIGIKAM_DATABASE_LOG) << e.what();
1511 template <
typename VertexType,
typename GraphType>
1528 template <
typename VertexType,
typename GraphType>
1539 template <
class GraphType,
typename VertexLessThan>
1542 typedef typename boost::graph_traits<GraphType>::edge_descriptor edge_descriptor;
1548 vertexLessThan(vertexLessThan)
1552 bool operator()(
const edge_descriptor& a,
const edge_descriptor& b)
1554 return vertexLessThan(boost::target(a, g), boost::target(b, g));
1564 template <
class Inc
idenceGraph,
class DFSVisitor,
class ColorMap,
typename LessThan>
1573 typedef typename boost::graph_traits<IncidenceGraph>::edge_descriptor edge_descriptor;
1578 boost::put(color, u, boost::gray_color);
1579 vis.discover_vertex(u, g);
1581 outEdges = toList<edge_descriptor>(boost::out_edges(u, g));
1587 std::sort(outEdges.begin(),
1591 foreach (
const edge_descriptor& e, outEdges)
1593 Vertex v = boost::target(e, g);
1594 vis.examine_edge(e, g);
1595 boost::default_color_type v_color = boost::get(color, v);
1597 if (v_color == boost::white_color)
1599 vis.tree_edge(e, g);
1600 depth_first_search_sorted(g, v, vis, color, lessThan);
1602 else if (v_color == boost::gray_color)
1604 vis.back_edge(e, g);
1608 vis.forward_or_cross_edge(e, g);
1612 put(color, u, boost::black_color);
1613 vis.finish_vertex(u, g);
1622 typename VertexIntMap::const_iterator it;
1626 for (it = distances.begin() ; it != distances.end() ; ++it)
1628 if (it.value() > maxDist)
1630 maxDist = it.value();
1637 if (it.value() >= maxDist)
1641 candidates << it.key();
1670 for (
Vertex v = root ; v != target ; v = predecessors.value(v))
1676 verticesLst.append(v);
1680 verticesLst.prepend(v);
1686 if (predecessors.value(v) == v)
1704 #if !defined(Q_OS_DARWIN) && defined(Q_CC_GNU)
1705 # pragma GCC diagnostic pop
1708 #if defined(Q_CC_CLANG)
1709 # pragma clang diagnostic pop
Definition: itemhistorygraph_boost.h:1380
VertexVertexMap predecessors
Definition: itemhistorygraph_boost.h:1404
void enter(const GraphType &graph, const Vertex &v, MeaningOfDirection direction=ParentToChild)
Definition: itemhistorygraph_boost.h:1384
Definition: itemhistorygraph_boost.h:226
Edge(const edge_t &e)
Definition: itemhistorygraph_boost.h:235
const edge_t & toEdge() const
Definition: itemhistorygraph_boost.h:259
edge_t & toEdge()
Definition: itemhistorygraph_boost.h:264
edge_t e
Definition: itemhistorygraph_boost.h:281
Edge & operator=(const edge_t &other)
Definition: itemhistorygraph_boost.h:241
bool operator==(const edge_t &other) const
Definition: itemhistorygraph_boost.h:269
bool isNull() const
Definition: itemhistorygraph_boost.h:274
Edge()
Definition: itemhistorygraph_boost.h:229
Definition: itemhistorygraph_boost.h:1520
void discover_vertex(VertexType u, const GraphType &) const
Definition: itemhistorygraph_boost.h:1529
BreadthFirstSearchVisitor(GraphSearch *const q)
Definition: itemhistorygraph_boost.h:1523
Definition: itemhistorygraph_boost.h:1485
CommonVisitor(GraphSearch *const q)
Definition: itemhistorygraph_boost.h:1488
void record(const Vertex &v) const
Definition: itemhistorygraph_boost.h:1493
GraphSearch *const q
Definition: itemhistorygraph_boost.h:1498
Definition: itemhistorygraph_boost.h:1503
void discover_vertex(VertexType u, const GraphType &) const
Definition: itemhistorygraph_boost.h:1512
DepthFirstSearchVisitor(GraphSearch *const q)
Definition: itemhistorygraph_boost.h:1506
Definition: itemhistorygraph_boost.h:1541
VertexLessThan vertexLessThan
Definition: itemhistorygraph_boost.h:1560
bool operator()(const edge_descriptor &a, const edge_descriptor &b)
Definition: itemhistorygraph_boost.h:1552
const GraphType & g
Definition: itemhistorygraph_boost.h:1559
lessThanMapEdgeToTarget(const GraphType &g, VertexLessThan vertexLessThan)
Definition: itemhistorygraph_boost.h:1546
Definition: itemhistorygraph_boost.h:1408
void depth_first_search_sorted(const IncidenceGraph &g, Vertex u, DFSVisitor &vis, ColorMap color, LessThan lessThan)
This is boost's simple, old, recursive DFS algorithm adapted with lessThan.
Definition: itemhistorygraph_boost.h:1565
QList< Vertex > vertices
Definition: itemhistorygraph_boost.h:1535
void depthFirstSearchSorted(const GraphType &graph, const Vertex &v, bool invertGraph, LessThan lessThan)
Definition: itemhistorygraph_boost.h:1436
void breadthFirstSearch(const GraphType &graph, const Vertex &v, bool invertGraph)
Definition: itemhistorygraph_boost.h:1463
void depthFirstSearch(const GraphType &graph, const Vertex &v, bool invertGraph)
Definition: itemhistorygraph_boost.h:1412
Definition: itemhistorygraph_boost.h:1317
VertexIntMap distances
Definition: itemhistorygraph_boost.h:1376
VertexVertexMap predecessors
Definition: itemhistorygraph_boost.h:1375
void longestPath(const GraphType &graph, const Vertex &v)
Definition: itemhistorygraph_boost.h:1343
bool isReachable(const Vertex &v) const
Definition: itemhistorygraph_boost.h:1370
void shortestPath(const GraphType &graph, const Vertex &v)
Definition: itemhistorygraph_boost.h:1321
Definition: itemhistorygraph_boost.h:179
Vertex()
Definition: itemhistorygraph_boost.h:182
vertex_t v
Definition: itemhistorygraph_boost.h:222
Vertex(const vertex_t &v)
Definition: itemhistorygraph_boost.h:188
bool operator==(const vertex_t &other) const
Definition: itemhistorygraph_boost.h:210
Vertex & operator=(const vertex_t &other)
Definition: itemhistorygraph_boost.h:193
bool isNull() const
Definition: itemhistorygraph_boost.h:215
Definition: itemhistorygraph_boost.h:130
std::pair< vertex_iter, vertex_iter > vertex_range_t
Definition: itemhistorygraph_boost.h:164
void clear()
Definition: itemhistorygraph_boost.h:328
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, boost::property< boost::vertex_index_t, int, boost::property< vertex_properties_t, VertexProperties > >, boost::property< edge_properties_t, EdgeProperties > > GraphContainer
Definition: itemhistorygraph_boost.h:140
QList< Vertex > longestPathTouching(const Vertex &v, LessThan lessThan) const
Definition: itemhistorygraph_boost.h:799
QList< Vertex > mostRemoteNodes(const VertexIntMap &distances) const
Definition: itemhistorygraph_boost.h:1620
QMapForAdaptors< Vertex, Vertex > VertexVertexMap
Definition: itemhistorygraph_boost.h:292
QList< Vertex > longestPathTouching(const Vertex &v) const
Definition: itemhistorygraph_boost.h:793
Graph(const Graph &g)
Definition: itemhistorygraph_boost.h:305
bool hasEdge(const Vertex &v1, const Vertex &v2) const
Definition: itemhistorygraph_boost.h:383
bool isEmpty() const
Definition: itemhistorygraph_boost.h:525
MeaningOfDirection meaningOfDirection() const
Definition: itemhistorygraph_boost.h:323
VertexProperties & properties(const Vertex &v)
Definition: itemhistorygraph_boost.h:414
QList< Vertex > verticesDominatedBy(const Vertex &v, const Vertex &root, const QList< Vertex > &presortedVertices) const
Definition: itemhistorygraph_boost.h:967
QMap< Vertex, int > shortestDistancesFrom(const Vertex &v) const
Definition: itemhistorygraph_boost.h:885
QList< Vertex > findZeroDegree(bool inOrOut) const
Definition: itemhistorygraph_boost.h:1269
QPair< Edge, Edge > EdgePair
Definition: itemhistorygraph_boost.h:290
boost::property_map< GraphContainer, vertex_properties_t >::const_type const_vertex_property_map_t
Definition: itemhistorygraph_boost.h:170
void remove(const Vertex &v)
Definition: itemhistorygraph_boost.h:348
bool isLeaf(const Vertex &v) const
Definition: itemhistorygraph_boost.h:545
boost::property_map< GraphContainer, edge_properties_t >::const_type const_edge_property_map_t
Definition: itemhistorygraph_boost.h:172
QList< Vertex > findZeroDegreeFrom(const Vertex &v, bool inOrOut) const
Definition: itemhistorygraph_boost.h:1286
QList< VertexPair > edgePairs() const
Definition: itemhistorygraph_boost.h:637
Vertex target(const Edge &e) const
Definition: itemhistorygraph_boost.h:555
QList< Vertex > treeFromPredecessors(const Vertex &v, const VertexVertexMap &predecessors) const
Definition: itemhistorygraph_boost.h:1125
boost::property_map< GraphContainer, vertex_properties_t >::type vertex_property_map_t
Definition: itemhistorygraph_boost.h:169
std::pair< edge_iter, edge_iter > edge_range_t
Definition: itemhistorygraph_boost.h:165
AdjacencyFlags
Definition: itemhistorygraph_boost.h:480
GraphCopyFlags
Definition: itemhistorygraph_boost.h:676
QList< Vertex > roots() const
Definition: itemhistorygraph_boost.h:753
const VertexProperties & properties(const Vertex &v) const
Definition: itemhistorygraph_boost.h:409
graph_traits::vertex_descriptor vertex_t
Definition: itemhistorygraph_boost.h:147
boost::inv_adjacency_iterator_generator< GraphContainer, vertex_t, in_edge_iter >::type inv_adjacency_iter
Definition: itemhistorygraph_boost.h:157
QList< Edge > edgeDifference(const Graph &other, const std::vector< vertex_t > &copiedVertices) const
Definition: itemhistorygraph_boost.h:1237
QList< Vertex > topologicalSort() const
Definition: itemhistorygraph_boost.h:655
boost::graph_traits< GraphContainer > graph_traits
Definition: itemhistorygraph_boost.h:145
static QList< Edge > toEdgeList(const range_t &range)
Definition: itemhistorygraph_boost.h:1169
void setProperties(const Vertex &v, const VertexProperties &props)
Definition: itemhistorygraph_boost.h:404
int edgeCount() const
Definition: itemhistorygraph_boost.h:589
boost::property_map< GraphContainer, boost::vertex_index_t >::const_type const_vertex_index_map_t
Definition: itemhistorygraph_boost.h:168
int outDegree(const Vertex &v) const
Definition: itemhistorygraph_boost.h:530
Edge edge(const Vertex &v1, const Vertex &v2) const
Definition: itemhistorygraph_boost.h:371
QList< Vertex > leaves() const
Definition: itemhistorygraph_boost.h:772
EdgeProperties properties(const Vertex &v1, const Vertex &v2) const
Definition: itemhistorygraph_boost.h:444
graph_traits::vertex_iterator vertex_iter
Definition: itemhistorygraph_boost.h:150
QMapForAdaptors< Vertex, int > VertexIntMap
Definition: itemhistorygraph_boost.h:293
QList< Vertex > rootsOf(const Vertex &v) const
Definition: itemhistorygraph_boost.h:763
MeaningOfDirection direction
Definition: itemhistorygraph_boost.h:1698
bool isRoot(const Vertex &v) const
Definition: itemhistorygraph_boost.h:540
void treeFromPredecessorsRecursive(const Vertex &v, QList< Vertex > &vertices, const VertexVertexMap &predecessors) const
Definition: itemhistorygraph_boost.h:1134
std::pair< inv_adjacency_iter, inv_adjacency_iter > inv_adjacency_vertex_range_t
Definition: itemhistorygraph_boost.h:162
QList< Vertex > vertices() const
Definition: itemhistorygraph_boost.h:474
graph_traits::edge_iterator edge_iter
Definition: itemhistorygraph_boost.h:151
QPair< Vertex, Vertex > VertexPair
Definition: itemhistorygraph_boost.h:289
static QList< Value > toList(const range_t &range)
Definition: itemhistorygraph_boost.h:1151
bool hasEdges() const
Definition: itemhistorygraph_boost.h:627
int inDegree(const Vertex &v) const
Definition: itemhistorygraph_boost.h:535
Graph transitiveClosure(GraphCopyFlags flags=CopyAllProperties) const
Definition: itemhistorygraph_boost.h:685
std::pair< out_edge_iter, out_edge_iter > out_edge_range_t
Definition: itemhistorygraph_boost.h:163
QList< Vertex > verticesDominatedBy(const Vertex &v, const Vertex &root, ReturnOrder order=BreadthFirstOrder) const
Definition: itemhistorygraph_boost.h:924
graph_traits::out_edge_iterator out_edge_iter
Definition: itemhistorygraph_boost.h:153
graph_traits::degree_size_type degree_t
Definition: itemhistorygraph_boost.h:159
QList< Vertex > verticesBreadthFirst(const Vertex &givenRef=Vertex()) const
Definition: itemhistorygraph_boost.h:1001
void copyProperties(Graph &other, GraphCopyFlags flags, const std::vector< vertex_t > &copiedVertices) const
Definition: itemhistorygraph_boost.h:1184
int vertexCount() const
NOTE: for "hasAdjacentVertices", simply use hasEdges(v, flags)
Definition: itemhistorygraph_boost.h:520
static QList< Vertex > toVertexList(const range_t &range)
Definition: itemhistorygraph_boost.h:1164
Vertex findVertexByProperties(const T &value) const
Definition: itemhistorygraph_boost.h:425
boost::property_map< GraphContainer, boost::vertex_index_t >::type vertex_index_map_t
Definition: itemhistorygraph_boost.h:167
std::pair< adjacency_iter, adjacency_iter > adjacency_vertex_range_t
Definition: itemhistorygraph_boost.h:161
boost::associative_property_map< VertexIntMap > VertexIntMapAdaptor
Definition: itemhistorygraph_boost.h:296
boost::property_map< GraphContainer, edge_properties_t >::type edge_property_map_t
Definition: itemhistorygraph_boost.h:171
Edge addEdge(const Vertex &v1, const Vertex &v2)
Definition: itemhistorygraph_boost.h:359
ReturnOrder
Definition: itemhistorygraph_boost.h:914
@ BreadthFirstOrder
Definition: itemhistorygraph_boost.h:915
bool hasEdges(const Vertex &v, AdjacencyFlags flags=AllEdges) const
Definition: itemhistorygraph_boost.h:594
bool isConnected(const Vertex &v1, const Vertex &v2) const
Does not care for direction.
Definition: itemhistorygraph_boost.h:389
void setProperties(const Edge &e, const EdgeProperties &props)
Definition: itemhistorygraph_boost.h:419
static bool alwaysFalse(const T &, const T &)
Definition: itemhistorygraph_boost.h:782
graph_traits::edge_descriptor edge_t
Definition: itemhistorygraph_boost.h:148
GraphContainer graph
Definition: itemhistorygraph_boost.h:1697
boost::associative_property_map< VertexVertexMap > VertexVertexMapAdaptor
Definition: itemhistorygraph_boost.h:295
QList< Vertex > shortestPath(const Vertex &v1, const Vertex &v2) const
Definition: itemhistorygraph_boost.h:848
Graph(MeaningOfDirection direction=ParentToChild)
Definition: itemhistorygraph_boost.h:300
graph_traits::in_edge_iterator in_edge_iter
Definition: itemhistorygraph_boost.h:154
const EdgeProperties & properties(const Edge &e) const
Definition: itemhistorygraph_boost.h:456
EdgeProperties & properties(const Edge &e)
Definition: itemhistorygraph_boost.h:461
QList< Vertex > verticesDepthFirstSorted(const Vertex &givenRef, LessThan lessThan) const
Definition: itemhistorygraph_boost.h:1087
static bool isEmptyRange(const range_t &range)
Definition: itemhistorygraph_boost.h:1175
Vertex addVertex(const VertexProperties &properties)
Definition: itemhistorygraph_boost.h:340
graph_traits::adjacency_iterator adjacency_iter
Definition: itemhistorygraph_boost.h:152
QList< Vertex > adjacentVertices(const Vertex &v, AdjacencyFlags flags=AllEdges) const
Definition: itemhistorygraph_boost.h:490
const GraphContainer & getGraph() const
Definition: itemhistorygraph_boost.h:469
QList< Vertex > leavesFrom(const Vertex &v) const
Definition: itemhistorygraph_boost.h:777
QList< Vertex > verticesDominatedByDepthFirstSorted(const Vertex &v, const Vertex &root, LessThan lessThan) const
Definition: itemhistorygraph_boost.h:953
virtual ~Graph()
Definition: itemhistorygraph_boost.h:311
Graph & operator=(const Graph &other)
Definition: itemhistorygraph_boost.h:315
QList< Vertex > listPath(const Vertex &root, const Vertex &target, const VertexVertexMap &predecessors, MeaningOfDirection dir=ParentToChild) const
Definition: itemhistorygraph_boost.h:1663
Vertex addVertex()
Definition: itemhistorygraph_boost.h:333
QList< Edge > edges() const
Definition: itemhistorygraph_boost.h:632
QList< Edge > edges(const Vertex &v, AdjacencyFlags flags=AllEdges) const
Definition: itemhistorygraph_boost.h:560
Graph transitiveReduction(QList< Edge > *removedEdges=0, GraphCopyFlags flags=CopyAllProperties) const
Definition: itemhistorygraph_boost.h:719
Vertex source(const Edge &e) const
Definition: itemhistorygraph_boost.h:550
Definition: itemhistorygraph_boost.h:102
Key key_type
Definition: itemhistorygraph_boost.h:105
QMapForAdaptors()
Definition: itemhistorygraph_boost.h:109
Value data_type
Definition: itemhistorygraph_boost.h:106
std::pair< const Key, Value > value_type
Definition: itemhistorygraph_boost.h:107
Definition: piwigotalker.h:48
edge_properties_t
Definition: itemhistorygraph_boost.h:85
@ edge_properties
Definition: itemhistorygraph_boost.h:85
vertex_properties_t
Definition: itemhistorygraph_boost.h:84
@ vertex_properties
Definition: itemhistorygraph_boost.h:84
qulonglong value
Definition: itemviewutilities.cpp:592
@ LessThan
Definition: coredbsearchxml.h:71
Definition: datefolderview.cpp:43
MeaningOfDirection
Definition: itemhistorygraph_boost.h:120
@ ParentToChild
Edges are directed from a parent to its child.
Definition: itemhistorygraph_boost.h:121
@ ChildToParent
Edges are direct from a child to its parent.
Definition: itemhistorygraph_boost.h:122