Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 493136 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotImportTests.java (-38 / +123 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2009, 2015 Fabian Steeg and others.
2
 * Copyright (c) 2009, 2016 itemis AG and others.
3
 *
3
 * All rights reserved. This program and the accompanying materials
4
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * which accompanies this distribution, and is available at
Lines 7-16 Link Here
7
 *
8
 *
8
 * Contributors:
9
 * Contributors:
9
 *     Fabian Steeg - initial API and implementation (see bug #277380)
10
 *     Fabian Steeg - initial API and implementation (see bug #277380)
11
 *     Tamas Miklossy  (itemis AG) - implement additional test cases (bug #493136)
10
 *******************************************************************************/
12
 *******************************************************************************/
11
package org.eclipse.gef4.dot.tests;
13
package org.eclipse.gef4.dot.tests;
12
14
13
import static org.eclipse.gef4.dot.tests.DotTestUtils.RESOURCES_TESTS;
14
import static org.junit.Assert.assertEquals;
15
import static org.junit.Assert.assertEquals;
15
16
16
import java.io.File;
17
import java.io.File;
Lines 18-23 Link Here
18
import org.eclipse.gef4.dot.internal.DotImport;
19
import org.eclipse.gef4.dot.internal.DotImport;
19
import org.eclipse.gef4.graph.Graph;
20
import org.eclipse.gef4.graph.Graph;
20
import org.junit.Assert;
21
import org.junit.Assert;
22
import org.junit.Ignore;
21
import org.junit.Test;
23
import org.junit.Test;
22
24
23
/**
25
/**
Lines 29-77 Link Here
29
// as DotExportTests and DotTemplateTests
31
// as DotExportTests and DotTemplateTests
30
public final class DotImportTests {
32
public final class DotImportTests {
31
33
32
	static Graph importFrom(final File dotFile) {
34
	@Test
33
		Assert.assertTrue("DOT input file must exist: " + dotFile, //$NON-NLS-1$
35
	public void testArrowShapesDeprecated() {
34
				dotFile.exists());
36
		testFile("arrowshapes_deprecated.dot",
35
		Graph graph = new DotImport().importDot(dotFile);
37
				DotTestUtils.getArrowShapesDeprecatedGraph());
36
		Assert.assertNotNull("Resulting graph must not be null", graph); //$NON-NLS-1$
37
		return graph;
38
	}
38
	}
39
39
40
	/**
41
	 * Test valid graphs can be imported without exceptions.
42
	 */
43
	@Test
40
	@Test
44
	public void testFileImport() {
41
	public void testArrowShapesDirectionBoth() {
45
		// simple graphs
42
		testFile("arrowshapes_direction_both.dot",
46
		Graph graph = importFrom(
43
				DotTestUtils.getArrowShapesDirectionBothGraph());
47
				new File(RESOURCES_TESTS + "simple_graph.dot")); //$NON-NLS-1$
44
	}
48
		Assert.assertEquals(DotTestUtils.getSimpleGraph().toString(),
49
				graph.toString());
50
45
51
		graph = importFrom(new File(RESOURCES_TESTS + "simple_digraph.dot")); //$NON-NLS-1$
46
	@Test
52
		Assert.assertEquals(DotTestUtils.getSimpleDiGraph().toString(),
47
	public void testArrowShapesInvalidModifiers() {
53
				graph.toString());
48
		// TODO implement
49
	}
54
50
55
		graph = importFrom(new File(RESOURCES_TESTS + "labeled_graph.dot")); //$NON-NLS-1$
51
	@Test
56
		Assert.assertEquals(DotTestUtils.getLabeledGraph().toString(),
52
	public void testArrowShapesMultiple() {
57
				graph.toString());
53
		testFile("arrowshapes_multiple.dot",
54
				DotTestUtils.getArrowShapesMultipleGraph());
55
	}
58
56
59
		graph = importFrom(new File(RESOURCES_TESTS + "styled_graph.dot")); //$NON-NLS-1$
57
	@Test
60
		Assert.assertEquals(DotTestUtils.getStyledGraph().toString(),
58
	public void testArrowShapesSingle() {
61
				graph.toString());
59
		testFile("arrowshapes_single.dot",
60
				DotTestUtils.getArrowShapesSingleGraph());
61
	}
62
62
63
		// test import succeeds without exceptions
63
	@Ignore("graph label is not yet transfered properly")
64
		importFrom(new File(RESOURCES_TESTS + "sample_input.dot")); //$NON-NLS-1$
64
	@Test
65
		importFrom(new File(RESOURCES_TESTS + "basic_directed_graph.dot")); //$NON-NLS-1$
65
	public void testAttributesGraph() {
66
		importFrom(new File(RESOURCES_TESTS + "global_node_graph.dot")); //$NON-NLS-1$
66
		testFile("attributes_graph.dot", DotTestUtils.getAttributesGraph());
67
		importFrom(new File(RESOURCES_TESTS + "global_edge_graph.dot")); //$NON-NLS-1$
67
	}
68
		importFrom(new File(RESOURCES_TESTS + "attributes_graph.dot")); //$NON-NLS-1$
68
69
		importFrom(new File(RESOURCES_TESTS + "node_groups.dot")); //$NON-NLS-1$
69
	@Test
70
		importFrom(new File(RESOURCES_TESTS + "id_matches_keyword.dot")); //$NON-NLS-1$
70
	public void testBasicDirectedGraph() {
71
		importFrom(new File(RESOURCES_TESTS + "layout_tree_graph.dot")); //$NON-NLS-1$
71
		testFile("basic_directed_graph.dot",
72
		importFrom(new File(RESOURCES_TESTS + "layout_spring_graph.dot")); //$NON-NLS-1$
72
				DotTestUtils.getBasicDirectedGraph());
73
		importFrom(new File(RESOURCES_TESTS + "layout_radial_graph.dot")); //$NON-NLS-1$
73
	}
74
		importFrom(new File(RESOURCES_TESTS + "layout_grid_graph.dot")); //$NON-NLS-1$
74
75
	@Test
76
	public void testGlobalEdgeGraph() {
77
		testFile("global_edge_graph.dot", DotTestUtils.getGlobalEdgeGraph());
78
	}
79
80
	@Test
81
	public void testGlobalNodeGraph() {
82
		testFile("global_node_graph.dot", DotTestUtils.getGlobalNodeGraph());
83
	}
84
85
	@Test
86
	public void testIdMatchesKeyword() {
87
		testFile("id_matches_keyword.dot",
88
				DotTestUtils.getIdMatchesKeywordGraph());
89
	}
90
91
	@Test
92
	public void testLabeledGraph() {
93
		testFile("labeled_graph.dot", DotTestUtils.getLabeledGraph());
94
	}
95
96
	@Test
97
	public void testLayoutGridGraph() {
98
		testFile("layout_grid_graph.dot", DotTestUtils.getLayoutGridGraph());
99
	}
100
101
	@Test
102
	public void testLayoutRadialGraph() {
103
		testFile("layout_radial_graph.dot",
104
				DotTestUtils.getLayoutRadialGraph());
105
	}
106
107
	@Test
108
	public void testLayoutSpringGraph() {
109
		testFile("layout_spring_graph.dot",
110
				DotTestUtils.getLayoutSpringGraph());
111
	}
112
113
	@Test
114
	public void testLayoutTreeGraph() {
115
		testFile("layout_tree_graph.dot", DotTestUtils.getLayoutTreeGraph());
116
	}
117
118
	@Test
119
	public void testNodeShapesPolygonBased() {
120
		// TODO implement
121
	}
122
123
	@Ignore("multi edges are not yet handled properly")
124
	@Test
125
	public void testNodeGroups() {
126
		testFile("node_groups.dot", DotTestUtils.getNodeGroupsGraph());
127
	}
128
129
	@Test
130
	public void testSampleInput() {
131
		testFile("sample_input.dot", DotTestUtils.getSampleInputGraph());
132
	}
133
134
	@Test
135
	public void testSimpleDigraph() {
136
		testFile("simple_digraph.dot", DotTestUtils.getSimpleDiGraph());
137
	}
138
139
	@Test
140
	public void testSimpleGraph() {
141
		testFile("simple_graph.dot", DotTestUtils.getSimpleGraph());
142
	}
143
144
	@Test
145
	public void testStyledGraph() {
146
		testFile("styled_graph.dot", DotTestUtils.getStyledGraph());
147
	}
148
149
	@Test
150
	public void testStyledGraph2() {
151
		// TODO implement
75
	}
152
	}
76
153
77
	/**
154
	/**
Lines 91-94 Link Here
91
		assertEquals(2, graph.getEdges().size());
168
		assertEquals(2, graph.getEdges().size());
92
	}
169
	}
93
170
171
	private void testFile(String fileName, Graph expected) {
172
		File dotFile = new File(DotTestUtils.RESOURCES_TESTS + fileName);
173
		Assert.assertTrue("DOT input file must exist: " + dotFile, //$NON-NLS-1$
174
				dotFile.exists());
175
		Graph graph = new DotImport().importDot(dotFile);
176
		Assert.assertNotNull("Resulting graph must not be null", graph); //$NON-NLS-1$
177
		Assert.assertEquals(expected.toString(), graph.toString());
178
	}
94
}
179
}
(-)a/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotTestUtils.java (+817 lines)
Lines 9-14 Link Here
9
 * Contributors:
9
 * Contributors:
10
 *     Fabian Steeg - initial API and implementation (see bug #277380)
10
 *     Fabian Steeg - initial API and implementation (see bug #277380)
11
 *     Tamas Miklossy (itemis AG) - Add support for all dot attributes (bug #461506)
11
 *     Tamas Miklossy (itemis AG) - Add support for all dot attributes (bug #461506)
12
 *                                - implement additional test cases (bug #493136)
12
 *
13
 *
13
 *******************************************************************************/
14
 *******************************************************************************/
14
package org.eclipse.gef4.dot.tests;
15
package org.eclipse.gef4.dot.tests;
Lines 85-90 Link Here
85
		return dotFiles;
86
		return dotFiles;
86
	}
87
	}
87
88
89
	public static Graph getArrowShapesDeprecatedGraph() {
90
		/* Global settings: */
91
		Graph.Builder graph = new Graph.Builder()
92
				.attr(DotAttributes._NAME__GNE, "ArrowShapes_Deprecated")
93
				.attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH)
94
				.attr(DotAttributes.RANKDIR__G, "LR");
95
96
		/* Nodes: */
97
		Node[] n = new Node[14];
98
		for (int i = 0; i < n.length; i++) {
99
			n[i] = new Node.Builder()
100
					.attr(DotAttributes._NAME__GNE, Integer.toString(i + 1))
101
					.buildNode();
102
		}
103
104
		/* Connection from n1 to n2: */
105
		Edge e1 = new Edge.Builder(n[0], n[1])
106
				.attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$
107
				.attr(DotAttributes.ARROWHEAD__E, "ediamond") //$NON-NLS-1$
108
				.attr(DotAttributes.LABEL__GNE, "ediamond") //$NON-NLS-1$
109
				.buildEdge();
110
111
		/* Connection from n3 to n4: */
112
		Edge e2 = new Edge.Builder(n[2], n[3])
113
				.attr(DotAttributes._NAME__GNE, "3->4") //$NON-NLS-1$
114
				.attr(DotAttributes.ARROWHEAD__E, "open") //$NON-NLS-1$
115
				.attr(DotAttributes.LABEL__GNE, "open") //$NON-NLS-1$
116
				.buildEdge();
117
118
		/* Connection from n5 to n6: */
119
		Edge e3 = new Edge.Builder(n[4], n[5])
120
				.attr(DotAttributes._NAME__GNE, "5->6") //$NON-NLS-1$
121
				.attr(DotAttributes.ARROWHEAD__E, "halfopen") //$NON-NLS-1$
122
				.attr(DotAttributes.LABEL__GNE, "halfopen") //$NON-NLS-1$
123
				.buildEdge();
124
125
		/* Connection from n7 to n8: */
126
		Edge e4 = new Edge.Builder(n[6], n[7])
127
				.attr(DotAttributes._NAME__GNE, "7->8") //$NON-NLS-1$
128
				.attr(DotAttributes.ARROWHEAD__E, "empty") //$NON-NLS-1$
129
				.attr(DotAttributes.LABEL__GNE, "empty") //$NON-NLS-1$
130
				.buildEdge();
131
132
		/* Connection from n9 to n10: */
133
		Edge e5 = new Edge.Builder(n[8], n[9])
134
				.attr(DotAttributes._NAME__GNE, "9->10") //$NON-NLS-1$
135
				.attr(DotAttributes.ARROWHEAD__E, "invempty") //$NON-NLS-1$
136
				.attr(DotAttributes.LABEL__GNE, "invempty") //$NON-NLS-1$
137
				.buildEdge();
138
139
		/* Connection from n11 to n12: */
140
		Edge e6 = new Edge.Builder(n[10], n[11])
141
				.attr(DotAttributes._NAME__GNE, "11->12") //$NON-NLS-1$
142
				.attr(DotAttributes.ARROWHEAD__E, "ediamondinvempty") //$NON-NLS-1$
143
				.attr(DotAttributes.LABEL__GNE, "ediamondinvempty") //$NON-NLS-1$
144
				.buildEdge();
145
146
		/* Connection from n13 to n14: */
147
		Edge e7 = new Edge.Builder(n[12], n[13])
148
				.attr(DotAttributes._NAME__GNE, "13->14") //$NON-NLS-1$
149
				.attr(DotAttributes.ARROWHEAD__E, "openbox") //$NON-NLS-1$
150
				.attr(DotAttributes.LABEL__GNE, "openbox") //$NON-NLS-1$
151
				.buildEdge();
152
153
		return graph.nodes(n).edges(e1, e2, e3, e4, e5, e6, e7).build();
154
	}
155
156
	public static Graph getArrowShapesDirectionBothGraph() {
157
		/* Global settings: */
158
		Graph.Builder graph = new Graph.Builder()
159
				.attr(DotAttributes._NAME__GNE, "ArrowShapes_Direction_Both")
160
				.attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH)
161
				.attr(DotAttributes.RANKDIR__G, "LR");
162
163
		/* Nodes: */
164
		Node[] n = new Node[28];
165
		for (int i = 0; i < n.length; i++) {
166
			n[i] = new Node.Builder()
167
					.attr(DotAttributes._NAME__GNE, Integer.toString(i + 1))
168
					.buildNode();
169
		}
170
171
		/* Connection from n1 to n2: */
172
		Edge e1 = new Edge.Builder(n[0], n[1])
173
				.attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$
174
				.attr(DotAttributes.ARROWHEAD__E, "box") //$NON-NLS-1$
175
				.attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$
176
				.attr(DotAttributes.ARROWTAIL__E, "obox") //$NON-NLS-1$
177
				.attr(DotAttributes.DIR__E, "none") //$NON-NLS-1$
178
				.attr(DotAttributes.LABEL__GNE, "box") //$NON-NLS-1$
179
				.buildEdge();
180
181
		/* Connection from n3 to n4: */
182
		Edge e2 = new Edge.Builder(n[2], n[3])
183
				.attr(DotAttributes._NAME__GNE, "3->4") //$NON-NLS-1$
184
				.attr(DotAttributes.ARROWHEAD__E, "lbox") //$NON-NLS-1$
185
				.attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$
186
				.attr(DotAttributes.ARROWTAIL__E, "olbox") //$NON-NLS-1$
187
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
188
				.attr(DotAttributes.LABEL__GNE, "lbox") //$NON-NLS-1$
189
				.buildEdge();
190
191
		/* Connection from n5 to n6: */
192
		Edge e3 = new Edge.Builder(n[4], n[5])
193
				.attr(DotAttributes._NAME__GNE, "5->6") //$NON-NLS-1$
194
				.attr(DotAttributes.ARROWHEAD__E, "rbox") //$NON-NLS-1$
195
				.attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$
196
				.attr(DotAttributes.ARROWTAIL__E, "orbox") //$NON-NLS-1$
197
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
198
				.attr(DotAttributes.LABEL__GNE, "rbox") //$NON-NLS-1$
199
				.buildEdge();
200
201
		/* Connection from n7 to n8: */
202
		Edge e4 = new Edge.Builder(n[6], n[7])
203
				.attr(DotAttributes._NAME__GNE, "7->8") //$NON-NLS-1$
204
				.attr(DotAttributes.ARROWHEAD__E, "diamond") //$NON-NLS-1$
205
				.attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$
206
				.attr(DotAttributes.ARROWTAIL__E, "odiamond") //$NON-NLS-1$
207
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
208
				.attr(DotAttributes.LABEL__GNE, "diamond") //$NON-NLS-1$
209
				.buildEdge();
210
211
		/* Connection from n9 to n10: */
212
		Edge e5 = new Edge.Builder(n[8], n[9])
213
				.attr(DotAttributes._NAME__GNE, "9->10") //$NON-NLS-1$
214
				.attr(DotAttributes.ARROWHEAD__E, "ldiamond") //$NON-NLS-1$
215
				.attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$
216
				.attr(DotAttributes.ARROWTAIL__E, "oldiamond") //$NON-NLS-1$
217
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
218
				.attr(DotAttributes.LABEL__GNE, "ldiamond") //$NON-NLS-1$
219
				.buildEdge();
220
221
		/* Connection from n11 to n12: */
222
		Edge e6 = new Edge.Builder(n[10], n[11])
223
				.attr(DotAttributes._NAME__GNE, "11->12") //$NON-NLS-1$
224
				.attr(DotAttributes.ARROWHEAD__E, "rdiamond") //$NON-NLS-1$
225
				.attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$
226
				.attr(DotAttributes.ARROWTAIL__E, "ordiamond") //$NON-NLS-1$
227
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
228
				.attr(DotAttributes.LABEL__GNE, "rdiamond") //$NON-NLS-1$
229
				.buildEdge();
230
231
		/* Connection from n13 to n14: */
232
		Edge e7 = new Edge.Builder(n[12], n[13])
233
				.attr(DotAttributes._NAME__GNE, "13->14") //$NON-NLS-1$
234
				.attr(DotAttributes.ARROWHEAD__E, "dot") //$NON-NLS-1$
235
				.attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$
236
				.attr(DotAttributes.ARROWTAIL__E, "odot") //$NON-NLS-1$
237
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
238
				.attr(DotAttributes.LABEL__GNE, "dot") //$NON-NLS-1$
239
				.buildEdge();
240
241
		/* Connection from n15 to n16: */
242
		Edge e8 = new Edge.Builder(n[14], n[15])
243
				.attr(DotAttributes._NAME__GNE, "15->16") //$NON-NLS-1$
244
				.attr(DotAttributes.ARROWHEAD__E, "inv") //$NON-NLS-1$
245
				.attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$
246
				.attr(DotAttributes.ARROWTAIL__E, "oinv") //$NON-NLS-1$
247
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
248
				.attr(DotAttributes.LABEL__GNE, "inv") //$NON-NLS-1$
249
				.buildEdge();
250
251
		/* Connection from n17 to n18: */
252
		Edge e9 = new Edge.Builder(n[16], n[17])
253
				.attr(DotAttributes._NAME__GNE, "17->18") //$NON-NLS-1$
254
				.attr(DotAttributes.ARROWHEAD__E, "linv") //$NON-NLS-1$
255
				.attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$
256
				.attr(DotAttributes.ARROWTAIL__E, "olinv") //$NON-NLS-1$
257
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
258
				.attr(DotAttributes.LABEL__GNE, "linv") //$NON-NLS-1$
259
				.buildEdge();
260
261
		/* Connection from n19 to n20: */
262
		Edge e10 = new Edge.Builder(n[18], n[19])
263
				.attr(DotAttributes._NAME__GNE, "19->20") //$NON-NLS-1$
264
				.attr(DotAttributes.ARROWHEAD__E, "rinv") //$NON-NLS-1$
265
				.attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$
266
				.attr(DotAttributes.ARROWTAIL__E, "orinv") //$NON-NLS-1$
267
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
268
				.attr(DotAttributes.LABEL__GNE, "rinv") //$NON-NLS-1$
269
				.buildEdge();
270
271
		/* Connection from n21 to n22: */
272
		Edge e11 = new Edge.Builder(n[20], n[21])
273
				.attr(DotAttributes._NAME__GNE, "21->22") //$NON-NLS-1$
274
				.attr(DotAttributes.ARROWHEAD__E, "normal") //$NON-NLS-1$
275
				.attr(DotAttributes.ARROWTAIL__E, "onormal") //$NON-NLS-1$
276
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
277
				.attr(DotAttributes.LABEL__GNE, "normal") //$NON-NLS-1$
278
				.buildEdge();
279
280
		/* Connection from n23 to n24: */
281
		Edge e12 = new Edge.Builder(n[22], n[23])
282
				.attr(DotAttributes._NAME__GNE, "23->24") //$NON-NLS-1$
283
				.attr(DotAttributes.ARROWHEAD__E, "lnormal") //$NON-NLS-1$
284
				.attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$
285
				.attr(DotAttributes.ARROWTAIL__E, "olnormal") //$NON-NLS-1$
286
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
287
				.attr(DotAttributes.LABEL__GNE, "lnormal") //$NON-NLS-1$
288
				.buildEdge();
289
290
		/* Connection from n25 to n26: */
291
		Edge e13 = new Edge.Builder(n[24], n[25])
292
				.attr(DotAttributes._NAME__GNE, "25->26") //$NON-NLS-1$
293
				.attr(DotAttributes.ARROWHEAD__E, "rnormal") //$NON-NLS-1$
294
				.attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$
295
				.attr(DotAttributes.ARROWTAIL__E, "ornormal") //$NON-NLS-1$
296
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
297
				.attr(DotAttributes.LABEL__GNE, "rnormal") //$NON-NLS-1$
298
				.buildEdge();
299
300
		/* Connection from n27 to n28: */
301
		Edge e14 = new Edge.Builder(n[26], n[27])
302
				.attr(DotAttributes._NAME__GNE, "27->28") //$NON-NLS-1$
303
				.attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$
304
				.attr(DotAttributes.DIR__E, "back") //$NON-NLS-1$
305
				.attr(DotAttributes.LABEL__GNE, "default") //$NON-NLS-1$
306
				.buildEdge();
307
308
		return graph.nodes(n).edges(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10,
309
				e11, e12, e13, e14).build();
310
	}
