mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-10-10 16:22:22 +03:00
Introduce custom adjacency-list based graph
This commit is contained in:
@@ -44,11 +44,10 @@
|
||||
#include "util/charreach.h"
|
||||
#include "util/depth.h"
|
||||
#include "util/ue2_containers.h"
|
||||
#include "util/ue2_graph.h"
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
|
||||
namespace ue2 {
|
||||
|
||||
@@ -139,7 +138,7 @@ struct RoseSuffixInfo {
|
||||
/** \brief Properties attached to each Rose graph vertex. */
|
||||
struct RoseVertexProps {
|
||||
/** \brief Unique dense vertex index. Used for BGL algorithms. */
|
||||
size_t idx = ~size_t{0};
|
||||
size_t index = ~size_t{0};
|
||||
|
||||
/** \brief IDs of literals in the Rose literal map. */
|
||||
flat_set<u32> literals;
|
||||
@@ -183,6 +182,9 @@ struct RoseVertexProps {
|
||||
/** \brief Properties attached to each Rose graph edge. */
|
||||
/* bounds are distance from end of prev to start of the next */
|
||||
struct RoseEdgeProps {
|
||||
/** \brief Unique dense vertex index. Used for BGL algorithms. */
|
||||
size_t index = ~size_t{0};
|
||||
|
||||
/**
|
||||
* \brief Minimum distance from the end of the source role's match to the
|
||||
* start of the target role's match.
|
||||
@@ -215,18 +217,10 @@ bool operator<(const RoseEdgeProps &a, const RoseEdgeProps &b);
|
||||
|
||||
/**
|
||||
* \brief Core Rose graph structure.
|
||||
*
|
||||
* Note that we use the list selector for the edge and vertex lists: we depend
|
||||
* on insertion order for determinism, so we must use these containers.
|
||||
*/
|
||||
using RoseGraph = boost::adjacency_list<boost::listS, // out edge list per vertex
|
||||
boost::listS, // vertex list
|
||||
boost::bidirectionalS, // bidirectional
|
||||
RoseVertexProps, // bundled vertex properties
|
||||
RoseEdgeProps, // bundled edge properties
|
||||
boost::listS // graph edge list
|
||||
>;
|
||||
|
||||
struct RoseGraph : public ue2_graph<RoseGraph, RoseVertexProps, RoseEdgeProps> {
|
||||
friend class RoseBuildImpl; /* to allow index renumbering */
|
||||
};
|
||||
using RoseVertex = RoseGraph::vertex_descriptor;
|
||||
using RoseEdge = RoseGraph::edge_descriptor;
|
||||
|
||||
|
Reference in New Issue
Block a user