IterOrbit
Subgraph isomorphism with iterative graphlet-orbit filtering
Loading...
Searching...
No Matches
FilterEngine.h
Go to the documentation of this file.
1
3
4#ifndef FILTER_ENGINE_H
5#define FILTER_ENGINE_H
6
7#include "AppGraph.h"
8#include "OrbitCounter.h"
9#include <cstdint>
10#include <string>
11
13using CandidateSets = std::unordered_map<int, std::vector<int>>;
14
23public:
49 FilterEngine(const AppGraph& data, const AppGraph& pattern, int g_size, bool use_full_graph_mode,
50 int max_iters = 1, bool print_stats = true,
51 bool enable_orbit_throttle = false, double orbit_throttle_threshold = 0.05,
52 bool enable_semi_join = true, bool arc_consistency = true,
53 bool enable_orbit_filter = true, bool post_orbit_induction = true,
54 bool edge_thinning = false);
55
58 bool run();
59
63 const OrbitCounts& getPatternOrbits() const { return pattern_orbits; }
67
70 void countCandidates(const std::string& filter_step_name) const;
71
72private:
75 bool ldfNlfFilter(size_t& ldf_only_count);
78 bool nlfFilter(const AppGraph& neighbor_graph);
80 bool semiJoinFilter(const AppGraph& neighbor_graph);
81 bool arcConsistencyFilter(const AppGraph& neighbor_graph);
84 bool orbitFilter();
88 struct OwnedCGraph {
89 std::vector<Escape::EdgeIdx> offsets;
90 std::vector<Escape::VertexIdx> nbors;
91 Escape::CGraph view{};
92 };
95 void thinEdges(const AppGraph& g, OwnedCGraph& out) const;
97 size_t getCandidateCount() const;
98
112
116 std::vector<bool> needed_orbits;
118 std::unordered_map<int, std::unordered_map<int, int>> pattern_nlf;
123 size_t subgraph_candidate_count = SIZE_MAX;
124};
125
126#endif
The graph type shared by the pattern, the data graph and its induced subgraphs.
std::unordered_map< int, std::vector< int > > CandidateSets
A candidate assignment: pattern node ID -> the data node IDs it may be mapped to.
Definition FilterEngine.h:13
Graphlet orbit counting on top of the Escape/EVOKE library.
std::vector< std::vector< long long > > OrbitCounts
Graphlet orbit counts of a graph: counts[i][k] is the number of non-induced occurrences of orbit k ro...
Definition OrbitCounter.h:16
Definition AppGraph.h:32
Iterative orbit filtering (Algorithm 1 of the paper, IterOrbitFilter).
Definition FilterEngine.h:22
bool semiJoinFilter(const AppGraph &neighbor_graph)
Semi-join against neighbor_graph, to arc consistency unless disabled.
Definition FilterEngine.cpp:405
CandidateSets candidate_sets
Definition FilterEngine.h:113
AppGraph candidate_subgraph
Definition FilterEngine.h:120
std::unordered_map< int, std::unordered_map< int, int > > pattern_nlf
Per pattern node ID: label -> number of pattern neighbours with that label.
Definition FilterEngine.h:118
void induceCandidateSubgraph()
Sets candidate_subgraph to the data graph induced on the union of the candidate sets.
Definition FilterEngine.cpp:41
const AppGraph & pattern_graph
Definition FilterEngine.h:100
const AppGraph & getCandidateSubgraph() const
The data graph induced on the final candidates (the whole data graph in full-graph mode).
Definition FilterEngine.h:66
double orbit_throttle_threshold
Definition FilterEngine.h:106
bool nlfFilter(const AppGraph &neighbor_graph)
NLF against neighbor_graph: keeps v in C(u) only if v's neighbours there cover the label multiset of ...
Definition FilterEngine.cpp:322
void thinEdges(const AppGraph &g, OwnedCGraph &out) const
g without the edges no pattern edge can map to (see edge_thinning): same vertices and internal indice...
Definition FilterEngine.cpp:699
bool enable_semi_join
Definition FilterEngine.h:107
size_t subgraph_candidate_count
Candidate count when candidate_subgraph was last induced (SIZE_MAX: not yet).
Definition FilterEngine.h:123
int max_data_label
Definition FilterEngine.h:119
const AppGraph & data_graph
Definition FilterEngine.h:99
int max_iterations
Definition FilterEngine.h:103
const CandidateSets & getCandidateSets() const
The candidate sets after run().
Definition FilterEngine.h:61
int graphlet_size
Definition FilterEngine.h:101
const OrbitCounts & getPatternOrbits() const
Orbit counts of the pattern, indexed by the pattern's internal index.
Definition FilterEngine.h:63
OrbitCounts pattern_orbits
Definition FilterEngine.h:114
size_t getCandidateCount() const
Total number of candidates over all pattern vertices.
Definition FilterEngine.cpp:61
bool enable_orbit_filter
Definition FilterEngine.h:109
bool print_stats
Definition FilterEngine.h:104
bool orbitFilter()
Induces the candidate subgraph, counts its orbits and keeps v in C(u) only if every orbit count of v ...
Definition FilterEngine.cpp:570
bool arc_consistency
Definition FilterEngine.h:108
void countCandidates(const std::string &filter_step_name) const
Prints size statistics of the current candidate sets under the given heading (only when statistics ar...
Definition FilterEngine.cpp:745
bool use_subgraph
Definition FilterEngine.h:102
bool edge_thinning
Definition FilterEngine.h:111
std::vector< bool > needed_orbits
Orbits some pattern vertex has; the data graph's other orbits are not counted.
Definition FilterEngine.h:116
bool run()
Runs the filter.
Definition FilterEngine.cpp:69
bool ldfNlfFilter(size_t &ldf_only_count)
LDF, and round 1's NLF on the full data graph, in one pass.
Definition FilterEngine.cpp:228
bool enable_orbit_throttle
Definition FilterEngine.h:105
bool post_orbit_induction
Definition FilterEngine.h:110
bool arcConsistencyFilter(const AppGraph &neighbor_graph)
Definition FilterEngine.cpp:476
A graph in CSR form that owns its arrays; view points into them.
Definition FilterEngine.h:88
std::vector< Escape::EdgeIdx > offsets
Definition FilterEngine.h:89
Escape::CGraph view
Definition FilterEngine.h:91
std::vector< Escape::VertexIdx > nbors
Definition FilterEngine.h:90