1 |
|
---|
2 | // Distributed under the Boost Software License, Version 1.0.
|
---|
3 | // (See accompanying file LICENSE_1_0.txt or copy at
|
---|
4 | // http://www.boost.org/LICENSE_1_0.txt)
|
---|
5 |
|
---|
6 |
|
---|
7 | //=======================================================================
|
---|
8 | // Graph Colouring Program
|
---|
9 | //=======================================================================
|
---|
10 |
|
---|
11 | #include <boost/config.hpp>
|
---|
12 | #include <iostream>
|
---|
13 | #include <sstream>
|
---|
14 | #include <fstream>
|
---|
15 | #include <string>
|
---|
16 | #include <boost/graph/properties.hpp>
|
---|
17 | #include <boost/graph/adjacency_list.hpp>
|
---|
18 | #include <boost/graph/graphml.hpp>
|
---|
19 | #include <boost/graph/graph_utility.hpp>
|
---|
20 | #include <boost/regex.hpp>
|
---|
21 |
|
---|
22 | using namespace boost;
|
---|
23 | using namespace std;
|
---|
24 |
|
---|
25 | typedef string Color;
|
---|
26 | typedef string Colour;
|
---|
27 | typedef string Weight;
|
---|
28 | typedef std::list<Color> Color_List;
|
---|
29 | typedef set< Color > ColorSet;
|
---|
30 | typedef string Parameter;
|
---|
31 | typedef pair< Color, int > Pair;
|
---|
32 | typedef set< Pair > ColorPSet;
|
---|
33 |
|
---|
34 |
|
---|
35 | Color_List ColorList;
|
---|
36 |
|
---|
37 | std::map < Color, Color > aColour_map;
|
---|
38 | std::map < Color, Color > inverse_aColour_map;
|
---|
39 |
|
---|
40 | long numChains = 0;
|
---|
41 | vector<Parameter> Parameters;
|
---|
42 |
|
---|
43 | int result;
|
---|
44 |
|
---|
45 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
---|
46 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
---|
47 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
---|
48 |
|
---|
49 | typedef adjacency_list < vecS, vecS, bidirectionalS > Traits;
|
---|
50 |
|
---|
51 | dynamic_properties dpp;
|
---|
52 |
|
---|
53 | struct vertex_properties
|
---|
54 | {
|
---|
55 |
|
---|
56 | string vName;
|
---|
57 | Color vColor;
|
---|
58 | Color vNewColor;
|
---|
59 | Traits::vertex_descriptor vPredecessor;
|
---|
60 |
|
---|
61 | float x_coord;
|
---|
62 | float y_coord;
|
---|
63 |
|
---|
64 | };
|
---|
65 |
|
---|
66 | struct edge_properties
|
---|
67 | {
|
---|
68 |
|
---|
69 | string eName;
|
---|
70 | Color eArrow;
|
---|
71 | Weight eWeight;
|
---|
72 |
|
---|
73 | Color eRedArrow;
|
---|
74 | Color eGreenArrow;
|
---|
75 | Color eBlueArrow;
|
---|
76 | Color eYellowArrow;
|
---|
77 | Color eColor5Arrow;
|
---|
78 |
|
---|
79 | set< Color > eValidColors;
|
---|
80 |
|
---|
81 | set< Pair > ePColors;
|
---|
82 |
|
---|
83 | Traits::edge_descriptor ePredecessor;
|
---|
84 | };
|
---|
85 |
|
---|
86 |
|
---|
87 | struct graph_properties
|
---|
88 | {
|
---|
89 |
|
---|
90 |
|
---|
91 | };
|
---|
92 |
|
---|
93 |
|
---|
94 | typedef adjacency_list < vecS, vecS, bidirectionalS >::edge_descriptor edge_t;
|
---|
95 | typedef adjacency_list < vecS, vecS, bidirectionalS >::vertex_descriptor vertex_t;
|
---|
96 | typedef adjacency_list < vecS, vecS, bidirectionalS,
|
---|
97 | property< vertex_predecessor_t, vertex_t, vertex_properties >,
|
---|
98 | property< edge_reverse_t, edge_t, edge_properties >,
|
---|
99 | graph_properties
|
---|
100 | > graph_t;
|
---|
101 |
|
---|
102 |
|
---|