311
312
	public static Graph getArrowShapesSingleGraph() {
313
		String[] arrowTypes = { "box", "lbox", "rbox", "obox", "olbox", "orbox",
314
				"crow", "lcrow", "rcrow", "diamond", "ldiamond", "rdiamond",
315
				"odiamond", "oldiamond", "ordiamond", "dot", "odot", "inv",
316
				"linv", "rinv", "oinv", "olinv", "orinv", "none", "normal",
317
				"lnormal", "rnormal", "onormal", "olnormal", "ornormal", "tee",
318
				"ltee", "rtee", "vee", "lvee", "rvee", "curve", "lcurve",
319
				"rcurve", "icurve", "licurve", "ricurve" };
320
321
		/* Global settings: */
322
		Graph.Builder graph = new Graph.Builder()
323
				.attr(DotAttributes._NAME__GNE, "ArrowShapes_Single")
324
				.attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH)
325
				.attr(DotAttributes.RANKDIR__G, "LR");
326
327
		/* Nodes: */
328
		Node[] n = new Node[86];
329
		for (int i = 0; i < n.length; i++) {
330
			n[i] = new Node.Builder()
331
					.attr(DotAttributes._NAME__GNE, Integer.toString(i + 1))
332
					.buildNode();
333
		}
334
335
		/* Edges: */
