Skip to content

pawelswoboda/dag-reachability

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dag-reachability

Reachability and transitive reduction for DAGs

C++ algorithms for deciding reachability in directed acyclic graphs (DAG) and for computing the transitive reduction. Reachability algorithms are based on [1] and [2]. The transitivity algorithm is based on [3].

Usage

Reachability:

#include "bloom_filter_plus.h"
...
std::vector<std::array<size_t,2>> edges = {{0,1}, {1,2}, {2,3}};
TR::bloom_filter_plus rq(edges.begin(), edges.end());
rq.query(0,2) == reach::reachable; // true
rq.query(2,0) == reach::unreachable; // true
...

Transitive reduction:

#include "transitivity_reduction.h"
...
std::vector<std::array<size_t,2>> edges = {{0,1}, {1,2}, {2,3}, {0,2}};
const std::vector<std::array<size_t,2>> reduced_edges = TR::transitive_reduction(edges.begin(), edges.end());
reduced_edges = {{0,1}, {1,2}, {2,3}}; // true
...

References

About

Reachability and transitive reduction for DAGs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published