Kruskal algorithm can be run from GUI from now on.
6 #include <lemon/concept_check.h>
8 #include <lemon/concept/matrix_maps.h>
9 #include <lemon/concept/maps.h>
10 #include <lemon/concept/graph.h>
12 #include <lemon/matrix_maps.h>
14 #include <lemon/smart_graph.h>
16 #include "test_tools.h"
17 #include "graph_test.h"
21 using namespace lemon;
22 using namespace lemon::concept;
25 typedef SmartGraph Graph;
26 typedef Graph::Node Node;
28 { // checking MatrixMap for int
29 typedef DynamicMatrixMap<Graph, Node, int> IntMatrixMap;
30 checkConcept<ReferenceMatrixMap<Node, Node, int,
31 IntMatrixMap::Reference, IntMatrixMap::ConstReference>,
36 { // checking MatrixMap for bool
37 typedef DynamicMatrixMap<Graph, Node, bool> BoolMatrixMap;
38 checkConcept<ReferenceMatrixMap<Node, Node, bool,
39 BoolMatrixMap::Reference, BoolMatrixMap::ConstReference>,
46 typedef DynamicMatrixMap<Graph, Node, int> IntMatrixMap;
47 IntMatrixMap matrix(graph);
48 for (int i = 0; i < 10; ++i) {
51 for (Graph::NodeIt it(graph); it != INVALID; ++it) {
52 for (Graph::NodeIt jt(graph); jt != INVALID; ++jt) {
53 int val = urandom(100);
54 matrix.set(it, jt, val);
55 check(matrix(it, jt) == val, "Wrong assign");
56 check(matrix(it, jt) == matrixRowMap(matrix, it)[jt], "Wrong rowMap");
57 check(matrix(it, jt) == matrixColMap(matrix, jt)[it], "Wrong colMap");
60 const IntMatrixMap& cm = matrix;
61 for (Graph::NodeIt it(graph); it != INVALID; ++it) {
62 for (Graph::NodeIt jt(graph); jt != INVALID; ++jt) {
63 check(cm(it, jt) == matrixRowMap(cm, it)[jt], "Wrong rowMap");
64 check(cm(it, jt) == matrixColMap(cm, jt)[it], "Wrong colMap");
69 { // checking MatrixMap for int
70 typedef DynamicSymMatrixMap<Graph, Node, int> IntMatrixMap;
71 checkConcept<ReferenceMatrixMap<Node, Node, int,
72 IntMatrixMap::Reference, IntMatrixMap::ConstReference>,
77 { // checking MatrixMap for bool
78 typedef DynamicSymMatrixMap<Graph, Node, bool> BoolMatrixMap;
79 checkConcept<ReferenceMatrixMap<Node, Node, bool,
80 BoolMatrixMap::Reference, BoolMatrixMap::ConstReference>,
87 typedef DynamicSymMatrixMap<Graph, Node, int> IntMatrixMap;
88 IntMatrixMap matrix(graph);
89 for (int i = 0; i < 10; ++i) {
92 for (Graph::NodeIt it(graph); it != INVALID; ++it) {
93 for (Graph::NodeIt jt(graph); jt != INVALID; ++jt) {
94 int val = urandom(100);
95 matrix.set(it, jt, val);
96 check(matrix(it, jt) == val, "Wrong assign");
97 check(matrix(jt, it) == val, "Wrong assign");
98 check(matrix(it, jt) == matrixRowMap(matrix, it)[jt], "Wrong rowMap");
99 check(matrix(it, jt) == matrixColMap(matrix, jt)[it], "Wrong colMap");
102 const IntMatrixMap& cm = matrix;
103 for (Graph::NodeIt it(graph); it != INVALID; ++it) {
104 for (Graph::NodeIt jt(graph); jt != INVALID; ++jt) {
105 check(cm(it, jt) == matrixRowMap(cm, it)[jt], "Wrong rowMap");
106 check(cm(it, jt) == matrixColMap(cm, jt)[it], "Wrong colMap");
111 std::cout << __FILE__ ": All tests passed.\n";