bool happens_before(typename Graph::vertex_name_type const& u_,
                    VertexNameOrDescriptor const& v,
                    Graph const& graph) {
    typedef typename boost::graph_traits<Graph>::vertex_descriptor Vertex;
    boost::optional<Vertex> u = find_vertex(u_, graph);
    return u && happens_before(*u, v, graph);
}
bool happens_before(typename boost::graph_traits<Graph>::vertex_descriptor u,
                    typename Graph::vertex_name_type const& v_,
                    Graph const& graph) {
    typedef typename boost::graph_traits<Graph>::vertex_descriptor Vertex;
    boost::optional<Vertex> v = find_vertex(v_, graph);
    return v && happens_before(u, *v, graph);
}
VectorClock::values_t HappensBeforeBase::incomparable_after(const index_t i1,
                                                            const index_t i2) const
{
   VectorClock::values_t Incomparable{};
   for (int j = i1 + 1; j < i2; ++j)
   {
      if (!happens_before(i1, j))
      {
         Incomparable.insert(j);
      }
   }
   DEBUGF("\t" << outputname(), "incomparable_after", "[" << i1 << "]", " = " << Incomparable << "\n");
   return Incomparable;
}
bool HappensBeforeBase::happens_before(const index_t i1, const index_t i2) const
{
   /// @pre defined_on_prefix(max(i1,i2))
   assert(defined_on_prefix(std::max(i1, i2)));
   return happens_before(i1, (*this)[i2]);
}
void HappensBeforeBase::transitive_reduction(const index_t i1, VectorClock& clock2) const
{
   /// @pre happens_before(i1, clock2)
   assert(happens_before(i1, clock2));
   clock2.filter_values_greater_than((*this)[i1]);
}