336
		Edge[] e = new Edge[43];
337
		for (int i = 0; i < arrowTypes.length; i++) {
338
			e[i] = new Edge.Builder(n[2 * i], n[2 * i + 1])
339
					.attr(DotAttributes._NAME__GNE,
340
							(2 * i + 1) + "->" + (2 * i + 2))
341
					.attr(DotAttributes.ARROWHEAD__E, arrowTypes[i])
342
					.attr(DotAttributes.LABEL__GNE, arrowTypes[i]).buildEdge();
343
		}
344
345
		e[42] = new Edge.Builder(n[84], n[85])
346
				.attr(DotAttributes._NAME__GNE, "85->86")
347
				.attr(DotAttributes.LABEL__GNE, "default").buildEdge();
348
		return graph.nodes(n).edges(e).build();
349
	}
350
351
	public static Graph getArrowShapesMultipleGraph() {
352
		/* Global settings: */
353
		Graph.Builder graph = new Graph.Builder()
354
				.attr(DotAttributes._NAME__GNE, "ArrowShapes_Multiple")
355
				.attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH)
356
				.attr(DotAttributes.RANKDIR__G, "LR");
357
358
		/* Nodes: */
359
		Node[] n = new Node[26];
360
		for (int i = 0; i < n.length; i++) {
361
			n[i] = new Node.Builder()
362
					.attr(DotAttributes._NAME__GNE, Integer.toString(i + 1))
363
					.buildNode();
364
		}
