87 |
87 |
88 \code |
88 \code |
89 GraphWriter<ListGraph> writer(std::cout, graph); |
89 GraphWriter<ListGraph> writer(std::cout, graph); |
90 \endcode |
90 \endcode |
91 |
91 |
92 The \c addNodeMap() function declares a \c NodeMap writing command in the |
92 The \c writeNodeMap() function declares a \c NodeMap writing command in the |
93 \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 |
94 object. The NodeMap writing command with name "id" should write a |
94 object. The NodeMap writing command with name "id" should write a |
95 unique map because it is regarded as ID map. |
95 unique map because it is regarded as ID map. |
96 |
96 |
97 \see IdMap, DescriptorMap |
97 \see IdMap, DescriptorMap |
98 |
98 |
99 \code |
99 \code |
100 IdMap<ListGraph, Node> nodeIdMap; |
100 IdMap<ListGraph, Node> nodeIdMap; |
101 writer.addNodeMap("id", nodeIdMap); |
101 writer.writeNodeMap("id", nodeIdMap); |
102 |
102 |
103 writer.addNodeMap("x-coord", xCoordMap); |
103 writer.writeNodeMap("x-coord", xCoordMap); |
104 writer.addNodeMap("y-coord", yCoordMap); |
104 writer.writeNodeMap("y-coord", yCoordMap); |
105 writer.addNodeMap("color", colorMap); |
105 writer.writeNodeMap("color", colorMap); |
106 \endcode |
106 \endcode |
107 |
107 |
108 With the \c addEdgeMap() member function you can give an edge map |
108 With the \c writeEdgeMap() member function you can give an edge map |
109 writing command similar to the NodeMaps. |
109 writing command similar to the NodeMaps. |
110 |
110 |
111 \see IdMap, DescriptorMap |
111 \see IdMap, DescriptorMap |
112 \code |
112 \code |
113 DescriptorMap<ListGraph, Edge, ListGraph::EdgeMap<int> > edgeDescMap(graph); |
113 DescriptorMap<ListGraph, Edge, ListGraph::EdgeMap<int> > edgeDescMap(graph); |
114 writer.addEdgeMap("descriptor", edgeDescMap); |
114 writer.writeEdgeMap("descriptor", edgeDescMap); |
115 |
115 |
116 writer.addEdgeMap("weight", weightMap); |
116 writer.writeEdgeMap("weight", weightMap); |
117 writer.addEdgeMap("label", labelMap); |
117 writer.writeEdgeMap("label", labelMap); |
118 \endcode |
118 \endcode |
119 |
119 |
120 With \c addNode() and \c addEdge() functions you can point out Nodes and |
120 With \c writeNode() and \c writeEdge() functions you can point out Nodes and |
121 Edges in the graph. By example, you can write out the source and target |
121 Edges in the graph. By example, you can write out the source and target |
122 of the graph. |
122 of the graph. |
123 |
123 |
124 \code |
124 \code |
125 writer.addNode("source", sourceNode); |
125 writer.writeNode("source", sourceNode); |
126 writer.addNode("target", targetNode); |
126 writer.writeNode("target", targetNode); |
127 |
127 |
128 writer.addEdge("observed", edge); |
128 writer.writeEdge("observed", edge); |
129 \endcode |
129 \endcode |
130 |
130 |
131 After you give all write commands you must call the \c run() member |
131 After you give all write commands you must call the \c run() member |
132 function, which execute all the writer commands. |
132 function, which execute all the writer commands. |
133 |
133 |
149 |
149 |
150 \code |
150 \code |
151 GraphReader<ListGraph> reader(std::cin, graph); |
151 GraphReader<ListGraph> reader(std::cin, graph); |
152 \endcode |
152 \endcode |
153 |
153 |
154 The \c addNodeMap() function reads a map from the \c \@nodeset section. |
154 The \c readNodeMap() function reads a map from the \c \@nodeset section. |
155 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 |
156 whitespace in the string represenation of the values then you should |
156 whitespace in the string represenation of the values then you should |
157 call the \c skipNodeMap() template member function with proper parameters. |
157 call the \c skipNodeMap() template member function with proper parameters. |
158 |
158 |
159 \see QuotedStringReader |
159 \see QuotedStringReader |
160 \code |
160 \code |
161 reader.addNodeMap("x-coord", xCoordMap); |
161 reader.readNodeMap("x-coord", xCoordMap); |
162 reader.addNodeMap("y-coord", yCoordMap); |
162 reader.readNodeMap("y-coord", yCoordMap); |
163 |
163 |
164 reader.addNodeMap<QuotedStringReader>("label", labelMap); |
164 reader.readNodeMap<QuotedStringReader>("label", labelMap); |
165 reader.skipNodeMap<QuotedStringReader>("description"); |
165 reader.skipNodeMap<QuotedStringReader>("description"); |
166 |
166 |
167 reader.addNodeMap("color", colorMap); |
167 reader.readNodeMap("color", colorMap); |
168 \endcode |
168 \endcode |
169 |
169 |
170 With the \c addEdgeMap() member function you can give an edge map |
170 With the \c readEdgeMap() member function you can give an edge map |
171 reading command similar to the NodeMaps. |
171 reading command similar to the NodeMaps. |
172 |
172 |
173 \code |
173 \code |
174 reader.addEdgeMap("weight", weightMap); |
174 reader.readEdgeMap("weight", weightMap); |
175 reader.addEdgeMap("label", labelMap); |
175 reader.readEdgeMap("label", labelMap); |
176 \endcode |
176 \endcode |
177 |
177 |
178 With \c addNode() and \c addEdge() functions you can read labeled Nodes and |
178 With \c readNode() and \c readEdge() functions you can read labeled Nodes and |
179 Edges. |
179 Edges. |
180 |
180 |
181 \code |
181 \code |
182 reader.addNode("source", sourceNode); |
182 reader.readNode("source", sourceNode); |
183 reader.addNode("target", targetNode); |
183 reader.readNode("target", targetNode); |
184 |
184 |
185 reader.addEdge("observed", edge); |
185 reader.readEdge("observed", edge); |
186 \endcode |
186 \endcode |
187 |
187 |
188 After you give all read commands you must call the \c run() member |
188 After you give all read commands you must call the \c run() member |
189 function, which execute all the commands. |
189 function, which execute all the commands. |
190 |
190 |