NetOptim 1.2.6
Loading...
Searching...
No Matches
Typedefs | Functions
test_cases_boost.hpp File Reference

Test case generators using Boost Graph Library. More...

#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_traits.hpp>
#include <py2cpp/nx2bgl.hpp>
#include <utility>
Include dependency graph for test_cases_boost.hpp:

Go to the source code of this file.

Typedefs

using graph_t = boost::adjacency_list< boost::listS, boost::vecS, boost::directedS, boost::no_property, boost::property< boost::edge_weight_t, int, boost::property< boost::edge_index_t, int > > >
 Type alias for Boost adjacency list with edge weights and indices.
 
using Vertex = boost::graph_traits< graph_t >::vertex_descriptor
 Type alias for vertex descriptor.
 
using Edge_it = boost::graph_traits< graph_t >::edge_iterator
 Type alias for edge iterator.
 

Functions

template<typename Mapping >
auto create_test_case1 (const Mapping &weights) -> py::GraphAdaptor< graph_t >
 Create a simple 5-node cycle test graph.
 
template<typename Mapping >
auto create_test_case_timing (const Mapping &weights) -> py::GraphAdaptor< graph_t >
 Create a 3-node timing test graph with parallel edges.
 

Detailed Description

Test case generators using Boost Graph Library.

This module provides factory functions for creating test graphs using the Boost Graph Library (BGL) adjacency list implementation. These test cases are designed for testing network optimization algorithms.

The graphs created are wrapped in py::GraphAdaptor for compatibility with the network optimization algorithms.

Typedef Documentation

◆ Edge_it

using Edge_it = boost::graph_traits<graph_t>::edge_iterator

Type alias for edge iterator.

◆ graph_t

using graph_t = boost::adjacency_list< boost::listS, boost::vecS, boost::directedS, boost::no_property, boost::property<boost::edge_weight_t, int, boost::property<boost::edge_index_t, int> >>

Type alias for Boost adjacency list with edge weights and indices.

◆ Vertex

using Vertex = boost::graph_traits<graph_t>::vertex_descriptor

Type alias for vertex descriptor.

Function Documentation

◆ create_test_case1()

template<typename Mapping >
auto create_test_case1 ( const Mapping &  weights) -> py::GraphAdaptor<graph_t>
inline

Create a simple 5-node cycle test graph.

This function creates a simple directed cycle with 5 vertices. The graph structure is: A -> B -> C -> D -> E -> A This is useful for testing basic cycle detection and ratio algorithms.

Template Parameters
MappingType of weight mapping (edge -> weight)
Parameters
[in]weightsweights for the edges in order of creation
Returns
py::GraphAdaptor<graph_t> wrapped Boost graph

◆ create_test_case_timing()

template<typename Mapping >
auto create_test_case_timing ( const Mapping &  weights) -> py::GraphAdaptor<graph_t>
inline

Create a 3-node timing test graph with parallel edges.

This function creates a more complex graph with 3 vertices and multiple parallel edges between each pair. This is useful for testing algorithms that need to handle graphs with parallel edges and more complex cycle structures.

The graph includes:

  • Bidirectional edges between A and B
  • Multiple parallel edges between B and C
  • Bidirectional edges between C and A
Template Parameters
MappingType of weight mapping (edge -> weight)
Parameters
[in]weightsweights for the edges in order of creation
Returns
py::GraphAdaptor<graph_t> wrapped Boost graph