365
366
		/* Connection from n1 to n2: */
367
		Edge e1 = new Edge.Builder(n[0], n[1])
368
				.attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$
369
				.attr(DotAttributes.ARROWHEAD__E, "invdot") //$NON-NLS-1$
370
				.attr(DotAttributes.ARROWSIZE__E, "1.0") //$NON-NLS-1$
371
				.attr(DotAttributes.ARROWTAIL__E, "invdot") //$NON-NLS-1$
372
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
373
				.attr(DotAttributes.LABEL__GNE, "invdot") //$NON-NLS-1$
374
				.buildEdge();
375
376
		/* Connection from n3 to n4: */
377
		Edge e2 = new Edge.Builder(n[2], n[3])
378
				.attr(DotAttributes._NAME__GNE, "3->4") //$NON-NLS-1$
379
				.attr(DotAttributes.ARROWHEAD__E, "invodot") //$NON-NLS-1$
380
				.attr(DotAttributes.ARROWSIZE__E, "1.0") //$NON-NLS-1$
381
				.attr(DotAttributes.ARROWTAIL__E, "invodot") //$NON-NLS-1$
382
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
383
				.attr(DotAttributes.LABEL__GNE, "invodot") //$NON-NLS-1$
384
				.buildEdge();
385
386
		/* Connection from n5 to n6: */
387
		Edge e3 = new Edge.Builder(n[4], n[5])
388
				.attr(DotAttributes._NAME__GNE, "5->6") //$NON-NLS-1$
389
				.attr(DotAttributes.ARROWHEAD__E, "boxbox") //$NON-NLS-1$
390
				.attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$
391
				.attr(DotAttributes.ARROWTAIL__E, "boxbox") //$NON-NLS-1$
392
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
393
				.attr(DotAttributes.LABEL__GNE, "boxbox") //$NON-NLS-1$
394
				.buildEdge();
395
396
		/* Connection from n7 to n8: */
397
		Edge e4 = new Edge.Builder(n[6], n[7])
398
				.attr(DotAttributes._NAME__GNE, "7->8") //$NON-NLS-1$
399
				.attr(DotAttributes.ARROWHEAD__E, "nonenormal") //$NON-NLS-1$
400
				.attr(DotAttributes.ARROWSIZE__E, "2.5") //$NON-NLS-1$
401
				.attr(DotAttributes.ARROWTAIL__E, "nonenormal") //$NON-NLS-1$
402
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
403
				.attr(DotAttributes.LABEL__GNE, "nonenormal") //$NON-NLS-1$
404
				.buildEdge();
405
406
		/* Connection from n9 to n10: */
407
		Edge e5 = new Edge.Builder(n[8], n[9])
408
				.attr(DotAttributes._NAME__GNE, "9->10") //$NON-NLS-1$
409
				.attr(DotAttributes.ARROWHEAD__E, "lteeoldiamond") //$NON-NLS-1$
