// Copyright 2008-2010 Gordon Woodhull
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_MSM_MPL_GRAPH_DETAIL_ADJACENCY_LIST_GRAPH_IPP_INCLUDED
#define BOOST_MSM_MPL_GRAPH_DETAIL_ADJACENCY_LIST_GRAPH_IPP_INCLUDED
// implementation of a graph declared in adjacency list format
// sequence< pair< source_vertex, sequence< pair > > >
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
namespace boost {
namespace msm {
namespace mpl_graph {
namespace detail {
// tag identifying graph implementation as adjacency list (not defined)
struct adjacency_list_tag;
// outs map is really just the same data with the sequences turned into maps
// it might make sense to make another adjacency_map implementation for that case
template
struct produce_al_outs_map :
mpl::reverse_fold,
mpl::insert, mpl_utils::as_map > > > >
{};
// Edge->Target map for a Source for out_*, degree
template
struct produce_out_map :
mpl::at::type, Source>
{};
template
struct produce_in_adjacencies :
mpl::reverse_fold,
mpl::insert, mpl::map<> >,
mpl::pair, Source> > > > >
{};
template
struct produce_al_ins_map :
mpl::reverse_fold,
produce_in_adjacencies, mpl::second > >
{};
// Edge->Source map for a Target for in_*, degree
template
struct produce_in_map :
mpl::at::type, Target>
{};
// for everything else to do with edges,
// just produce an incidence list and forward to that graph implementation
// (produce_out_map could, and produce_in_map probably should, be implemented this way too)
template
struct produce_adjacencies_incidences : // adjacencies'
mpl::reverse_fold, Source, mpl::second > > >
{};
template
struct produce_incidence_list_from_adjacency_list :
mpl::reverse_fold,
produce_adjacencies_incidences, mpl::second > >
{};
// Edge->pair map for source, target
template
struct produce_edge_st_map :
produce_edge_st_map::type>
{};
// adjacency list supports zero-degree vertices, which incidence list does not
template
struct insert_adjacencies_targets : // adjacencies'
mpl::reverse_fold > >
{};
template
struct produce_vertex_set :
mpl::reverse_fold,
insert_adjacencies_targets >,
mpl::second > >
{};
// Edge set for EdgeListGraph
template
struct produce_edge_set :
produce_edge_set::type>
{};
} // namespaces
}
}
}
#endif // BOOST_MSM_MPL_GRAPH_DETAIL_ADJACENCY_LIST_GRAPH_IPP_INCLUDED