$darkmode
DENOPTIM
GraphEdit.java
Go to the documentation of this file.
1/*
2 * DENOPTIM
3 * Copyright (C) 2019 Marco Foscato <marco.foscato@uib.no>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as published
7 * by the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19package denoptim.utils;
20
21import java.util.LinkedHashMap;
22import java.util.List;
23
24import denoptim.fragspace.FragmentSpace;
25import denoptim.graph.AttachmentPoint;
26import denoptim.graph.AttachmentPointQuery;
27import denoptim.graph.DGraph;
28import denoptim.graph.EdgeQuery;
29import denoptim.graph.Vertex.BBType;
30import denoptim.graph.VertexQuery;
31
32
39public class GraphEdit
40{
44 private EditTask task = null;
45
51 private int maxOutputGraphs = 10;
52
57 private List<AttachmentPointQuery> apQueriesOnTargetGraph = null;
58
63 private List<AttachmentPointQuery> apQueriesOnIncomingGraph = null;
64
73 private VertexQuery vertexQuery = null;
74
79 private EdgeQuery edgeQuery = null;
80
84 private String incomingGraphPathname = null;
85
90 private DGraph incomingGraph = null;
91
98 private Integer idAPOnIncomingGraph = null;
99
106 private int incomingBBId = -1;
107
115
122 private LinkedHashMap<Integer, Integer> incomingAPMap;
123
127 public static enum EditTask {
134
139
145
151
156 CHANGESUBGRAPH
158
159//------------------------------------------------------------------------------
160
161 public Integer getIncomingAPId()
162 {
163 return idAPOnIncomingGraph;
164 }
165
166//------------------------------------------------------------------------------
167
168 public void setAP(int apId)
169 {
170 this.idAPOnIncomingGraph = apId;
171 }
172
173//------------------------------------------------------------------------------
174
176 {
177 this.incomingGraph = incomingGraph;
178 }
179
180//------------------------------------------------------------------------------
181
183 {
184 return incomingGraph;
185 }
186
187//------------------------------------------------------------------------------
188
190 {
191 this.incomingGraphPathname = incomingGraphPathname;
192 }
193
194//------------------------------------------------------------------------------
195
197 {
199 }
200
201//------------------------------------------------------------------------------
202
204 {
205 this.task = task;
206 }
207
208//------------------------------------------------------------------------------
209
211 {
212 return task;
213 }
214
215//------------------------------------------------------------------------------
216
217 public List<AttachmentPointQuery> getTargetGraphAPQueries()
218 {
220 }
221
222//------------------------------------------------------------------------------
223
224 public List<AttachmentPointQuery> getIncomingGraphAPQueries()
225 {
227 }
228
229//------------------------------------------------------------------------------
230
232 {
233 return vertexQuery;
234 }
235
236//------------------------------------------------------------------------------
237
239 {
240 this.vertexQuery = vertexQuery;
241 }
242
243//------------------------------------------------------------------------------
244
246 {
247 this.edgeQuery = edgeQuery;
248 }
249
250//------------------------------------------------------------------------------
251
253 {
254 return edgeQuery;
255 }
256
257//------------------------------------------------------------------------------
258
259 public int getIncomingBBId()
260 {
261 return incomingBBId;
262 }
263
264//------------------------------------------------------------------------------
265
267 {
268 return incomingBBTyp;
269 }
270
271//------------------------------------------------------------------------------
272
273 public LinkedHashMap<Integer, Integer> getAPMappig()
274 {
275 return incomingAPMap;
276 }
277
278//------------------------------------------------------------------------------
279
281 {
282 return maxOutputGraphs;
283 }
284
285//------------------------------------------------------------------------------
286
288 {
289 this.maxOutputGraphs = maxOutputGraphs;
290 }
291
292//------------------------------------------------------------------------------
293}
Container for the list of vertices and the edges that connect them.
Definition: DGraph.java:104
A query for edges: a list of properties that target edges should possess in order to match this query...
Definition: EdgeQuery.java:28
Query for searching vertices.
Definition of a graph editing task.
Definition: GraphEdit.java:40
LinkedHashMap< Integer, Integer > incomingAPMap
Mapping of AttachmentPoints between the current (first entry) and the incoming vertices (second entry...
Definition: GraphEdit.java:122
BBType incomingBBTyp
The type of the building block to use as incoming vertex when performing EditTask#CHANGEVERTEX.
Definition: GraphEdit.java:114
DGraph incomingGraph
The incoming graph for tasks that involve appending a subgraph onto another graph (when doing EditTas...
Definition: GraphEdit.java:90
void setIncomingGraphPathname(String incomingGraphPathname)
Definition: GraphEdit.java:189
List< AttachmentPointQuery > apQueriesOnTargetGraph
List of queries identifying an ordered list of AttachmentPoints that may be used to identify a subgra...
Definition: GraphEdit.java:57
VertexQuery vertexQuery
Query identifying the vertex that is the center of our attention when performing the graph editing ta...
Definition: GraphEdit.java:73
List< AttachmentPointQuery > getTargetGraphAPQueries()
Definition: GraphEdit.java:217
Integer idAPOnIncomingGraph
The identifier of the AttachmentPoint (AP) of the GraphEdit#incomingGraph when attaching such graph t...
Definition: GraphEdit.java:98
EditTask task
Type of editing task.
Definition: GraphEdit.java:44
GraphEdit(EditTask task)
Definition: GraphEdit.java:203
EdgeQuery edgeQuery
Query identifying the edge that is the center of our attention when performing the graph editing task...
Definition: GraphEdit.java:79
String getIncomingGraphPathname()
Definition: GraphEdit.java:196
List< AttachmentPointQuery > getIncomingGraphAPQueries()
Definition: GraphEdit.java:224
void setMaxOutputGraphs(int maxOutputGraphs)
Definition: GraphEdit.java:287
String incomingGraphPathname
The pathname to a file where to read the incoming graph from.
Definition: GraphEdit.java:84
void setEdgeQuery(EdgeQuery edgeQuery)
Definition: GraphEdit.java:245
void setAP(int apId)
Definition: GraphEdit.java:168
LinkedHashMap< Integer, Integer > getAPMappig()
Definition: GraphEdit.java:273
void setVertexQuery(VertexQuery vertexQuery)
Definition: GraphEdit.java:238
int maxOutputGraphs
Defined the max number of output graphs resulting from application of the graph editing task.
Definition: GraphEdit.java:51
VertexQuery getVertexQuery()
Definition: GraphEdit.java:231
int incomingBBId
Index of the building block to use as incoming vertex when performing EditTask#CHANGEVERTEX.
Definition: GraphEdit.java:106
List< AttachmentPointQuery > apQueriesOnIncomingGraph
List of queries identifying an ordered list of AttachmentPoints that may be used to identify a subgra...
Definition: GraphEdit.java:63
void setIncomingGraph(DGraph incomingGraph)
Definition: GraphEdit.java:175
The type of building block.
Definition: Vertex.java:86
Defined the kind of graph editing task.
Definition: GraphEdit.java:127
DELETEVERTEX
Removes any vertex matching the vertex query.
Definition: GraphEdit.java:144
CHANGEVERTEX
Changes any vertex matching the vertex query with the vertex given as input and using the given AP ma...
Definition: GraphEdit.java:150
REPLACECHILD
Replaces any child (or tree of children) of any vertex matching the vertex query with a given incomin...
Definition: GraphEdit.java:133
DELETEBRANCH
Removes any branch starting from any matching vertex.
Definition: GraphEdit.java:138