410
				.attr(DotAttributes.ARROWSIZE__E, "1.0") //$NON-NLS-1$
411
				.attr(DotAttributes.ARROWTAIL__E, "lteeoldiamond") //$NON-NLS-1$
412
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
413
				.attr(DotAttributes.LABEL__GNE, "lteeoldiamond") //$NON-NLS-1$
414
				.buildEdge();
415
416
		/* Connection from n11 to n12: */
417
		Edge e6 = new Edge.Builder(n[10], n[11])
418
				.attr(DotAttributes._NAME__GNE, "11->12") //$NON-NLS-1$
419
				.attr(DotAttributes.ARROWHEAD__E, "nonedot") //$NON-NLS-1$
420
				.attr(DotAttributes.ARROWSIZE__E, "1.0") //$NON-NLS-1$
421
				.attr(DotAttributes.ARROWTAIL__E, "nonedot") //$NON-NLS-1$
422
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
423
				.attr(DotAttributes.LABEL__GNE, "nonedot") //$NON-NLS-1$
424
				.buildEdge();
425
426
		/* Connection from n13 to n14: */
427
		Edge e7 = new Edge.Builder(n[12], n[13])
428
				.attr(DotAttributes._NAME__GNE, "13->14") //$NON-NLS-1$
429
				.attr(DotAttributes.ARROWHEAD__E, "dotodotdot") //$NON-NLS-1$
430
				.attr(DotAttributes.ARROWSIZE__E, "1.0") //$NON-NLS-1$
431
				.attr(DotAttributes.ARROWTAIL__E, "dotodotdot") //$NON-NLS-1$
432
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
433
				.attr(DotAttributes.LABEL__GNE, "dotodotdot") //$NON-NLS-1$
434
				.buildEdge();
435
436
		/* Connection from n15 to n16: */
437
		Edge e8 = new Edge.Builder(n[14], n[15])
438
				.attr(DotAttributes._NAME__GNE, "15->16") //$NON-NLS-1$
439
				.attr(DotAttributes.ARROWHEAD__E, "lveerveelvee") //$NON-NLS-1$
440
				.attr(DotAttributes.ARROWSIZE__E, "1.0") //$NON-NLS-1$
441
				.attr(DotAttributes.ARROWTAIL__E, "lveerveelvee") //$NON-NLS-1$
442
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
443
				.attr(DotAttributes.LABEL__GNE, "lveerveelvee") //$NON-NLS-1$
444
				.buildEdge();
445
446
		/* Connection from n17 to n18: */
447
		Edge e9 = new Edge.Builder(n[16], n[17])
448
				.attr(DotAttributes._NAME__GNE, "17->18") //$NON-NLS-1$
449
				.attr(DotAttributes.ARROWHEAD__E, "nonenonedot") //$NON-NLS-1$
450
				.attr(DotAttributes.ARROWSIZE__E, "1.0") //$NON-NLS-1$
451
				.attr(DotAttributes.ARROWTAIL__E, "nonenonedot") //$NON-NLS-1$
452
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
453
				.attr(DotAttributes.LABEL__GNE, "nonenonedot") //$NON-NLS-1$
454
				.buildEdge();
455
456
		/* Connection from n19 to n20: */
457
		Edge e10 = new Edge.Builder(n[18], n[19])
458
				.attr(DotAttributes._NAME__GNE, "19->20") //$NON-NLS-1$
459
				.attr(DotAttributes.ARROWHEAD__E, "onormalnormalonormalnormal") //$NON-NLS-1$
460
				.attr(DotAttributes.ARROWSIZE__E, "1.0") //$NON-NLS-1$
461
				.attr(DotAttributes.ARROWTAIL__E, "onormalnormalonormalnormal") //$NON-NLS-1$
462
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
463
				.attr(DotAttributes.LABEL__GNE, "onormalnormalonormalnormal") //$NON-NLS-1$
464
				.buildEdge();
465
466
		/* Connection from n21 to n22: */
467
		Edge e11 = new Edge.Builder(n[20], n[21])
468
				.attr(DotAttributes._NAME__GNE, "21->22") //$NON-NLS-1$
469
				.attr(DotAttributes.ARROWHEAD__E, "nonenonenonedot") //$NON-NLS-1$
470
				.attr(DotAttributes.ARROWSIZE__E, "1.0") //$NON-NLS-1$
471
				.attr(DotAttributes.ARROWTAIL__E, "nonenonenonedot") //$NON-NLS-1$
472
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
473
				.attr(DotAttributes.LABEL__GNE, "nonenonenonedot") //$NON-NLS-1$
474
				.buildEdge();
475
476
		/* Connection from n23 to n24: */
477
		Edge e12 = new Edge.Builder(n[22], n[23])
478
				.attr(DotAttributes._NAME__GNE, "23->24") //$NON-NLS-1$
479
				.attr(DotAttributes.ARROWHEAD__E, "noneboxnonedot") //$NON-NLS-1$
480
				.attr(DotAttributes.ARROWSIZE__E, "1.0") //$NON-NLS-1$
481
				.attr(DotAttributes.ARROWTAIL__E, "noneboxnonedot") //$NON-NLS-1$
482
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
483
				.attr(DotAttributes.LABEL__GNE, "noneboxnonedot") //$NON-NLS-1$
484
				.buildEdge();
485
486
		/* Connection from n25 to n26: */
487
		Edge e13 = new Edge.Builder(n[24], n[25])
488
				.attr(DotAttributes._NAME__GNE, "25->26") //$NON-NLS-1$
489
				.attr(DotAttributes.ARROWHEAD__E, "boxnonenonedot") //$NON-NLS-1$
490
				.attr(DotAttributes.ARROWSIZE__E, "1.0") //$NON-NLS-1$
491
				.attr(DotAttributes.ARROWTAIL__E, "boxnonenonedot") //$NON-NLS-1$
492
				.attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$
493
				.attr(DotAttributes.LABEL__GNE, "boxnonenonedot") //$NON-NLS-1$
494
				.buildEdge();
495
496
		return graph.nodes(n)
497
				.edges(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13)
498
				.build();
499
	}
500
501
	public static Graph getAttributesGraph() {
502
		/* Global settings: */
503
		Graph.Builder graph = new Graph.Builder()
504
				.attr(DotAttributes._NAME__GNE, "AttributesGraph")
505
				.attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH)
506
				.attr(DotAttributes.RANKDIR__G, "LR")
507
				.attr(DotAttributes.LABEL__GNE, "Left-to-Right");
508
509
		/* Nodes: */
510
		Node n1 = new Node.Builder().attr(DotAttributes._NAME__GNE, "1") //$NON-NLS-1$
511
				.buildNode();
512
		Node n2 = new Node.Builder().attr(DotAttributes._NAME__GNE, "2") //$NON-NLS-1$
513
				.buildNode();
514
		Node n3 = new Node.Builder().attr(DotAttributes._NAME__GNE, "3") //$NON-NLS-1$
515
				.buildNode();
516
		Node n4 = new Node.Builder().attr(DotAttributes._NAME__GNE, "4") //$NON-NLS-1$
