18 \li edges |
17 \li edges |
19 |
18 |
20 The nodeset section starts with the \c \@nodeset line. |
19 The nodeset section starts with the \c \@nodeset line. |
21 The next line contains the names of the maps separated by whitespaces. |
20 The next line contains the names of the maps separated by whitespaces. |
22 Each following line describes a node in the graph, it contains |
21 Each following line describes a node in the graph, it contains |
23 in the right order the values of the maps. The first map should contain |
22 in the right order the values of the maps. The map named "id" should contain |
24 unique values because it regarded as Id-map. |
23 unique values because it regarded as ID-map. |
25 |
24 |
26 \code |
25 \code |
27 @nodeset |
26 @nodeset |
28 id x-coord y-coord color |
27 id x-coord y-coord color |
29 3 1.0 4.0 blue |
28 3 1.0 4.0 blue |
33 |
32 |
34 The edgeset section is very similar to the nodeset section, it has |
33 The edgeset section is very similar to the nodeset section, it has |
35 same coloumn oriented structure. It starts with the line \c \@edgeset |
34 same coloumn oriented structure. It starts with the line \c \@edgeset |
36 The next line contains the whitespace separated list of names of the map. |
35 The next line contains the whitespace separated list of names of the map. |
37 Each of the next lines describes one edge. The first two elements in the line |
36 Each of the next lines describes one edge. The first two elements in the line |
38 are the ID of the source and target node as they occur in the first node map. |
37 are the ID of the source and target node as they occur in the ID node map. |
39 |
38 |
40 \code |
39 \code |
41 @edgeset |
40 @edgeset |
42 id weight label |
41 id weight label |
43 3 5 a 4.3 a-edge |
42 3 5 a 4.3 a-edge |
44 5 12 c 2.6 c-edge |
43 5 12 c 2.6 c-edge |
45 3 12 g 3.4 g-edge |
44 3 12 g 3.4 g-edge |
46 \endcode |
45 \endcode |
47 |
46 |
48 The next section contains <em>labeles nodes</em> (i.e. nodes having a special |
47 The next section contains <em>labeled nodes</em> (i.e. nodes having a special |
49 label on them). The section starts with |
48 label on them). The section starts with |
50 \c \@nodes. Each of the next lines contains a label for a node in the graph |
49 \c \@nodes. Each of the next lines contains a label for a node in the graph |
51 and then the ID described in the first column in the nodeset. |
50 and then the ID described in the nodeset. |
52 |
51 |
53 \code |
52 \code |
54 @nodes |
53 @nodes |
55 source 3 |
54 source 3 |
56 target 12 |
55 target 12 |
57 \endcode |
56 \endcode |
58 |
57 |
59 The last section describes the <em>labeles edges</em> |
58 The last section describes the <em>labeled edges</em> |
60 (i.e. edges having a special |
59 (i.e. edges having a special label on them). It starts with \c \@edges |
61 label on them). It starts with \c \@edges |
|
62 and then each line contains the name of the edge and the ID. |
60 and then each line contains the name of the edge and the ID. |
63 |
61 |
64 \code |
62 \code |
65 @nodes |
63 @nodes |
66 observed c |
64 observed c |
86 you should first give writing commands for the writer. You can declare |
84 you should first give writing commands for the writer. You can declare |
87 write command as \c NodeMap or \c EdgeMap writing and labeled Node and |
85 write command as \c NodeMap or \c EdgeMap writing and labeled Node and |
88 Edge writing. |
86 Edge writing. |
89 |
87 |
90 \code |
88 \code |
91 GraphWriter<ListGraph> writer(graph); |
89 GraphWriter<ListGraph> writer(std::cout, graph); |
92 \endcode |
90 \endcode |
93 |
91 |
94 The \c addNodeMap() function declares a \c NodeMap writing command in the |
92 The \c addNodeMap() function declares a \c NodeMap writing command in the |
95 \c GraphWriter. You should give as parameter the name of the map and the map |
93 \c GraphWriter. You should give as parameter the name of the map and the map |
96 object. The first NodeMap writing command should write a unique map because |
94 object. The NodeMap writing command with name "id" should write a |
97 it is regarded as ID map. |
95 unique map because it is regarded as ID map. |
98 |
96 |
99 \see IdMap, DescriptorMap |
97 \see IdMap, DescriptorMap |
100 |
98 |
101 \code |
99 \code |
102 IdMap<ListGraph, Node> nodeIdMap; |
100 IdMap<ListGraph, Node> nodeIdMap; |
106 writer.addNodeMap("y-coord", yCoordMap); |
104 writer.addNodeMap("y-coord", yCoordMap); |
107 writer.addNodeMap("color", colorMap); |
105 writer.addNodeMap("color", colorMap); |
108 \endcode |
106 \endcode |
109 |
107 |
110 With the \c addEdgeMap() member function you can give an edge map |
108 With the \c addEdgeMap() member function you can give an edge map |
111 writing command similar to the NodeMaps. The first map writing command should |
109 writing command similar to the NodeMaps. |
112 write unique map. |
|
113 |
110 |
114 \see IdMap, DescriptorMap |
111 \see IdMap, DescriptorMap |
115 \code |
112 \code |
116 DescriptorMap<ListGraph, Edge, ListGraph::EdgeMap<int> > edgeDescMap(graph); |
113 DescriptorMap<ListGraph, Edge, ListGraph::EdgeMap<int> > edgeDescMap(graph); |
117 writer.addEdgeMap("descriptor", edgeDescMap); |
114 writer.addEdgeMap("descriptor", edgeDescMap); |
149 The reader object suppose that each not readed value does not contain |
146 The reader object suppose that each not readed value does not contain |
150 whitespaces, therefore it has some extra possibilities to control how |
147 whitespaces, therefore it has some extra possibilities to control how |
151 it should skip the values when the string representation contains spaces. |
148 it should skip the values when the string representation contains spaces. |
152 |
149 |
153 \code |
150 \code |
154 GraphReader<ListGraph> reader(graph); |
151 GraphReader<ListGraph> reader(std::cin, graph); |
155 \endcode |
152 \endcode |
156 |
153 |
157 The \c addNodeMap() function reads a map from the \c \@nodeset section. |
154 The \c addNodeMap() function reads a map from the \c \@nodeset section. |
158 If there is a map that you do not want to read from the file and there is |
155 If there is a map that you do not want to read from the file and there is |
159 whitespace in the string represenation of the values then you should |
156 whitespace in the string represenation of the values then you should |
204 whitespace. |
201 whitespace. |
205 |
202 |
206 If you want to change the functionality of the reader, you can use |
203 If you want to change the functionality of the reader, you can use |
207 template parameters to specialize it. When you give a reading |
204 template parameters to specialize it. When you give a reading |
208 command for a map you can give a Reader type as template parameter. |
205 command for a map you can give a Reader type as template parameter. |
209 With this template parameter you can control how does read the Reader |
206 With this template parameter you can control how the Reader reads |
210 a value from the stream. |
207 a value from the stream. |
211 |
208 |
212 The reader has the next structure: |
209 The reader has the next structure: |
213 \code |
210 \code |
214 struct TypeReader { |
211 struct TypeReader { |