Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
random_graph.cc File Reference

Tests for Random Graph. More...

#include <gtest/gtest.h>
#include <random_graph.H>
#include <tpl_graph.H>
#include <tpl_graph_utils.H>
Include dependency graph for random_graph.cc:

Go to the source code of this file.

Classes

struct  NodeInitializer
 
struct  ArcInitializer
 

Typedefs

using Graph = List_Graph< Graph_Node< int >, Graph_Arc< int > >
 

Functions

template<class GT >
bool is_simple_graph (const GT &g)
 Verify that a graph has no parallel arcs (simple graph)
 
template<class GT >
bool all_nodes_have_even_degree (const GT &g)
 Verify that all nodes have even degree (necessary for Eulerian)
 
template<class GT >
bool satisfies_ore_condition (const GT &g)
 Verify Ore's theorem condition for Hamiltonian graphs: For all non-adjacent pairs u, v: deg(u) + deg(v) >= n.
 
 TEST (RandomGraph, SparseBasic)
 
 TEST (RandomGraph, SparseConnected)
 
 TEST (RandomGraph, SparseDisconnected)
 
 TEST (RandomGraph, Probability)
 
 TEST (RandomGraph, ProbabilityDense)
 
 TEST (RandomGraph, InvalidProbability)
 
 TEST (RandomGraph, EulerianSparse)
 
 TEST (RandomGraph, EulerianProbability)
 
 TEST (RandomGraph, Hamiltonian)
 
 TEST (RandomGraph, DeterministicSeed)
 
 TEST (RandomGraph, DifferentSeeds)
 
 TEST (RandomGraph, SingleNodeGraph)
 
 TEST (RandomGraph, ZeroNodesRejected)
 
 TEST (RandomGraph, TwoNodeGraph)
 
 TEST (RandomGraph, CompleteGraphLimit)
 
 TEST (RandomGraph, CustomInitializers)
 

Detailed Description

Tests for Random Graph.

Definition in file random_graph.cc.

Typedef Documentation

◆ Graph

using Graph = List_Graph<Graph_Node<int>, Graph_Arc<int> >

Definition at line 47 of file random_graph.cc.

Function Documentation

◆ all_nodes_have_even_degree()

template<class GT >
bool all_nodes_have_even_degree ( const GT &  g)

Verify that all nodes have even degree (necessary for Eulerian)

Definition at line 81 of file random_graph.cc.

References GraphCommon< GT, Node, Arc >::get_node_it(), and GraphCommon< GT, Node, Arc >::get_num_arcs().

Referenced by TEST(), and TEST().

◆ is_simple_graph()

template<class GT >
bool is_simple_graph ( const GT &  g)

Verify that a graph has no parallel arcs (simple graph)

Definition at line 55 of file random_graph.cc.

References Aleph::count(), GraphCommon< GT, Node, Arc >::get_arc_it(), GraphCommon< GT, Node, Arc >::get_src_node(), and GraphCommon< GT, Node, Arc >::get_tgt_node().

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ satisfies_ore_condition()

template<class GT >
bool satisfies_ore_condition ( const GT &  g)

Verify Ore's theorem condition for Hamiltonian graphs: For all non-adjacent pairs u, v: deg(u) + deg(v) >= n.

Definition at line 95 of file random_graph.cc.

References GraphCommon< GT, Node, Arc >::get_arc_it(), GraphCommon< GT, Node, Arc >::get_connected_node(), GraphCommon< GT, Node, Arc >::get_node_it(), GraphCommon< GT, Node, Arc >::get_num_arcs(), and GraphCommon< GT, Node, Arc >::get_num_nodes().

Referenced by TEST().

◆ TEST() [1/16]

TEST ( RandomGraph  ,
CompleteGraphLimit   
)

Definition at line 359 of file random_graph.cc.

◆ TEST() [2/16]

TEST ( RandomGraph  ,
CustomInitializers   
)

Definition at line 395 of file random_graph.cc.

◆ TEST() [3/16]

TEST ( RandomGraph  ,
DeterministicSeed   
)

Definition at line 279 of file random_graph.cc.

◆ TEST() [4/16]

TEST ( RandomGraph  ,
DifferentSeeds   
)

Definition at line 293 of file random_graph.cc.

References is_simple_graph().

◆ TEST() [5/16]

TEST ( RandomGraph  ,
EulerianProbability   
)

◆ TEST() [6/16]

TEST ( RandomGraph  ,
EulerianSparse   
)

◆ TEST() [7/16]

TEST ( RandomGraph  ,
Hamiltonian   
)

◆ TEST() [8/16]

TEST ( RandomGraph  ,
InvalidProbability   
)

Definition at line 206 of file random_graph.cc.

◆ TEST() [9/16]

TEST ( RandomGraph  ,
Probability   
)

Definition at line 175 of file random_graph.cc.

References is_simple_graph().

◆ TEST() [10/16]

TEST ( RandomGraph  ,
ProbabilityDense   
)

Definition at line 190 of file random_graph.cc.

References is_simple_graph().

◆ TEST() [11/16]

TEST ( RandomGraph  ,
SingleNodeGraph   
)

Definition at line 318 of file random_graph.cc.

◆ TEST() [12/16]

TEST ( RandomGraph  ,
SparseBasic   
)

Definition at line 136 of file random_graph.cc.

References is_simple_graph().

◆ TEST() [13/16]

TEST ( RandomGraph  ,
SparseConnected   
)

Definition at line 149 of file random_graph.cc.

References is_simple_graph(), and Aleph::test_connectivity().

◆ TEST() [14/16]

TEST ( RandomGraph  ,
SparseDisconnected   
)

Definition at line 162 of file random_graph.cc.

References is_simple_graph().

◆ TEST() [15/16]

TEST ( RandomGraph  ,
TwoNodeGraph   
)

Definition at line 346 of file random_graph.cc.

References Aleph::test_connectivity().

◆ TEST() [16/16]

TEST ( RandomGraph  ,
ZeroNodesRejected   
)

Definition at line 330 of file random_graph.cc.