517
				.buildNode();
518
519
		/* Connection from n1 to n2: */
520
		Edge e1 = new Edge.Builder(n1, n2)
521
				.attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$
522
				.buildEdge();
523
524
		/* Connection from n1 to n3: */
525
		Edge e2 = new Edge.Builder(n1, n3)
526
				.attr(DotAttributes._NAME__GNE, "1->3") //$NON-NLS-1$
527
				.buildEdge();
528
529
		/* Connection from n2 to n4: */
530
		Edge e3 = new Edge.Builder(n2, n4)
531
				.attr(DotAttributes._NAME__GNE, "2->4").buildEdge();
532
533
		return graph.nodes(n1, n2, n3, n4).edges(e1, e2, e3).build();
534
	}
535
536
	public static Graph getBasicDirectedGraph() {
537
		/* Global settings: */
538
		Graph.Builder graph = new Graph.Builder()
539
				.attr(DotAttributes._NAME__GNE, "BasicDirectedGraph")
540
				.attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH);
541
542
		/* Nodes: */
543
		Node n1 = new Node.Builder().attr(DotAttributes._NAME__GNE, "1") //$NON-NLS-1$
544
				.buildNode();
545
		Node n2 = new Node.Builder().attr(DotAttributes._NAME__GNE, "2") //$NON-NLS-1$
546
				.buildNode();
547
		Node n3 = new Node.Builder().attr(DotAttributes._NAME__GNE, "3") //$NON-NLS-1$
548
				.buildNode();
549
		Node n4 = new Node.Builder().attr(DotAttributes._NAME__GNE, "4") //$NON-NLS-1$
550
				.buildNode();
551
552
		/* Connection from n1 to n2: */
553
		Edge e1 = new Edge.Builder(n1, n2)
554
				.attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$
555
				.attr(DotAttributes.LABEL__GNE, "Edge")
556
				.attr(DotAttributes.STYLE__E, "dashed").buildEdge();
557
558
		/* Connection from n2 to n3: */
559
		Edge e2 = new Edge.Builder(n2, n3)
560
				.attr(DotAttributes._NAME__GNE, "2->3") //$NON-NLS-1$
561
				.attr(DotAttributes.LABEL__GNE, "Edge")
562
				.attr(DotAttributes.STYLE__E, "dashed").buildEdge();
563
564
		/* Connection from n2 to n4: */
565
		Edge e3 = new Edge.Builder(n2, n4)
566
				.attr(DotAttributes._NAME__GNE, "2->4")
567
				.attr(DotAttributes.LABEL__GNE, "Dotted")
568
				.attr(DotAttributes.STYLE__E, "dotted").buildEdge();
569
570
		return graph.nodes(n1, n2, n3, n4).edges(e1, e2, e3).build();
571
	}
572
573
	public static Graph getGlobalEdgeGraph() {
574
		/* Global settings: */
575
		Graph.Builder graph = new Graph.Builder()
576
				.attr(DotAttributes._NAME__GNE, "GlobalEdgeGraph")
577
				.attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH);
578
579
		/* Nodes: */
580
		Node n1 = new Node.Builder().attr(DotAttributes._NAME__GNE, "1") //$NON-NLS-1$
581
				.buildNode();
582
		Node n2 = new Node.Builder().attr(DotAttributes._NAME__GNE, "2") //$NON-NLS-1$
583
				.buildNode();
584
		Node n3 = new Node.Builder().attr(DotAttributes._NAME__GNE, "3") //$NON-NLS-1$
585
				.buildNode();
586
		Node n4 = new Node.Builder().attr(DotAttributes._NAME__GNE, "4") //$NON-NLS-1$
587
				.buildNode();
588
589
		/* Connection from n1 to n2: */
590
		Edge e1 = new Edge.Builder(n1, n2)
591
				.attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$
592
				.attr(DotAttributes.LABEL__GNE, "Edge")
593
				.attr(DotAttributes.STYLE__E, "dashed").buildEdge();
594
595
		/* Connection from n2 to n3: */
596
		Edge e2 = new Edge.Builder(n2, n3)
597
				.attr(DotAttributes._NAME__GNE, "2->3") //$NON-NLS-1$
598
				.attr(DotAttributes.LABEL__GNE, "Edge")
599
				.attr(DotAttributes.STYLE__E, "dashed").buildEdge();
600
601
		/* Connection from n2 to n4: */
602
		Edge e3 = new Edge.Builder(n2, n4)
603
				.attr(DotAttributes._NAME__GNE, "2->4")
604
				.attr(DotAttributes.LABEL__GNE, "Dotted")
605
				.attr(DotAttributes.STYLE__E, "dotted").buildEdge();
606
607
		return graph.nodes(n1, n2, n3, n4).edges(e1, e2, e3).build();
608
	}
609
610
	public static Graph getGlobalNodeGraph() {
611
		/* Global settings: */
612
		Graph.Builder graph = new Graph.Builder()
613
				.attr(DotAttributes._NAME__GNE, "GlobalNodeGraph")
614
				.attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH);
615
616
		/* Nodes: */
617
		Node n1 = new Node.Builder().attr(DotAttributes._NAME__GNE, "1") //$NON-NLS-1$
618
				.attr(DotAttributes.LABEL__GNE, "Node").buildNode();
619
		Node n2 = new Node.Builder().attr(DotAttributes._NAME__GNE, "2") //$NON-NLS-1$
620
				.attr(DotAttributes.LABEL__GNE, "Node").buildNode();
621
		Node n3 = new Node.Builder().attr(DotAttributes._NAME__GNE, "3") //$NON-NLS-1$
622
				.attr(DotAttributes.LABEL__GNE, "Leaf").buildNode();
623
624
		/* Connection from n1 to n2: */
625
		Edge e1 = new Edge.Builder(n1, n2)
626
				.attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$
627
				.buildEdge();
628
629
		/* Connection from n2 to n3: */
630
		Edge e2 = new Edge.Builder(n2, n3)
631
				.attr(DotAttributes._NAME__GNE, "2->3") //$NON-NLS-1$
632
				.buildEdge();
633
634
		return graph.nodes(n1, n2, n3).edges(e1, e2).build();
635
	}
636
637
	public static Graph getIdMatchesKeywordGraph() {
638
		/* Global settings: */
639
		Graph.Builder graph = new Graph.Builder()
640
				.attr(DotAttributes._NAME__GNE, "s")
641
				.attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH);
642
643
		return graph.build();
644
	}
645
88
	public static Graph getLabeledGraph() {
646
	public static Graph getLabeledGraph() {
89
		/* Global settings: */
647
		/* Global settings: */
90
		Graph.Builder graph = new Graph.Builder()
648
		Graph.Builder graph = new Graph.Builder()
Lines 118-123 Link Here
118
		return graph.nodes(n1, n2, n3, n4).edges(e1, e2, e3).build();
676
		return graph.nodes(n1, n2, n3, n4).edges(e1, e2, e3).build();
119
	}
677
	}
120
678
679
	public static Graph getLayoutGridGraph() {
680
		/* Global settings: */
681
		Graph.Builder graph = new Graph.Builder()
682
				.attr(DotAttributes._NAME__GNE, "LayoutGridGraph")
683
				.attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH)
