ALPS Project: lattice library

Header file: lattice/graph_traits.h

defines mappings of Boost Graph library functions and types to names more suited to a lattice model notation.

Synopsis

namespace alps {
template <class G>
struct graph_traits : public boost::graph_traits<G>
{
typedef G graph_type;
typedef typename boost::graph_traits<graph_type>::vertex_iterator site_iterator;
typedef typename boost::graph_traits<graph_type>::edge_iterator bond_iterator;
typedef typename boost::graph_traits<graph_type>::out_edge_iterator neighbor_bond_iterator;
typedef typename boost::graph_traits<graph_type>::edge_descriptor bond_descriptor;
typedef typename boost::graph_traits<graph_type>::vertex_descriptor site_descriptor;
typedef typename boost::graph_traits<graph_type>::vertices_size_type sites_size_type;
typedef typename boost::graph_traits<graph_type>::edges_size_type bonds_size_type;
typedef typename boost::graph_traits<graph_type>::degree_size_type neighbors_size_type;
typedef typename boost::graph_traits<graph_type>::adjacency_iterator neighbor_iterator;
};

template <class G>
std::pair<typename graph_traits<G>::site_iterator, typename graph_traits<G>::site_iterator>
sites(const G& g);

template <class G>
typename graph_traits<G>::sites_size_type num_sites (const G& g);

template <class G>
std::pair<typename graph_traits<G>::bond_iterator, typename graph_traits<G>::bond_iterator>
bonds(const G& g);

template <class G>
typename graph_traits<G>::bonds_size_type num_bonds (const G& g);

template <class V, class G>
typename graph_traits<G>::degree_size_type
num_neighbors(const V& v, const G& g);

template <class V, class G>
std::pair<typename graph_traits<G>::neighbor_bond_iterator, typename graph_traits<G>::neighbor_bond_iterator>
neighbor_bonds(const V& v, const G& g);

template <class V, class G>
std::pair<typename graph_traits<G>::neighbor_iterator, typename graph_traits<G>::neighbor_iterator>
neighbors(const V& v, const G& g);

template <class G>
typename graph_traits<G>::site_descriptor site(typename graph_traits<G>::sites_size_type i, const G& g);

template <class V, class G>
typename graph_traits<G>::site_descriptor
neighbor (const V& v, typename graph_traits<G>::degree_size_type i, const G& g)

template <class T>
const typename graph_traits::graph_type& graph(const T& x);

}

Description

the traits classes and functions rename Boost graph library types and functions to the equivalent notation for lattice models:

Boost Graph Library notation Lattice model notation
vertex_iterator site_iterator
edge_iterator bond_iterator
out_edge_iterator neighbor_bond_iterator
edge_descriptor bond_descriptor
vertex_descriptor site_descriptor
vertices_size_type sites_size_type
edges_size_type bonds_size_type
degree_size_type neighbors_size_type
adjacency_iterator neighbor_iterator
vertices sites
num_vertices num_sites
edges bonds
num_edges num_bonds
out_degree num_neighbors
out_edges neighbor_bonds
adjacent_vertices neighbors
vertex site

In addition we define the following useful functions:

template <class V, class G> 
typename graph_traits<G>::site_descriptor
neighbor (const V& v, typename graph_traits<G>::degree_size_type i, const G& g)
return the i-th neighbor of a site.
template <class T>
const typename graph_traits::graph_type& graph(const T& x);
extract a graph from an object containing one (e.g. a lattice graph, a graph library, etc.).

copyright (c) 1994-2010 by Matthias Troyer

Distributed under the Boost Software License, Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt)