|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
#include <gtest/gtest.h>#include <stdexcept>#include <string>#include <algorithm>#include <random>#include <vector>#include <Graph_Coloring.H>#include <tpl_sgraph.H>#include <tpl_agraph.H>Go to the source code of this file.
Typedefs | |
| using | Graph = List_Graph< Graph_Node< std::string >, Graph_Arc< Empty_Class > > |
| using | DGraph = List_Digraph< Graph_Node< std::string >, Graph_Arc< Empty_Class > > |
| using | SGraph = List_SGraph< Graph_Snode< int >, Graph_Sarc< Empty_Class > > |
| using | AGraph = Array_Graph< Graph_Anode< std::string >, Graph_Aarc< Empty_Class > > |
Functions | |
| static Graph | build_complete_graph (size_t n) |
| static Graph | build_cycle (size_t n) |
| static Graph | build_path (size_t n) |
| static Graph | build_star (size_t n) |
| static Graph | build_petersen () |
| static Graph | build_wheel (size_t n) |
| static Graph | build_complete_bipartite (size_t m, size_t n) |
| static size_t | count_distinct_colors (const DynMapTree< Graph::Node *, size_t > &colors) |
| TEST (GraphColoring, EmptyGraph) | |
| TEST (GraphColoring, SingleNode) | |
| TEST (GraphColoring, IsolatedNodes) | |
| TEST (GraphColoring, CompleteK2) | |
| TEST (GraphColoring, CompleteK3) | |
| TEST (GraphColoring, CompleteK4) | |
| TEST (GraphColoring, CompleteK5) | |
| TEST (GraphColoring, CompleteBipartiteK33) | |
| TEST (GraphColoring, Path5) | |
| TEST (GraphColoring, Star6) | |
| TEST (GraphColoring, TreeChain) | |
| TEST (GraphColoring, EvenCycle) | |
| TEST (GraphColoring, OddCycle) | |
| TEST (GraphColoring, Triangle) | |
| TEST (GraphColoring, PetersenGraph) | |
| TEST (GraphColoring, DisconnectedComponents) | |
| TEST (GraphColoring, DisconnectedMixed) | |
| TEST (GraphColoring, WheelW5EvenRing) | |
| TEST (GraphColoring, WheelW6OddRing) | |
| TEST (GraphColoring, AllAlgorithmsProduceValidColorings) | |
| TEST (GraphColoring, GreedyBoundDeltaPlusOne) | |
| TEST (GraphColoring, ValidationRejectsInvalidColoring) | |
| TEST (GraphColoring, ValidationRejectsMissingNode) | |
| TEST (GraphColoring, ValidationRejectsForeignKeyedMap) | |
| TEST (GraphColoring, ValidationRejectsIsolatedNodeMissingFromColors) | |
| TEST (GraphColoring, ValidationRejectsSelfLoop) | |
| TEST (GraphColoring, ValidationRejectsParallelEdge) | |
| TEST (GraphColoring, ChromaticNumberEmptyGraph) | |
| TEST (GraphColoring, ChromaticNumberIsolatedNodes) | |
| TEST (GraphColoring, ChromaticNumberK4) | |
| TEST (GraphColoring, ChromaticNumberPetersen) | |
| TEST (GraphColoring, ChromaticNumberOddCycle) | |
| TEST (GraphColoring, ChromaticNumberEvenCycle) | |
| TEST (GraphColoring, ChromaticNumberBipartite) | |
| TEST (GraphColoring, ChromaticNumberTooManyNodes) | |
| TEST (GraphColoring, ChromaticNumber64Nodes) | |
| TEST (GraphColoring, SGraphBasicColoring) | |
| TEST (GraphColoring, SGraphGreedy) | |
| TEST (GraphColoring, DigraphSingleArcUsesTwoColors) | |
| TEST (GraphColoring, DigraphReverseOrderStillUsesTwoColors) | |
| TEST (GraphColoring, AGraphTriangle) | |
| TEST (GraphColoring, FunctorWrappers) | |
| TEST (GraphColoring, CookiesPreservedAfterColoring) | |
| TEST (GraphColoring, SouthAmericaMapColoring) | |
| TEST (GraphColoring, ExamScheduling) | |
| TEST (GraphColoring, ChromaticNumberWheelEvenRing) | |
| TEST (GraphColoring, ChromaticNumberWheelOddRing) | |
| TEST (GraphColoring, RandomGraphsPropertyBased) | |
| using AGraph = Array_Graph<Graph_Anode<std::string>, Graph_Aarc<Empty_Class> > |
Definition at line 31 of file graph_coloring_test.cc.
| using DGraph = List_Digraph<Graph_Node<std::string>, Graph_Arc<Empty_Class> > |
Definition at line 29 of file graph_coloring_test.cc.
| using Graph = List_Graph<Graph_Node<std::string>, Graph_Arc<Empty_Class> > |
Definition at line 28 of file graph_coloring_test.cc.
| using SGraph = List_SGraph<Graph_Snode<int>, Graph_Sarc<Empty_Class> > |
Definition at line 30 of file graph_coloring_test.cc.
|
static |
Definition at line 181 of file graph_coloring_test.cc.
References Aleph::DynList< T >::append(), Aleph::divide_and_conquer_partition_dp(), LocateFunctions< Container, Type >::get_it(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), and m.
|
static |
Definition at line 36 of file graph_coloring_test.cc.
References Aleph::DynList< T >::append(), Aleph::divide_and_conquer_partition_dp(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), and nodes.
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
static |
Definition at line 59 of file graph_coloring_test.cc.
References Aleph::DynList< T >::append(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), and nodes.
|
static |
Definition at line 86 of file graph_coloring_test.cc.
References Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), and Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node().
|
static |
Definition at line 119 of file graph_coloring_test.cc.
References Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), and nodes.
|
static |
Definition at line 103 of file graph_coloring_test.cc.
References Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), and Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node().
Referenced by TEST().
|
static |
Definition at line 148 of file graph_coloring_test.cc.
References Aleph::divide_and_conquer_partition_dp(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), and Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node().
|
static |
Definition at line 200 of file graph_coloring_test.cc.
References Aleph::divide_and_conquer_partition_dp(), FunctionalMethods< Container, T >::for_each(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), and Aleph::DynSetTree< Key, Tree, Compare >::size().
Referenced by TEST().
| TEST | ( | GraphColoring | , |
| AGraphTriangle | |||
| ) |
Definition at line 820 of file graph_coloring_test.cc.
References Aleph::chromatic_number(), Aleph::divide_and_conquer_partition_dp(), Aleph::dsatur_coloring(), Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::insert_arc(), Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::insert_node(), and Aleph::is_valid_coloring().
| TEST | ( | GraphColoring | , |
| AllAlgorithmsProduceValidColorings | |||
| ) |
Definition at line 480 of file graph_coloring_test.cc.
References build_petersen(), Aleph::divide_and_conquer_partition_dp(), Aleph::dsatur_coloring(), Aleph::greedy_coloring(), Aleph::is_valid_coloring(), and Aleph::welsh_powell_coloring().
| TEST | ( | GraphColoring | , |
| ChromaticNumber64Nodes | |||
| ) |
Definition at line 714 of file graph_coloring_test.cc.
References Aleph::chromatic_number(), Aleph::divide_and_conquer_partition_dp(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), and Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node().
| TEST | ( | GraphColoring | , |
| ChromaticNumberBipartite | |||
| ) |
Definition at line 695 of file graph_coloring_test.cc.
References build_complete_bipartite(), Aleph::chromatic_number(), Aleph::divide_and_conquer_partition_dp(), and Aleph::is_valid_coloring().
| TEST | ( | GraphColoring | , |
| ChromaticNumberEmptyGraph | |||
| ) |
Definition at line 639 of file graph_coloring_test.cc.
References Aleph::chromatic_number(), and Aleph::divide_and_conquer_partition_dp().
| TEST | ( | GraphColoring | , |
| ChromaticNumberEvenCycle | |||
| ) |
Definition at line 686 of file graph_coloring_test.cc.
References build_cycle(), Aleph::chromatic_number(), Aleph::divide_and_conquer_partition_dp(), and Aleph::is_valid_coloring().
| TEST | ( | GraphColoring | , |
| ChromaticNumberIsolatedNodes | |||
| ) |
Definition at line 647 of file graph_coloring_test.cc.
References Aleph::chromatic_number(), Aleph::divide_and_conquer_partition_dp(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), and Aleph::is_valid_coloring().
| TEST | ( | GraphColoring | , |
| ChromaticNumberK4 | |||
| ) |
Definition at line 658 of file graph_coloring_test.cc.
References build_complete_graph(), Aleph::chromatic_number(), count_distinct_colors(), Aleph::divide_and_conquer_partition_dp(), and Aleph::is_valid_coloring().
| TEST | ( | GraphColoring | , |
| ChromaticNumberOddCycle | |||
| ) |
Definition at line 677 of file graph_coloring_test.cc.
References build_cycle(), Aleph::chromatic_number(), Aleph::divide_and_conquer_partition_dp(), and Aleph::is_valid_coloring().
| TEST | ( | GraphColoring | , |
| ChromaticNumberPetersen | |||
| ) |
Definition at line 668 of file graph_coloring_test.cc.
References build_petersen(), Aleph::chromatic_number(), Aleph::divide_and_conquer_partition_dp(), and Aleph::is_valid_coloring().
| TEST | ( | GraphColoring | , |
| ChromaticNumberTooManyNodes | |||
| ) |
Definition at line 704 of file graph_coloring_test.cc.
References Aleph::chromatic_number(), Aleph::divide_and_conquer_partition_dp(), and Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node().
| TEST | ( | GraphColoring | , |
| ChromaticNumberWheelEvenRing | |||
| ) |
Definition at line 981 of file graph_coloring_test.cc.
References build_wheel(), Aleph::chromatic_number(), Aleph::divide_and_conquer_partition_dp(), and Aleph::is_valid_coloring().
| TEST | ( | GraphColoring | , |
| ChromaticNumberWheelOddRing | |||
| ) |
Definition at line 991 of file graph_coloring_test.cc.
References build_wheel(), Aleph::chromatic_number(), Aleph::divide_and_conquer_partition_dp(), and Aleph::is_valid_coloring().
| TEST | ( | GraphColoring | , |
| CompleteBipartiteK33 | |||
| ) |
Definition at line 314 of file graph_coloring_test.cc.
References build_complete_bipartite(), Aleph::divide_and_conquer_partition_dp(), Aleph::dsatur_coloring(), Aleph::is_valid_coloring(), and k.
| TEST | ( | GraphColoring | , |
| CompleteK2 | |||
| ) |
Definition at line 265 of file graph_coloring_test.cc.
References build_complete_graph(), Aleph::divide_and_conquer_partition_dp(), Aleph::dsatur_coloring(), Aleph::greedy_coloring(), Aleph::is_valid_coloring(), and Aleph::welsh_powell_coloring().
| TEST | ( | GraphColoring | , |
| CompleteK3 | |||
| ) |
Definition at line 280 of file graph_coloring_test.cc.
References build_complete_graph(), Aleph::divide_and_conquer_partition_dp(), Aleph::dsatur_coloring(), Aleph::is_valid_coloring(), and k.
| TEST | ( | GraphColoring | , |
| CompleteK4 | |||
| ) |
Definition at line 290 of file graph_coloring_test.cc.
References build_complete_graph(), Aleph::divide_and_conquer_partition_dp(), Aleph::dsatur_coloring(), Aleph::is_valid_coloring(), and k.
| TEST | ( | GraphColoring | , |
| CompleteK5 | |||
| ) |
Definition at line 300 of file graph_coloring_test.cc.
References build_complete_graph(), Aleph::divide_and_conquer_partition_dp(), Aleph::dsatur_coloring(), Aleph::is_valid_coloring(), and k.
| TEST | ( | GraphColoring | , |
| CookiesPreservedAfterColoring | |||
| ) |
| TEST | ( | GraphColoring | , |
| DigraphReverseOrderStillUsesTwoColors | |||
| ) |
Definition at line 795 of file graph_coloring_test.cc.
References Aleph::chromatic_number(), Aleph::divide_and_conquer_partition_dp(), Aleph::dsatur_coloring(), Aleph::greedy_coloring(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::is_valid_coloring(), and Aleph::welsh_powell_coloring().
| TEST | ( | GraphColoring | , |
| DigraphSingleArcUsesTwoColors | |||
| ) |
Definition at line 773 of file graph_coloring_test.cc.
References Aleph::chromatic_number(), Aleph::divide_and_conquer_partition_dp(), Aleph::dsatur_coloring(), Aleph::greedy_coloring(), Aleph::is_valid_coloring(), and Aleph::welsh_powell_coloring().
| TEST | ( | GraphColoring | , |
| DisconnectedComponents | |||
| ) |
| TEST | ( | GraphColoring | , |
| DisconnectedMixed | |||
| ) |
| TEST | ( | GraphColoring | , |
| EmptyGraph | |||
| ) |
Definition at line 212 of file graph_coloring_test.cc.
References Aleph::divide_and_conquer_partition_dp(), Aleph::dsatur_coloring(), Aleph::greedy_coloring(), Aleph::is_valid_coloring(), and Aleph::welsh_powell_coloring().
| TEST | ( | GraphColoring | , |
| EvenCycle | |||
| ) |
Definition at line 358 of file graph_coloring_test.cc.
References build_cycle(), Aleph::divide_and_conquer_partition_dp(), Aleph::dsatur_coloring(), Aleph::is_valid_coloring(), and k.
| TEST | ( | GraphColoring | , |
| ExamScheduling | |||
| ) |
| TEST | ( | GraphColoring | , |
| FunctorWrappers | |||
| ) |
Definition at line 842 of file graph_coloring_test.cc.
References build_complete_graph(), Aleph::divide_and_conquer_partition_dp(), and Aleph::is_valid_coloring().
| TEST | ( | GraphColoring | , |
| GreedyBoundDeltaPlusOne | |||
| ) |
Definition at line 500 of file graph_coloring_test.cc.
References build_complete_bipartite(), Aleph::divide_and_conquer_partition_dp(), Aleph::greedy_coloring(), Aleph::is_valid_coloring(), and k.
| TEST | ( | GraphColoring | , |
| IsolatedNodes | |||
| ) |
| TEST | ( | GraphColoring | , |
| OddCycle | |||
| ) |
Definition at line 368 of file graph_coloring_test.cc.
References build_cycle(), Aleph::divide_and_conquer_partition_dp(), Aleph::dsatur_coloring(), Aleph::is_valid_coloring(), and k.
| TEST | ( | GraphColoring | , |
| Path5 | |||
| ) |
Definition at line 324 of file graph_coloring_test.cc.
References build_path(), Aleph::divide_and_conquer_partition_dp(), Aleph::dsatur_coloring(), Aleph::is_valid_coloring(), and k.
| TEST | ( | GraphColoring | , |
| PetersenGraph | |||
| ) |
Definition at line 392 of file graph_coloring_test.cc.
References build_petersen(), Aleph::divide_and_conquer_partition_dp(), Aleph::dsatur_coloring(), Aleph::is_valid_coloring(), and k.
| TEST | ( | GraphColoring | , |
| RandomGraphsPropertyBased | |||
| ) |
Definition at line 1005 of file graph_coloring_test.cc.
References build_random_graph(), Aleph::chromatic_number(), Aleph::divide_and_conquer_partition_dp(), Aleph::dsatur_coloring(), GraphCommon< GT, Node, Arc >::get_num_nodes(), Aleph::greedy_coloring(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), Aleph::is_valid_coloring(), k, nodes, num_nodes, rng, and Aleph::welsh_powell_coloring().
| TEST | ( | GraphColoring | , |
| SGraphBasicColoring | |||
| ) |
| TEST | ( | GraphColoring | , |
| SGraphGreedy | |||
| ) |
| TEST | ( | GraphColoring | , |
| SingleNode | |||
| ) |
| TEST | ( | GraphColoring | , |
| SouthAmericaMapColoring | |||
| ) |
| TEST | ( | GraphColoring | , |
| Star6 | |||
| ) |
Definition at line 334 of file graph_coloring_test.cc.
References build_star(), Aleph::divide_and_conquer_partition_dp(), Aleph::dsatur_coloring(), Aleph::is_valid_coloring(), and k.
| TEST | ( | GraphColoring | , |
| TreeChain | |||
| ) |
Definition at line 344 of file graph_coloring_test.cc.
References build_path(), Aleph::divide_and_conquer_partition_dp(), Aleph::greedy_coloring(), and Aleph::is_valid_coloring().
| TEST | ( | GraphColoring | , |
| Triangle | |||
| ) |
Definition at line 378 of file graph_coloring_test.cc.
References build_cycle(), Aleph::divide_and_conquer_partition_dp(), Aleph::dsatur_coloring(), Aleph::is_valid_coloring(), and k.
| TEST | ( | GraphColoring | , |
| ValidationRejectsForeignKeyedMap | |||
| ) |
Definition at line 545 of file graph_coloring_test.cc.
References Aleph::divide_and_conquer_partition_dp(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), and Aleph::is_valid_coloring().
| TEST | ( | GraphColoring | , |
| ValidationRejectsInvalidColoring | |||
| ) |
Definition at line 516 of file graph_coloring_test.cc.
References build_complete_graph(), Aleph::divide_and_conquer_partition_dp(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), and Aleph::is_valid_coloring().
| TEST | ( | GraphColoring | , |
| ValidationRejectsIsolatedNodeMissingFromColors | |||
| ) |
Definition at line 568 of file graph_coloring_test.cc.
References Aleph::divide_and_conquer_partition_dp(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), and Aleph::is_valid_coloring().
| TEST | ( | GraphColoring | , |
| ValidationRejectsMissingNode | |||
| ) |
Definition at line 528 of file graph_coloring_test.cc.
References Aleph::divide_and_conquer_partition_dp(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), and Aleph::is_valid_coloring().
| TEST | ( | GraphColoring | , |
| ValidationRejectsParallelEdge | |||
| ) |
Definition at line 604 of file graph_coloring_test.cc.
References Aleph::chromatic_number(), Aleph::divide_and_conquer_partition_dp(), Aleph::dsatur_coloring(), Aleph::greedy_coloring(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), Aleph::is_valid_coloring(), and Aleph::welsh_powell_coloring().
| TEST | ( | GraphColoring | , |
| ValidationRejectsSelfLoop | |||
| ) |
Definition at line 588 of file graph_coloring_test.cc.
References Aleph::chromatic_number(), Aleph::divide_and_conquer_partition_dp(), Aleph::dsatur_coloring(), Aleph::greedy_coloring(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), Aleph::is_valid_coloring(), and Aleph::welsh_powell_coloring().
| TEST | ( | GraphColoring | , |
| WheelW5EvenRing | |||
| ) |
Definition at line 454 of file graph_coloring_test.cc.
References build_wheel(), Aleph::divide_and_conquer_partition_dp(), Aleph::dsatur_coloring(), Aleph::is_valid_coloring(), and k.
| TEST | ( | GraphColoring | , |
| WheelW6OddRing | |||
| ) |
Definition at line 465 of file graph_coloring_test.cc.
References build_wheel(), Aleph::divide_and_conquer_partition_dp(), Aleph::dsatur_coloring(), Aleph::is_valid_coloring(), and k.