684
				.attr(DotAttributes.LAYOUT__G, "osage");
685
686
		/* Nodes: */
687
		Node n1 = new Node.Builder().attr(DotAttributes._NAME__GNE, "1") //$NON-NLS-1$
688
				.buildNode();
689
		Node n2 = new Node.Builder().attr(DotAttributes._NAME__GNE, "2") //$NON-NLS-1$
690
				.buildNode();
691
		Node n3 = new Node.Builder().attr(DotAttributes._NAME__GNE, "3") //$NON-NLS-1$
692
				.buildNode();
693
		Node n4 = new Node.Builder().attr(DotAttributes._NAME__GNE, "4") //$NON-NLS-1$
694
				.buildNode();
695
		Node n5 = new Node.Builder().attr(DotAttributes._NAME__GNE, "5") //$NON-NLS-1$
696
				.buildNode();
697
698
		/* Connection from n1 to n2: */
699
		Edge e1 = new Edge.Builder(n1, n2)
700
				.attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$
701
				.buildEdge();
702
703
		/* Connection from n2 to n3: */
704
		Edge e2 = new Edge.Builder(n2, n3)
705
				.attr(DotAttributes._NAME__GNE, "2->3") //$NON-NLS-1$
706
				.buildEdge();
707
708
		/* Connection from n2 to n4: */
709
		Edge e3 = new Edge.Builder(n2, n4)
710
				.attr(DotAttributes._NAME__GNE, "2->4").buildEdge();
711
712
		/* Connection from n4 to n5: */
713
		Edge e4 = new Edge.Builder(n4, n5)
714
				.attr(DotAttributes._NAME__GNE, "4->5").buildEdge();
715
716
		return graph.nodes(n1, n2, n3, n4, n5).edges(e1, e2, e3, e4).build();
717
	}
718
719
	public static Graph getLayoutRadialGraph() {
720
		/* Global settings: */
721
		Graph.Builder graph = new Graph.Builder()
722
				.attr(DotAttributes._NAME__GNE, "LayoutRadialGraph")
723
				.attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH)
724
				.attr(DotAttributes.LAYOUT__G, "twopi");
725
726
		/* Nodes: */
727
		Node n1 = new Node.Builder().attr(DotAttributes._NAME__GNE, "1") //$NON-NLS-1$
728
				.buildNode();
729
		Node n2 = new Node.Builder().attr(DotAttributes._NAME__GNE, "2") //$NON-NLS-1$
730
				.buildNode();
731
		Node n3 = new Node.Builder().attr(DotAttributes._NAME__GNE, "3") //$NON-NLS-1$
732
				.buildNode();
733
		Node n4 = new Node.Builder().attr(DotAttributes._NAME__GNE, "4") //$NON-NLS-1$
734
				.buildNode();
735
		Node n5 = new Node.Builder().attr(DotAttributes._NAME__GNE, "5") //$NON-NLS-1$
736
				.buildNode();
737
738
		/* Connection from n1 to n2: */
739
		Edge e1 = new Edge.Builder(n1, n2)
740
				.attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$
741
				.buildEdge();
742
743
		/* Connection from n2 to n3: */
744
		Edge e2 = new Edge.Builder(n2, n3)
745
				.attr(DotAttributes._NAME__GNE, "2->3") //$NON-NLS-1$
746
				.buildEdge();
747
748
		/* Connection from n2 to n4: */
749
		Edge e3 = new Edge.Builder(n2, n4)
750
				.attr(DotAttributes._NAME__GNE, "2->4").buildEdge();
751
752
		/* Connection from n4 to n5: */
753
		Edge e4 = new Edge.Builder(n4, n5)
754
				.attr(DotAttributes._NAME__GNE, "4->5").buildEdge();
755
756
		return graph.nodes(n1, n2, n3, n4, n5).edges(e1, e2, e3, e4).build();
757
	}
758
759
	public static Graph getLayoutSpringGraph() {
760
		/* Global settings: */
761
		Graph.Builder graph = new Graph.Builder()
762
				.attr(DotAttributes._NAME__GNE, "LayoutSpringGraph")
763
				.attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH)
764
				.attr(DotAttributes.LAYOUT__G, "fdp");
765
766
		/* Nodes: */
767
		Node n1 = new Node.Builder().attr(DotAttributes._NAME__GNE, "1") //$NON-NLS-1$
768
				.buildNode();
769
		Node n2 = new Node.Builder().attr(DotAttributes._NAME__GNE, "2") //$NON-NLS-1$
770
				.buildNode();
771
		Node n3 = new Node.Builder().attr(DotAttributes._NAME__GNE, "3") //$NON-NLS-1$
772
				.buildNode();
773
		Node n4 = new Node.Builder().attr(DotAttributes._NAME__GNE, "4") //$NON-NLS-1$
774
				.buildNode();
775
		Node n5 = new Node.Builder().attr(DotAttributes._NAME__GNE, "5") //$NON-NLS-1$
776
				.buildNode();
777
778
		/* Connection from n1 to n2: */
779
		Edge e1 = new Edge.Builder(n1, n2)
780
				.attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$
781
				.buildEdge();
782
783
		/* Connection from n2 to n3: */
784
		Edge e2 = new Edge.Builder(n2, n3)
785
				.attr(DotAttributes._NAME__GNE, "2->3") //$NON-NLS-1$
786
				.buildEdge();
787
788
		/* Connection from n2 to n4: */
789
		Edge e3 = new Edge.Builder(n2, n4)
790
				.attr(DotAttributes._NAME__GNE, "2->4").buildEdge();
791
792
		/* Connection from n4 to n5: */
793
		Edge e4 = new Edge.Builder(n4, n5)
794
				.attr(DotAttributes._NAME__GNE, "4->5").buildEdge();
795
796
		return graph.nodes(n1, n2, n3, n4, n5).edges(e1, e2, e3, e4).build();
797
	}
798
799
	public static Graph getLayoutTreeGraph() {
800
		/* Global settings: */
801
		Graph.Builder graph = new Graph.Builder()
802
				.attr(DotAttributes._NAME__GNE, "LayoutTreeGraph")
803
				.attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH)
804
				.attr(DotAttributes.LAYOUT__G, "dot");
805
806
		/* Nodes: */
807
		Node n1 = new Node.Builder().attr(DotAttributes._NAME__GNE, "1") //$NON-NLS-1$
808
				.buildNode();
809
		Node n2 = new Node.Builder().attr(DotAttributes._NAME__GNE, "2") //$NON-NLS-1$
810
				.buildNode();
811
		Node n3 = new Node.Builder().attr(DotAttributes._NAME__GNE, "3") //$NON-NLS-1$
812
				.buildNode();
813
		Node n4 = new Node.Builder().attr(DotAttributes._NAME__GNE, "4") //$NON-NLS-1$
814
				.buildNode();
815
		Node n5 = new Node.Builder().attr(DotAttributes._NAME__GNE, "5") //$NON-NLS-1$
816
				.buildNode();
817
818
		/* Connection from n1 to n2: */
819
		Edge e1 = new Edge.Builder(n1, n2)
820
				.attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$
821
				.buildEdge();
822
823
		/* Connection from n2 to n3: */
824
		Edge e2 = new Edge.Builder(n2, n3)
825
				.attr(DotAttributes._NAME__GNE, "2->3") //$NON-NLS-1$
826
				.buildEdge();
827
828
		/* Connection from n2 to n4: */
829
		Edge e3 = new Edge.Builder(n2, n4)
830
				.attr(DotAttributes._NAME__GNE, "2->4").buildEdge();
831
832
		/* Connection from n4 to n5: */
833
		Edge e4 = new Edge.Builder(n4, n5)
834
				.attr(DotAttributes._NAME__GNE, "4->5").buildEdge();
835
836
		return graph.nodes(n1, n2, n3, n4, n5).edges(e1, e2, e3, e4).build();
837
	}
838
839
	public static Graph getNodeGroupsGraph() {
840
		/* Global settings: */
841
		Graph.Builder graph = new Graph.Builder()
842
				.attr(DotAttributes._NAME__GNE, "g1")
843
				.attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH);
844
845
		/* Nodes: */
846
		Node n1 = new Node.Builder().attr(DotAttributes._NAME__GNE, "n1") //$NON-NLS-1$
847
				.attr(DotAttributes.LABEL__GNE, "Node 1").buildNode();
848
		Node n2 = new Node.Builder().attr(DotAttributes._NAME__GNE, "n2") //$NON-NLS-1$
849
				.attr(DotAttributes.LABEL__GNE, "Node 2").buildNode();
850
		Node n3 = new Node.Builder().attr(DotAttributes._NAME__GNE, "n3") //$NON-NLS-1$
851
				.buildNode();
852
		Node n4 = new Node.Builder().attr(DotAttributes._NAME__GNE, "n4") //$NON-NLS-1$
853
				.buildNode();
854
		Node n5 = new Node.Builder().attr(DotAttributes._NAME__GNE, "n5") //$NON-NLS-1$
855
				.buildNode();
856
		Node foo = new Node.Builder().attr(DotAttributes._NAME__GNE, "foo") //$NON-NLS-1$
857
				.buildNode();
858
		Node bar = new Node.Builder().attr(DotAttributes._NAME__GNE, "bar") //$NON-NLS-1$
859
				.buildNode();
860
		Node baz = new Node.Builder().attr(DotAttributes._NAME__GNE, "baz") //$NON-NLS-1$
861
				.buildNode();
862
863
		/* Connection from n1 to n2: */
864
		Edge e1 = new Edge.Builder(n1, n2)
865
				.attr(DotAttributes._NAME__GNE, "n1->n2") //$NON-NLS-1$
866
				.attr(DotAttributes.LABEL__GNE, "A dotted edge")
867
				.attr(DotAttributes.STYLE__E, "dotted").buildEdge();
868
869
		/* Connection from n1 to n4: */
870
		Edge e2 = new Edge.Builder(n1, n4)
871
				.attr(DotAttributes._NAME__GNE, "n1->n4") //$NON-NLS-1$
872
				.buildEdge();
873
874
		/* Connection from n2 to n3: */
875
		Edge e3 = new Edge.Builder(n2, n3)
876
				.attr(DotAttributes._NAME__GNE, "n2->n3").buildEdge();
877
878
		/* Connection from n3 to n5: */
879
		Edge e4 = new Edge.Builder(n3, n5)
880
				.attr(DotAttributes._NAME__GNE, "n3->n5").buildEdge();
881
882
		/* Connection from n4 to n5: */
883
		Edge e5 = new Edge.Builder(n3, n4)
884
				.attr(DotAttributes._NAME__GNE, "n4->n5").buildEdge();
885
886
		/* Connection from foo to bar: */
887
		Edge e6 = new Edge.Builder(foo, bar)
888
				.attr(DotAttributes._NAME__GNE, "foo->bar").buildEdge();
889
890
		/* Connection from foo to baz: */
891
		Edge e7 = new Edge.Builder(foo, baz)
892
				.attr(DotAttributes._NAME__GNE, "foo->baz").buildEdge();
893
894
		return graph.nodes(n1, n2, n4, n3, n5, foo, bar, baz)
895
				.edges(e1, e2, e3, e4, e5, e6, e7).build();
896
	}
897
898
	public static Graph getSampleInputGraph() {
899
		/* Global settings: */
900
		Graph.Builder graph = new Graph.Builder()
901
				.attr(DotAttributes._NAME__GNE, "SampleGraph")
902
				.attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH)
903
				.attr(DotAttributes.LAYOUT__G, "osage");
904
905
		/* Nodes: */
906
		Node n1 = new Node.Builder().attr(DotAttributes._NAME__GNE, "1") //$NON-NLS-1$
907
				.attr(DotAttributes.LABEL__GNE, "one").buildNode();
908
		Node n2 = new Node.Builder().attr(DotAttributes._NAME__GNE, "2") //$NON-NLS-1$
909
				.attr(DotAttributes.LABEL__GNE, "two").buildNode();
910
		Node n3 = new Node.Builder().attr(DotAttributes._NAME__GNE, "3") //$NON-NLS-1$
911
				.attr(DotAttributes.LABEL__GNE, "Käse").buildNode();
912
		Node n4 = new Node.Builder().attr(DotAttributes._NAME__GNE, "4") //$NON-NLS-1$
913
				.attr(DotAttributes.LABEL__GNE, "Käse").buildNode();
914
		Node n5 = new Node.Builder().attr(DotAttributes._NAME__GNE, "5") //$NON-NLS-1$
915
				.attr(DotAttributes.LABEL__GNE, "Käse").buildNode();
916
917
		/* Connection from n1 to n2: */
918
		Edge e1 = new Edge.Builder(n1, n2)
919
				.attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$
920
				.attr(DotAttributes.LABEL__GNE, "style=dashed")
921
				.attr(DotAttributes.STYLE__E, "dashed").buildEdge();
922
923
		/* Connection from n1 to n3: */
924
		Edge e2 = new Edge.Builder(n2, n3)
925
				.attr(DotAttributes._NAME__GNE, "2->3") //$NON-NLS-1$
926
				.attr(DotAttributes.LABEL__GNE, "style=dotted")
927
				.attr(DotAttributes.STYLE__E, "dotted").buildEdge();
928
929
		/* Connection from n3 to n4: */
930
		Edge e3 = new Edge.Builder(n3, n4)
931
				.attr(DotAttributes._NAME__GNE, "3->4")
932
				.attr(DotAttributes.LABEL__GNE, "edge")
933
				.attr(DotAttributes.STYLE__E, "dashed").buildEdge();
934
935
		return graph.nodes(n1, n2, n3, n4, n5).edges(e1, e2, e3).build();
936
	}
937
121
	public static Graph getSimpleDiGraph() {
938
	public static Graph getSimpleDiGraph() {
122
939
123
		/* Global settings, here we set the directed property: */
940
		/* Global settings, here we set the directed property: */

Return to bug 493136