LightJason - AgentSpeak(L++)
TestCActionGraph.java
Go to the documentation of this file.
1 /*
2  * @cond LICENSE
3  * ######################################################################################
4  * # LGPL License #
5  * # #
6  * # This file is part of the LightJason AgentSpeak(L++) #
7  * # Copyright (c) 2015-19, LightJason (info@lightjason.org) #
8  * # This program is free software: you can redistribute it and/or modify #
9  * # it under the terms of the GNU Lesser General Public License as #
10  * # published by the Free Software Foundation, either version 3 of the #
11  * # License, or (at your option) any later version. #
12  * # #
13  * # This program is distributed in the hope that it will be useful, #
14  * # but WITHOUT ANY WARRANTY; without even the implied warranty of #
15  * # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
16  * # GNU Lesser General Public License for more details. #
17  * # #
18  * # You should have received a copy of the GNU Lesser General Public License #
19  * # along with this program. If not, see http://www.gnu.org/licenses/ #
20  * ######################################################################################
21  * @endcond
22  */
23 
24 package org.lightjason.agentspeak.action.builtin;
25 
26 import cern.colt.matrix.tdouble.impl.DenseDoubleMatrix2D;
27 import com.codepoetics.protonpack.StreamUtils;
28 import edu.uci.ics.jung.graph.DirectedSparseGraph;
29 import edu.uci.ics.jung.graph.DirectedSparseMultigraph;
30 import edu.uci.ics.jung.graph.Graph;
31 import edu.uci.ics.jung.graph.SparseGraph;
32 import edu.uci.ics.jung.graph.SparseMultigraph;
33 import edu.uci.ics.jung.graph.UndirectedSparseGraph;
34 import org.junit.Assert;
35 import org.junit.Test;
97 
98 import java.util.ArrayList;
99 import java.util.Collections;
100 import java.util.HashMap;
101 import java.util.List;
102 import java.util.Map;
103 import java.util.stream.Collectors;
104 import java.util.stream.IntStream;
105 import java.util.stream.Stream;
106 
107 
111 public final class TestCActionGraph extends IBaseTest
112 {
113 
117  @Test
118  public final void create()
119  {
120  final List<ITerm> l_return = new ArrayList<>();
121 
122  new CCreate().execute(
123  false, IContext.EMPTYPLAN,
124  Stream.of( "sparse", "SPARSEMULTI", "DIRECTEDSPARSE", "DIRECTEDSPARSEMULTI", "UNDIRECTEDSPARSE", "UNDIRECTEDSPARSEMULTI" )
125  .map( CRawTerm::from )
126  .collect( Collectors.toList() ),
127  l_return
128  );
129 
130  Assert.assertEquals( l_return.size(), 6 );
131  Assert.assertTrue( l_return.stream().map( ITerm::raw ).allMatch( i -> i instanceof Graph<?, ?> ) );
132  }
133 
134 
138  @Test
139  public final void addvertexsingle()
140  {
141  final Graph<?, ?> l_graph1 = new SparseGraph<>();
142  final Graph<?, ?> l_graph2 = new SparseGraph<>();
143 
144  IntStream.range( 0, 5 )
145  .boxed()
146  .forEach( i ->
147  new CAddVertexSingle().execute(
148  false, IContext.EMPTYPLAN,
149  Stream.of( i, l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
150  Collections.emptyList()
151  ) );
152 
153  Assert.assertArrayEquals( l_graph1.getVertices().toArray(), IntStream.range( 0, 5 ).boxed().toArray() );
154  Assert.assertArrayEquals( l_graph2.getVertices().toArray(), IntStream.range( 0, 5 ).boxed().toArray() );
155  }
156 
157 
161  @Test
162  public final void addvertexmultiple()
163  {
164  final Graph<?, ?> l_graph = new SparseGraph<>();
165 
167  false, IContext.EMPTYPLAN,
168  Stream.of( l_graph, "x", "y", "z" ).map( CRawTerm::from ).collect( Collectors.toList() ),
169  Collections.emptyList()
170  );
171 
172  Assert.assertArrayEquals( l_graph.getVertices().toArray(), Stream.of( "x", "y", "z" ).toArray() );
173  }
174 
175 
176 
180  @Test
181  public final void addedgesingle()
182  {
183  final Graph<Integer, String> l_graph = new SparseGraph<>();
184 
185  new CAddEdgeSingle().execute(
186  false, IContext.EMPTYPLAN,
187  Stream.of( "xy", 1, 2, l_graph ).map( CRawTerm::from ).collect( Collectors.toList() ),
188  Collections.emptyList()
189  );
190 
191  new CAddEdgeSingle().execute(
192  false, IContext.EMPTYPLAN,
193  Stream.of( "bar", 4, 5, l_graph ).map( CRawTerm::from ).collect( Collectors.toList() ),
194  Collections.emptyList()
195  );
196 
197  Assert.assertEquals( l_graph.getEdgeCount(), 2 );
198  Assert.assertEquals( (long) l_graph.getEndpoints( "xy" ).getFirst(), 1 );
199  Assert.assertEquals( (long) l_graph.getEndpoints( "xy" ).getSecond(), 2 );
200  Assert.assertEquals( (long) l_graph.getEndpoints( "bar" ).getFirst(), 4 );
201  Assert.assertEquals( (long) l_graph.getEndpoints( "bar" ).getSecond(), 5 );
202  }
203 
204 
208  @Test
209  public final void addedgemultiple()
210  {
211  final Graph<Integer, String> l_graph = new SparseGraph<>();
212 
214  false, IContext.EMPTYPLAN,
215  Stream.of( l_graph, "foo", 1, 1, "bar", 1, 2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
216  Collections.emptyList()
217  );
218 
219  Assert.assertArrayEquals( l_graph.getEdges().toArray(), Stream.of( "bar", "foo" ).toArray() );
220  }
221 
222 
223 
227  @Test
228  public final void vertexcount()
229  {
230  final List<ITerm> l_return = new ArrayList<>();
231  final Graph<Integer, String> l_graph = new SparseGraph<>();
232 
233  IntStream.range( 0, 5 )
234  .boxed()
235  .forEach( l_graph::addVertex );
236 
237  new CVertexCount().execute(
238  false, IContext.EMPTYPLAN,
239  Stream.of( l_graph ).map( CRawTerm::from ).collect( Collectors.toList() ),
240  l_return
241  );
242 
243  Assert.assertEquals( l_return.size(), 1 );
244  Assert.assertEquals( l_return.get( 0 ).<Number>raw(), (double) l_graph.getVertexCount() );
245  }
246 
247 
251  @Test
252  public final void edgecount()
253  {
254  final List<ITerm> l_return = new ArrayList<>();
255  final Graph<Integer, String> l_graph = new SparseGraph<>();
256 
257  l_graph.addEdge( "a", 0, 1 );
258  l_graph.addEdge( "b", 0, 2 );
259  l_graph.addEdge( "c", 1, 3 );
260  l_graph.addEdge( "d", 3, 4 );
261 
262 
263  new CEdgeCount().execute(
264  false, IContext.EMPTYPLAN,
265  Stream.of( l_graph ).map( CRawTerm::from ).collect( Collectors.toList() ),
266  l_return
267  );
268 
269  Assert.assertEquals( l_return.size(), 1 );
270  Assert.assertEquals( l_return.get( 0 ).<Number>raw(), 4D );
271  }
272 
273 
277  @Test
278  public final void vertices()
279  {
280  final List<ITerm> l_return = new ArrayList<>();
281  final Graph<Integer, String> l_graph = new SparseGraph<>();
282 
283  IntStream.range( 0, 5 )
284  .boxed()
285  .forEach( l_graph::addVertex );
286 
287  new CVertices().execute(
288  false, IContext.EMPTYPLAN,
289  Stream.of( l_graph ).map( CRawTerm::from ).collect( Collectors.toList() ),
290  l_return
291  );
292 
293  Assert.assertEquals( l_return.size(), 1 );
294  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), IntStream.range( 0, 5 ).boxed().toArray() );
295  }
296 
297 
301  @Test
302  public final void edges()
303  {
304  final List<ITerm> l_return = new ArrayList<>();
305  final Graph<Integer, String> l_graph = new SparseGraph<>();
306 
307  l_graph.addEdge( "a", 0, 1 );
308  l_graph.addEdge( "b", 0, 2 );
309  l_graph.addEdge( "c", 1, 3 );
310  l_graph.addEdge( "d", 3, 4 );
311 
312  new CEdges().execute(
313  false, IContext.EMPTYPLAN,
314  Stream.of( l_graph ).map( CRawTerm::from ).collect( Collectors.toList() ),
315  l_return
316  );
317 
318  Assert.assertEquals( l_return.size(), 1 );
319  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), Stream.of( "a", "b", "c", "d" ).toArray() );
320  }
321 
322 
326  @Test
327  public final void adjacencymatrix()
328  {
329  final List<ITerm> l_return = new ArrayList<>();
330  final Graph<Integer, String> l_graph = new UndirectedSparseGraph<>();
331 
332  l_graph.addEdge( "x", 1, 1 );
333  l_graph.addEdge( "y", 1, 2 );
334  l_graph.addEdge( "z", 1, 5 );
335 
336  l_graph.addEdge( "xx", 2, 3 );
337  l_graph.addEdge( "yy", 2, 5 );
338 
339  l_graph.addEdge( "xxx", 3, 4 );
340 
341  l_graph.addEdge( "xxxx", 4, 5 );
342  l_graph.addEdge( "yyyy", 4, 6 );
343 
344 
346  false, IContext.EMPTYPLAN,
347  Stream.of( 1, l_graph ).map( CRawTerm::from ).collect( Collectors.toList() ),
348  l_return
349  );
350 
351 
352  Assert.assertEquals( l_return.size(), 2 );
353  Assert.assertArrayEquals( l_return.get( 1 ).<List<?>>raw().toArray(), Stream.of( 1, 2, 3, 4, 5, 6 ).toArray() );
354  Assert.assertEquals( l_return.get( 0 ).raw(), new DenseDoubleMatrix2D( new double[][]{
355  {2, 1, 0, 0, 1, 0}, {1, 0, 1, 0, 1, 0}, {0, 1, 0, 1, 0, 0},
356  {0, 0, 1, 0, 1, 1}, {1, 1, 0, 1, 0, 0}, {0, 0, 0, 1, 0, 0}
357  } ) );
358  }
359 
360 
364  @Test
365  public final void containsedge()
366  {
367  final List<ITerm> l_return = new ArrayList<>();
368  final Graph<Integer, String> l_graph1 = new SparseGraph<>();
369  final Graph<Integer, String> l_graph2 = new SparseGraph<>();
370 
371  l_graph1.addEdge( "ooo", 1, 2 );
372  l_graph1.addEdge( "xxx", 1, 2 );
373  l_graph1.addEdge( "yyy", 2, 3 );
374 
375  l_graph2.addEdge( "yyx", 1, 2 );
376  l_graph2.addEdge( "aaa", 2, 3 );
377 
378 
379  new CContainsEdge().execute(
380  false, IContext.EMPTYPLAN,
381  Stream.of( "yyy", l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
382  l_return
383  );
384 
385  Assert.assertEquals( l_return.size(), 2 );
386  Assert.assertTrue( l_return.get( 0 ).<Boolean>raw() );
387  Assert.assertFalse( l_return.get( 1 ).<Boolean>raw() );
388  }
389 
390 
394  @Test
395  public final void containsvertex()
396  {
397  final List<ITerm> l_return = new ArrayList<>();
398  final Graph<Integer, String> l_graph1 = new SparseGraph<>();
399  final Graph<Integer, String> l_graph2 = new SparseGraph<>();
400 
401  IntStream.range( 1, 5 )
402  .boxed()
403  .forEach( l_graph1::addVertex );
404 
405  IntStream.range( 5, 10 )
406  .boxed()
407  .forEach( l_graph2::addVertex );
408 
409  new CContainsVertex().execute(
410  false, IContext.EMPTYPLAN,
411  Stream.of( 5, l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
412  l_return
413  );
414 
415  Assert.assertEquals( l_return.size(), 2 );
416  Assert.assertFalse( l_return.get( 0 ).<Boolean>raw() );
417  Assert.assertTrue( l_return.get( 1 ).<Boolean>raw() );
418  }
419 
420 
424  @Test
425  public final void degreemultiple()
426  {
427  final List<ITerm> l_return = new ArrayList<>();
428  final Graph<Integer, String> l_graph = new UndirectedSparseGraph<>();
429 
430  l_graph.addEdge( "a", 1, 1 );
431  l_graph.addEdge( "b", 1, 2 );
432  l_graph.addEdge( "c", 1, 5 );
433 
434  l_graph.addEdge( "d", 2, 3 );
435  l_graph.addEdge( "e", 2, 5 );
436 
437  l_graph.addEdge( "f", 3, 4 );
438 
439  l_graph.addEdge( "g", 4, 5 );
440  l_graph.addEdge( "h", 4, 6 );
441 
442 
443  new CDegreeMultiple().execute(
444  false, IContext.EMPTYPLAN,
445  Stream.concat(
446  Stream.of( l_graph ),
447  IntStream.range( 1, 7 ).boxed()
448  ).map( CRawTerm::from ).collect( Collectors.toList() ),
449  l_return
450  );
451 
452  Assert.assertArrayEquals( l_return.stream().map( ITerm::raw ).toArray(), Stream.of( 3D, 3D, 2D, 3D, 3D, 1D ).toArray() );
453  }
454 
455 
459  @Test
460  public final void degreesingle()
461  {
462  final List<ITerm> l_return = new ArrayList<>();
463  final Graph<Integer, String> l_graph1 = new UndirectedSparseGraph<>();
464  final Graph<Integer, String> l_graph2 = new UndirectedSparseGraph<>();
465 
466  l_graph1.addEdge( "x", 1, 1 );
467  l_graph1.addEdge( "y", 1, 2 );
468  l_graph1.addEdge( "z", 1, 5 );
469 
470  l_graph2.addEdge( "x", 1, 1 );
471  l_graph2.addEdge( "y", 1, 2 );
472 
473 
474  new CDegreeSingle().execute(
475  false, IContext.EMPTYPLAN,
476  Stream.of( 1, l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
477  l_return
478  );
479 
480  Assert.assertArrayEquals( l_return.stream().map( ITerm::raw ).toArray(), Stream.of( 3D, 2D ).toArray() );
481  }
482 
483 
487  @Test
488  public final void distancepath()
489  {
490  final List<ITerm> l_return = new ArrayList<>();
491  final Graph<Integer, String> l_graph = new UndirectedSparseGraph<>();
492 
493  l_graph.addEdge( "ma", 1, 2 );
494  l_graph.addEdge( "na", 2, 3 );
495  l_graph.addEdge( "oa", 3, 4 );
496  l_graph.addEdge( "pa", 2, 6 );
497 
498  new CDistancePath().execute(
499  false, IContext.EMPTYPLAN,
500  Stream.of( "defaultweight", 2, l_graph, 1, 4 ).map( CRawTerm::from ).collect( Collectors.toList() ),
501  l_return
502  );
503 
504  Assert.assertEquals( l_return.size(), 1 );
505  Assert.assertEquals( l_return.get( 0 ).<Number>raw(), 6D );
506  }
507 
511  @Test
512  public final void shortestpath()
513  {
514  final List<ITerm> l_return = new ArrayList<>();
515  final Graph<Integer, String> l_graph = new UndirectedSparseGraph<>();
516 
517  l_graph.addEdge( "mb", 1, 2 );
518  l_graph.addEdge( "nb", 2, 3 );
519  l_graph.addEdge( "ob", 3, 4 );
520  l_graph.addEdge( "pb", 2, 6 );
521 
522  new CShortestPath().execute(
523  false, IContext.EMPTYPLAN,
524  Stream.of( "defaultweight", 2, l_graph, 1, 4 ).map( CRawTerm::from ).collect( Collectors.toList() ),
525  l_return
526  );
527 
528  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), Stream.of( "mb", "nb", "ob" ).toArray() );
529  }
530 
531 
535  @Test
536  public final void spanningtree()
537  {
538  final List<ITerm> l_return = new ArrayList<>();
539  final Graph<Integer, String> l_graph = new UndirectedSparseGraph<>();
540 
541  l_graph.addEdge( "spanningtreeedge12", 1, 2 );
542  l_graph.addEdge( "spanningtreeedge26", 2, 6 );
543  l_graph.addEdge( "spanningtreeedge56", 5, 6 );
544  l_graph.addEdge( "spanningtreeedge45", 4, 5 );
545  l_graph.addEdge( "spanningtreeedge34", 3, 4 );
546  l_graph.addEdge( "spanningtreeedge35", 3, 5 );
547  l_graph.addEdge( "spanningtreeedge46", 4, 6 );
548  l_graph.addEdge( "spanningtreeedge24", 2, 4 );
549  l_graph.addEdge( "spanningtreeedge23", 2, 3 );
550  l_graph.addEdge( "spanningtreeedge13", 1, 3 );
551 
552  l_graph.addEdge( "spanningtreeedge28", 2, 8 );
553  l_graph.addEdge( "spanningtreeedge78", 7, 8 );
554  l_graph.addEdge( "spanningtreeedge67", 6, 7 );
555  l_graph.addEdge( "spanningtreeedge68", 6, 8 );
556 
557  l_graph.addEdge( "spanningtreeedge89", 8, 9 );
558  l_graph.addEdge( "spanningtreeedge910", 9, 10 );
559  l_graph.addEdge( "spanningtreeedge710", 7, 10 );
560  l_graph.addEdge( "spanningtreeedge79", 7, 9 );
561 
562  l_graph.addEdge( "spanningtreeedge110", 1, 10 );
563  l_graph.addEdge( "spanningtreeedge19", 1, 9 );
564  l_graph.addEdge( "spanningtreeedge29", 2, 9 );
565 
566  Assert.assertEquals( l_graph.getEdgeCount(), 21 );
567  Assert.assertEquals( l_graph.getVertexCount(), 10 );
568 
569  new CSpanningTree().execute(
570  false, IContext.EMPTYPLAN,
571  Stream.of( l_graph ).map( CRawTerm::from ).collect( Collectors.toList() ),
572  l_return
573  );
574 
575  Assert.assertArrayEquals(
576  l_return.get( 0 ).<Graph<Integer, String>>raw().getEdges().toArray(),
577  Stream.of( "spanningtreeedge19", "spanningtreeedge710", "spanningtreeedge68", "spanningtreeedge46", "spanningtreeedge24", "spanningtreeedge89",
578  "spanningtreeedge45", "spanningtreeedge23", "spanningtreeedge67" ).toArray()
579  );
580 
581 
582  final Map<Object, Object> l_weight = new HashMap<>();
583  StreamUtils.windowed(
584  Stream.of(
585  "spanningtreeedge13", 18,
586  "spanningtreeedge23", 10,
587  "spanningtreeedge34", 3,
588  "spanningtreeedge35", 4,
589  "spanningtreeedge24", 9,
590  "spanningtreeedge46", 5,
591  "spanningtreeedge45", 1,
592  "spanningtreeedge56", 4,
593  "spanningtreeedge26", 7,
594  "spanningtreeedge68", 9,
595  "spanningtreeedge67", 9,
596  "spanningtreeedge28", 8,
597  "spanningtreeedge78", 2,
598  "spanningtreeedge79", 4,
599  "spanningtreeedge710", 6,
600  "spanningtreeedge89", 2,
601  "spanningtreeedge910", 3,
602  "spanningtreeedge110", 9,
603  "spanningtreeedge19", 9,
604  "spanningtreeedge29", 9,
605  "spanningtreeedge12", 8
606  ),
607  2,
608  2
609  ).forEach( i -> l_weight.put( i.get( 0 ), i.get( 1 ) ) );
610 
611  new CSpanningTree().execute(
612  false, IContext.EMPTYPLAN,
613  Stream.of( l_weight, l_graph ).map( CRawTerm::from ).collect( Collectors.toList() ),
614  l_return
615  );
616 
617  Assert.assertArrayEquals(
618  l_return.get( 1 ).<Graph<Integer, String>>raw().getEdges().toArray(),
619  Stream.of( "spanningtreeedge910", "spanningtreeedge12", "spanningtreeedge56", "spanningtreeedge45", "spanningtreeedge34", "spanningtreeedge89",
620  "spanningtreeedge78", "spanningtreeedge26", "spanningtreeedge28" ).toArray()
621  );
622  }
623 
624 
628  @Test
629  public final void findedgesingle()
630  {
631  final List<ITerm> l_return = new ArrayList<>();
632  final Graph<Integer, String> l_graph1 = new UndirectedSparseGraph<>();
633  final Graph<Integer, String> l_graph2 = new UndirectedSparseGraph<>();
634 
635  l_graph1.addEdge( "search", 1, 2 );
636  l_graph1.addEdge( "notsearch", 1, 2 );
637  l_graph2.addEdge( "xxx", 1, 2 );
638 
639  new CFindEdgeSingle().execute(
640  false, IContext.EMPTYPLAN,
641  Stream.of( 1, 2, l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
642  l_return
643  );
644 
645  Assert.assertArrayEquals( l_return.stream().map( ITerm::raw ).toArray(), Stream.of( "search", "xxx" ).toArray() );
646  }
647 
648 
652  @Test
653  public final void findedgemultiple()
654  {
655  final List<ITerm> l_return = new ArrayList<>();
656  final Graph<Integer, String> l_graph = new UndirectedSparseGraph<>();
657 
658  l_graph.addEdge( "edge12", 1, 2 );
659  l_graph.addEdge( "edge23", 2, 3 );
660  l_graph.addEdge( "edge34", 3, 4 );
661  l_graph.addEdge( "edge13", 1, 3 );
662  l_graph.addEdge( "edge24", 2, 4 );
663 
665  false, IContext.EMPTYPLAN,
666  Stream.of( l_graph, 1, 2, 2, 3, 3, 4 ).map( CRawTerm::from ).collect( Collectors.toList() ),
667  l_return
668  );
669 
670  Assert.assertArrayEquals( l_return.stream().map( ITerm::raw ).toArray(), Stream.of( "edge12", "edge23", "edge34" ).toArray() );
671  }
672 
673 
677  @Test
678  public final void edgelistsingle()
679  {
680  final List<ITerm> l_return = new ArrayList<>();
681  final Graph<Integer, String> l_graph1 = new SparseMultigraph<>();
682  final Graph<Integer, String> l_graph2 = new SparseMultigraph<>();
683 
684  l_graph1.addEdge( "edgeA1", 1, 2 );
685  l_graph1.addEdge( "edgeAA1", 1, 2 );
686  l_graph2.addEdge( "edgeA2", 1, 2 );
687  l_graph1.addEdge( "edgeB1", 2, 3 );
688  l_graph2.addEdge( "edgeB2", 3, 4 );
689 
690  new CEdgeListSingle().execute(
691  false, IContext.EMPTYPLAN,
692  Stream.of( 1, 2, l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
693  l_return
694  );
695 
696  Assert.assertEquals( l_return.size(), 2 );
697  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), Stream.of( "edgeAA1", "edgeA1" ).toArray() );
698  Assert.assertArrayEquals( l_return.get( 1 ).<List<?>>raw().toArray(), Stream.of( "edgeA2" ).toArray() );
699 
700 
701  l_return.clear();
702 
703  new CEdgeListSingle().execute(
704  true, IContext.EMPTYPLAN,
705  Stream.of( 1, 2, l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
706  l_return
707  );
708 
709  Assert.assertEquals( l_return.size(), 2 );
710  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), Stream.of( "edgeAA1", "edgeA1" ).toArray() );
711  Assert.assertArrayEquals( l_return.get( 1 ).<List<?>>raw().toArray(), Stream.of( "edgeA2" ).toArray() );
712  Assert.assertEquals( l_return.get( 0 ).raw().getClass(), Collections.synchronizedList( Collections.emptyList() ).getClass() );
713  Assert.assertEquals( l_return.get( 1 ).raw().getClass(), Collections.synchronizedList( Collections.emptyList() ).getClass() );
714  }
715 
716 
720  @Test
721  public final void edgelistmultiple()
722  {
723  final List<ITerm> l_return = new ArrayList<>();
724  final Graph<Integer, String> l_graph = new SparseMultigraph<>();
725 
726  l_graph.addEdge( "o", 1, 2 );
727  l_graph.addEdge( "p", 1, 2 );
728  l_graph.addEdge( "q", 2, 3 );
729  l_graph.addEdge( "r", 2, 3 );
730  l_graph.addEdge( "s", 2, 3 );
731 
733  false, IContext.EMPTYPLAN,
734  Stream.of( l_graph, 1, 2, 2, 3 ).map( CRawTerm::from ).collect( Collectors.toList() ),
735  l_return
736  );
737 
738  Assert.assertEquals( l_return.size(), 2 );
739  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), Stream.of( "p", "o" ).toArray() );
740  Assert.assertArrayEquals( l_return.get( 1 ).<List<?>>raw().toArray(), Stream.of( "q", "r", "s" ).toArray() );
741 
742 
743  l_return.clear();
744 
746  true, IContext.EMPTYPLAN,
747  Stream.of( l_graph, 1, 2, 2, 3 ).map( CRawTerm::from ).collect( Collectors.toList() ),
748  l_return
749  );
750 
751  Assert.assertEquals( l_return.size(), 2 );
752  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), Stream.of( "p", "o" ).toArray() );
753  Assert.assertArrayEquals( l_return.get( 1 ).<List<?>>raw().toArray(), Stream.of( "q", "r", "s" ).toArray() );
754  Assert.assertEquals( l_return.get( 0 ).raw().getClass(), Collections.synchronizedList( Collections.emptyList() ).getClass() );
755  Assert.assertEquals( l_return.get( 1 ).raw().getClass(), Collections.synchronizedList( Collections.emptyList() ).getClass() );
756  }
757 
758 
762  @Test
763  public final void endpointsingle()
764  {
765  final List<ITerm> l_return = new ArrayList<>();
766  final Graph<Integer, String> l_graph1 = new UndirectedSparseGraph<>();
767  final Graph<Integer, String> l_graph2 = new UndirectedSparseGraph<>();
768 
769  l_graph1.addEdge( "edgeA", 1, 2 );
770  l_graph2.addEdge( "edgeA", 2, 3 );
771 
772  new CEndPointSingle().execute(
773  false, IContext.EMPTYPLAN,
774  Stream.of( "edgeA", l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
775  l_return
776  );
777 
778  Assert.assertEquals( l_return.size(), 4 );
779  Assert.assertArrayEquals( l_return.stream().map( ITerm::raw ).toArray(), Stream.of( 1, 2, 2, 3 ).toArray() );
780  }
781 
782 
786  @Test
787  public final void endpointmultiple()
788  {
789  final List<ITerm> l_return = new ArrayList<>();
790  final Graph<Integer, String> l_graph = new UndirectedSparseGraph<>();
791 
792  l_graph.addEdge( "edge1", 1, 2 );
793  l_graph.addEdge( "edge2", 2, 4 );
794  l_graph.addEdge( "edge3", 4, 3 );
795 
797  false, IContext.EMPTYPLAN,
798  Stream.of( l_graph, "edge1", "edge3" ).map( CRawTerm::from ).collect( Collectors.toList() ),
799  l_return
800  );
801 
802  Assert.assertEquals( l_return.size(), 4 );
803  Assert.assertArrayEquals( l_return.stream().map( ITerm::raw ).toArray(), Stream.of( 1, 2, 4, 3 ).toArray() );
804  }
805 
806 
810  @Test
811  public final void indegreesingle()
812  {
813  final List<ITerm> l_return = new ArrayList<>();
814  final Graph<Integer, String> l_graph1 = new SparseGraph<>();
815  final Graph<Integer, String> l_graph2 = new SparseGraph<>();
816 
817  l_graph1.addEdge( "i", 1, 2 );
818  l_graph1.addEdge( "j", 3, 2 );
819  l_graph2.addEdge( "k", 4, 2 );
820  l_graph2.addEdge( "l", 6, 2 );
821  l_graph2.addEdge( "m", 8, 2 );
822 
823  new CInDegreeSingle().execute(
824  false, IContext.EMPTYPLAN,
825  Stream.of( 2, l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
826  l_return
827  );
828 
829  Assert.assertEquals( l_return.size(), 2 );
830  Assert.assertArrayEquals( l_return.stream().map( ITerm::raw ).toArray(), Stream.of( 2D, 3D ).toArray() );
831  }
832 
833 
837  @Test
838  public final void indegreemultiple()
839  {
840  final List<ITerm> l_return = new ArrayList<>();
841  final Graph<Integer, String> l_graph = new SparseGraph<>();
842 
843  l_graph.addEdge( "n", 1, 2 );
844  l_graph.addEdge( "m", 3, 2 );
845  l_graph.addEdge( "p", 1, 4 );
846 
848  false, IContext.EMPTYPLAN,
849  Stream.of( l_graph, 2, 3 ).map( CRawTerm::from ).collect( Collectors.toList() ),
850  l_return
851  );
852 
853  Assert.assertEquals( l_return.size(), 2 );
854  Assert.assertArrayEquals( l_return.stream().map( ITerm::raw ).toArray(), Stream.of( 2D, 1D ).toArray() );
855  }
856 
860  @Test
861  public final void inedgessingle()
862  {
863  final List<ITerm> l_return = new ArrayList<>();
864  final Graph<Integer, String> l_graph1 = new SparseGraph<>();
865  final Graph<Integer, String> l_graph2 = new SparseGraph<>();
866 
867  l_graph1.addEdge( "inedgesingle1", 1, 2 );
868  l_graph1.addEdge( "inedgesingle2", 2, 2 );
869  l_graph2.addEdge( "inedgesingle3", 1, 2 );
870 
871  new CInEdgesSingle().execute(
872  false, IContext.EMPTYPLAN,
873  Stream.of( 2, l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
874  l_return
875  );
876 
877  Assert.assertEquals( l_return.size(), 2 );
878  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), Stream.of( "inedgesingle1", "inedgesingle2" ).toArray() );
879  Assert.assertArrayEquals( l_return.get( 1 ).<List<?>>raw().toArray(), Stream.of( "inedgesingle3" ).toArray() );
880 
881 
882  l_return.clear();
883 
884  new CInEdgesSingle().execute(
885  true, IContext.EMPTYPLAN,
886  Stream.of( 2, l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
887  l_return
888  );
889 
890  Assert.assertEquals( l_return.size(), 2 );
891  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), Stream.of( "inedgesingle1", "inedgesingle2" ).toArray() );
892  Assert.assertArrayEquals( l_return.get( 1 ).<List<?>>raw().toArray(), Stream.of( "inedgesingle3" ).toArray() );
893  Assert.assertEquals( l_return.get( 0 ).raw().getClass(), Collections.synchronizedList( Collections.emptyList() ).getClass() );
894  Assert.assertEquals( l_return.get( 1 ).raw().getClass(), Collections.synchronizedList( Collections.emptyList() ).getClass() );
895  }
896 
897 
901  @Test
902  public final void inedgesmultiple()
903  {
904  final List<ITerm> l_return = new ArrayList<>();
905  final Graph<Integer, String> l_graph = new SparseGraph<>();
906 
907  l_graph.addEdge( "inedge3", 1, 2 );
908  l_graph.addEdge( "inedge4", 2, 2 );
909  l_graph.addEdge( "inedge5", 1, 3 );
910 
912  false, IContext.EMPTYPLAN,
913  Stream.of( l_graph, 2, 3 ).map( CRawTerm::from ).collect( Collectors.toList() ),
914  l_return
915  );
916 
917  Assert.assertEquals( l_return.size(), 2 );
918  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), Stream.of( "inedge3", "inedge4" ).toArray() );
919  Assert.assertArrayEquals( l_return.get( 1 ).<List<?>>raw().toArray(), Stream.of( "inedge5" ).toArray() );
920 
921 
922  l_return.clear();
923 
925  true, IContext.EMPTYPLAN,
926  Stream.of( l_graph, 2, 3 ).map( CRawTerm::from ).collect( Collectors.toList() ),
927  l_return
928  );
929 
930  Assert.assertEquals( l_return.size(), 2 );
931  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), Stream.of( "inedge3", "inedge4" ).toArray() );
932  Assert.assertArrayEquals( l_return.get( 1 ).<List<?>>raw().toArray(), Stream.of( "inedge5" ).toArray() );
933  Assert.assertEquals( l_return.get( 0 ).raw().getClass(), Collections.synchronizedList( Collections.emptyList() ).getClass() );
934  Assert.assertEquals( l_return.get( 1 ).raw().getClass(), Collections.synchronizedList( Collections.emptyList() ).getClass() );
935  }
936 
937 
941  @Test
942  public final void outdegreesingle()
943  {
944  final List<ITerm> l_return = new ArrayList<>();
945  final Graph<Integer, String> l_graph1 = new DirectedSparseGraph<>();
946  final Graph<Integer, String> l_graph2 = new DirectedSparseGraph<>();
947 
948  l_graph1.addEdge( "outdegree1", 1, 2 );
949  l_graph1.addEdge( "outdegree2", 2, 2 );
950  l_graph2.addEdge( "outdegree3", 1, 2 );
951 
953  false, IContext.EMPTYPLAN,
954  Stream.of( 2, l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
955  l_return
956  );
957 
958  Assert.assertEquals( l_return.size(), 2 );
959  Assert.assertArrayEquals( l_return.stream().map( ITerm::raw ).toArray(), Stream.of( 1D, 0D ).toArray() );
960  }
961 
962 
966  @Test
967  public final void outdegreemultiple()
968  {
969  final List<ITerm> l_return = new ArrayList<>();
970  final Graph<Integer, String> l_graph = new DirectedSparseGraph<>();
971 
972  l_graph.addEdge( "outdegree4", 1, 2 );
973  l_graph.addEdge( "outdegree5", 2, 2 );
974  l_graph.addEdge( "outdegree6", 1, 2 );
975 
977  false, IContext.EMPTYPLAN,
978  Stream.of( l_graph, 1, 2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
979  l_return
980  );
981 
982  Assert.assertEquals( l_return.size(), 2 );
983  Assert.assertArrayEquals( l_return.stream().map( ITerm::raw ).toArray(), Stream.of( 1D, 1D ).toArray() );
984  }
985 
986 
990  @Test
991  public final void incidentcountsingle()
992  {
993  final List<ITerm> l_return = new ArrayList<>();
994  final Graph<Integer, String> l_graph1 = new SparseGraph<>();
995  final Graph<Integer, String> l_graph2 = new SparseGraph<>();
996 
997  l_graph1.addEdge( "incident1", 1, 2 );
998  l_graph2.addEdge( "incident1", 1, 2 );
999 
1001  false, IContext.EMPTYPLAN,
1002  Stream.of( "incident1", l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1003  l_return
1004  );
1005 
1006  Assert.assertEquals( l_return.size(), 2 );
1007  Assert.assertArrayEquals( l_return.stream().map( ITerm::raw ).toArray(), Stream.of( 2D, 2D ).toArray() );
1008  }
1009 
1010 
1014  @Test
1015  public final void incidentcountmultiple()
1016  {
1017  final List<ITerm> l_return = new ArrayList<>();
1018  final Graph<Integer, String> l_graph = new SparseGraph<>();
1019 
1020  l_graph.addEdge( "incident1", 1, 2 );
1021  l_graph.addEdge( "incident2", 1, 2 );
1022 
1024  false, IContext.EMPTYPLAN,
1025  Stream.of( l_graph, "incident1", "incident2" ).map( CRawTerm::from ).collect( Collectors.toList() ),
1026  l_return
1027  );
1028 
1029  Assert.assertEquals( l_return.size(), 2 );
1030  Assert.assertArrayEquals( l_return.stream().map( ITerm::raw ).toArray(), Stream.of( 2D, 0D ).toArray() );
1031  }
1032 
1033 
1037  @Test
1038  public final void incidentverticessingle()
1039  {
1040  final List<ITerm> l_return = new ArrayList<>();
1041  final Graph<Integer, String> l_graph1 = new DirectedSparseGraph<>();
1042  final Graph<Integer, String> l_graph2 = new SparseGraph<>();
1043 
1044  l_graph1.addEdge( "incidentsingleA", 2, 1 );
1045  l_graph2.addEdge( "incidentsingleA", 1, 2 );
1046 
1048  false, IContext.EMPTYPLAN,
1049  Stream.of( "incidentsingleA", l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1050  l_return
1051  );
1052 
1053  Assert.assertEquals( l_return.size(), 2 );
1054  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), Stream.of( 2, 1 ).toArray() );
1055  Assert.assertArrayEquals( l_return.get( 1 ).<List<?>>raw().toArray(), Stream.of( 1, 2 ).toArray() );
1056 
1057 
1058  l_return.clear();
1059 
1061  true, IContext.EMPTYPLAN,
1062  Stream.of( "incidentsingleA", l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1063  l_return
1064  );
1065 
1066  Assert.assertEquals( l_return.size(), 2 );
1067  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), Stream.of( 2, 1 ).toArray() );
1068  Assert.assertArrayEquals( l_return.get( 1 ).<List<?>>raw().toArray(), Stream.of( 1, 2 ).toArray() );
1069  Assert.assertEquals( l_return.get( 0 ).raw().getClass(), Collections.synchronizedList( Collections.emptyList() ).getClass() );
1070  Assert.assertEquals( l_return.get( 1 ).raw().getClass(), Collections.synchronizedList( Collections.emptyList() ).getClass() );
1071  }
1072 
1073 
1077  @Test
1078  public final void incidentverticesmultiple()
1079  {
1080  final List<ITerm> l_return = new ArrayList<>();
1081  final Graph<Integer, String> l_graph = new DirectedSparseMultigraph<>();
1082 
1083  l_graph.addEdge( "incidentA", 2, 1 );
1084  l_graph.addEdge( "incidentB", 3, 2 );
1085  l_graph.addEdge( "incidentC", 5, 6 );
1086  l_graph.addEdge( "incidentD", 7, 6 );
1087 
1089  false, IContext.EMPTYPLAN,
1090  Stream.of( l_graph, "incidentA", "incidentB" ).map( CRawTerm::from ).collect( Collectors.toList() ),
1091  l_return
1092  );
1093 
1094  Assert.assertEquals( l_return.size(), 2 );
1095  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), Stream.of( 2, 1 ).toArray() );
1096  Assert.assertArrayEquals( l_return.get( 1 ).<List<?>>raw().toArray(), Stream.of( 3, 2 ).toArray() );
1097 
1098 
1099  l_return.clear();
1100 
1102  true, IContext.EMPTYPLAN,
1103  Stream.of( l_graph, "incidentA", "incidentB" ).map( CRawTerm::from ).collect( Collectors.toList() ),
1104  l_return
1105  );
1106 
1107  Assert.assertEquals( l_return.size(), 2 );
1108  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), Stream.of( 2, 1 ).toArray() );
1109  Assert.assertArrayEquals( l_return.get( 1 ).<List<?>>raw().toArray(), Stream.of( 3, 2 ).toArray() );
1110  Assert.assertEquals( l_return.get( 0 ).raw().getClass(), Collections.synchronizedList( Collections.emptyList() ).getClass() );
1111  Assert.assertEquals( l_return.get( 1 ).raw().getClass(), Collections.synchronizedList( Collections.emptyList() ).getClass() );
1112  }
1113 
1114 
1118  @Test
1119  public final void issuccessorsingle()
1120  {
1121  final List<ITerm> l_return = new ArrayList<>();
1122  final Graph<Integer, String> l_graph1 = new DirectedSparseMultigraph<>();
1123  final Graph<Integer, String> l_graph2 = new DirectedSparseMultigraph<>();
1124 
1125  l_graph1.addEdge( "successor1", 2, 1 );
1126  l_graph2.addEdge( "successor2", 1, 2 );
1127 
1129  false, IContext.EMPTYPLAN,
1130  Stream.of( 1, 2, l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1131  l_return
1132  );
1133 
1134  Assert.assertArrayEquals(
1135  l_return.stream().map( ITerm::<Boolean>raw ).toArray(),
1136  Stream.of( false, true ).toArray()
1137  );
1138  }
1139 
1143  @Test
1144  public final void issuccesormultiple()
1145  {
1146  final List<ITerm> l_return = new ArrayList<>();
1147  final Graph<Integer, String> l_graph = new DirectedSparseMultigraph<>();
1148 
1149  l_graph.addEdge( "successor1", 2, 1 );
1150  l_graph.addEdge( "successor2", 3, 1 );
1151 
1153  false, IContext.EMPTYPLAN,
1154  Stream.of( l_graph, 1, 2, 3, 1 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1155  l_return
1156  );
1157 
1158  Assert.assertArrayEquals(
1159  l_return.stream().map( ITerm::<Boolean>raw ).toArray(),
1160  Stream.of( false, true ).toArray()
1161  );
1162  }
1163 
1164 
1168  @Test
1169  public final void ispredecessorsingle()
1170  {
1171  final List<ITerm> l_return = new ArrayList<>();
1172  final Graph<Integer, String> l_graph1 = new DirectedSparseMultigraph<>();
1173  final Graph<Integer, String> l_graph2 = new DirectedSparseMultigraph<>();
1174 
1175  l_graph1.addEdge( "predecessor1", 2, 1 );
1176  l_graph2.addEdge( "predecessor2", 1, 2 );
1177 
1179  false, IContext.EMPTYPLAN,
1180  Stream.of( 1, 2, l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1181  l_return
1182  );
1183 
1184  Assert.assertArrayEquals(
1185  l_return.stream().map( ITerm::<Boolean>raw ).toArray(),
1186  Stream.of( true, false ).toArray()
1187  );
1188  }
1189 
1193  @Test
1194  public final void ispredecessormultiple()
1195  {
1196  final List<ITerm> l_return = new ArrayList<>();
1197  final Graph<Integer, String> l_graph = new DirectedSparseMultigraph<>();
1198 
1199  l_graph.addEdge( "predecessor1", 2, 1 );
1200  l_graph.addEdge( "predecessor2", 3, 1 );
1201 
1203  false, IContext.EMPTYPLAN,
1204  Stream.of( l_graph, 1, 2, 3, 1 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1205  l_return
1206  );
1207 
1208  Assert.assertArrayEquals(
1209  l_return.stream().map( ITerm::<Boolean>raw ).toArray(),
1210  Stream.of( true, false ).toArray()
1211  );
1212  }
1213 
1214 
1218  @Test
1219  public final void neighborscountsingle()
1220  {
1221  final List<ITerm> l_return = new ArrayList<>();
1222  final Graph<Integer, String> l_graph1 = new DirectedSparseMultigraph<>();
1223  final Graph<Integer, String> l_graph2 = new DirectedSparseMultigraph<>();
1224 
1225  l_graph1.addEdge( "neighborcount1", 2, 1 );
1226  l_graph1.addEdge( "neighborcount2", 3, 1 );
1227  l_graph2.addEdge( "neighborcount1", 2, 1 );
1228  l_graph2.addEdge( "neighborcount2", 3, 1 );
1229  l_graph2.addEdge( "neighborcount3", 4, 1 );
1230 
1232  false, IContext.EMPTYPLAN,
1233  Stream.of( 1, l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1234  l_return
1235  );
1236 
1237  Assert.assertArrayEquals(
1238  l_return.stream().map( ITerm::<Number>raw ).map( Number::longValue ).toArray(),
1239  Stream.of( 2L, 3L ).toArray()
1240  );
1241  }
1242 
1243 
1247  @Test
1248  public final void neighborscountmultiple()
1249  {
1250  final List<ITerm> l_return = new ArrayList<>();
1251  final Graph<Integer, String> l_graph = new DirectedSparseMultigraph<>();
1252 
1253  l_graph.addEdge( "neighborcount1", 2, 1 );
1254  l_graph.addEdge( "neighborcount2", 3, 1 );
1255  l_graph.addEdge( "neighborcount3", 5, 3 );
1256  l_graph.addEdge( "neighborcount4", 4, 1 );
1257 
1259  false, IContext.EMPTYPLAN,
1260  Stream.of( l_graph, 1, 3 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1261  l_return
1262  );
1263 
1264  Assert.assertArrayEquals(
1265  l_return.stream().map( ITerm::<Number>raw ).map( Number::longValue ).toArray(),
1266  Stream.of( 3L, 2L ).toArray()
1267  );
1268  }
1269 
1270 
1274  @Test
1275  public final void isneighborsingle()
1276  {
1277  final List<ITerm> l_return = new ArrayList<>();
1278  final Graph<Integer, String> l_graph1 = new DirectedSparseMultigraph<>();
1279  final Graph<Integer, String> l_graph2 = new DirectedSparseMultigraph<>();
1280 
1281  l_graph1.addEdge( "isneighbor1", 2, 1 );
1282  l_graph1.addEdge( "isneighbor2", 3, 1 );
1283  l_graph2.addEdge( "isneighbor1", 2, 1 );
1284  l_graph2.addEdge( "isneighbor2", 3, 1 );
1285  l_graph2.addEdge( "isneighbor3", 4, 1 );
1286 
1287  new CIsNeighborSingle().execute(
1288  false, IContext.EMPTYPLAN,
1289  Stream.of( 1, 2, l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1290  l_return
1291  );
1292 
1293  Assert.assertArrayEquals(
1294  l_return.stream().map( ITerm::<Boolean>raw ).toArray(),
1295  Stream.of( true, true ).toArray()
1296  );
1297  }
1298 
1299 
1303  @Test
1304  public final void isneighbormultiple()
1305  {
1306  final List<ITerm> l_return = new ArrayList<>();
1307  final Graph<Integer, String> l_graph = new DirectedSparseMultigraph<>();
1308 
1309  l_graph.addEdge( "isneighbor10", 2, 1 );
1310  l_graph.addEdge( "isneighbor20", 3, 1 );
1311  l_graph.addEdge( "isneighbor10", 2, 1 );
1312  l_graph.addEdge( "isneighbor20", 3, 1 );
1313  l_graph.addEdge( "isneighbor30", 4, 1 );
1314 
1316  false, IContext.EMPTYPLAN,
1317  Stream.of( l_graph, 1, 2, 3, 4, 3, 2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1318  l_return
1319  );
1320 
1321  Assert.assertArrayEquals(
1322  l_return.stream().map( ITerm::<Boolean>raw ).toArray(),
1323  Stream.of( true, false, false ).toArray()
1324  );
1325  }
1326 
1327 
1331  @Test
1332  public final void neigborssingle()
1333  {
1334  final List<ITerm> l_return = new ArrayList<>();
1335  final Graph<Integer, String> l_graph1 = new DirectedSparseMultigraph<>();
1336  final Graph<Integer, String> l_graph2 = new DirectedSparseMultigraph<>();
1337 
1338  l_graph1.addEdge( "isneighbor1", 2, 1 );
1339  l_graph1.addEdge( "isneighbor2", 3, 1 );
1340  l_graph2.addEdge( "isneighbor1", 2, 1 );
1341  l_graph2.addEdge( "isneighbor2", 3, 1 );
1342  l_graph2.addEdge( "isneighbor3", 4, 1 );
1343 
1344  new CNeighborsSingle().execute(
1345  false, IContext.EMPTYPLAN,
1346  Stream.of( 1, l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1347  l_return
1348  );
1349 
1350  Assert.assertEquals( l_return.size(), 2 );
1351  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), Stream.of( 2, 3 ).toArray() );
1352  Assert.assertArrayEquals( l_return.get( 1 ).<List<?>>raw().toArray(), Stream.of( 2, 3, 4 ).toArray() );
1353 
1354 
1355  l_return.clear();
1356 
1357  new CNeighborsSingle().execute(
1358  true, IContext.EMPTYPLAN,
1359  Stream.of( 1, l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1360  l_return
1361  );
1362 
1363  Assert.assertEquals( l_return.size(), 2 );
1364  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), Stream.of( 2, 3 ).toArray() );
1365  Assert.assertArrayEquals( l_return.get( 1 ).<List<?>>raw().toArray(), Stream.of( 2, 3, 4 ).toArray() );
1366  Assert.assertEquals( l_return.get( 0 ).raw().getClass(), Collections.synchronizedList( Collections.emptyList() ).getClass() );
1367  Assert.assertEquals( l_return.get( 1 ).raw().getClass(), Collections.synchronizedList( Collections.emptyList() ).getClass() );
1368  }
1369 
1370 
1374  @Test
1375  public final void neigborsmultiple()
1376  {
1377  final List<ITerm> l_return = new ArrayList<>();
1378  final Graph<Integer, String> l_graph = new DirectedSparseMultigraph<>();
1379 
1380  l_graph.addEdge( "neighbors1", 2, 1 );
1381  l_graph.addEdge( "neighbors2", 3, 1 );
1382  l_graph.addEdge( "neighbors1", 2, 1 );
1383  l_graph.addEdge( "neighbors2", 3, 1 );
1384  l_graph.addEdge( "neighbors3", 4, 1 );
1385 
1387  false, IContext.EMPTYPLAN,
1388  Stream.of( l_graph, 1, 3 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1389  l_return
1390  );
1391 
1392  Assert.assertEquals( l_return.size(), 2 );
1393  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), Stream.of( 2, 3, 4 ).toArray() );
1394  Assert.assertArrayEquals( l_return.get( 1 ).<List<?>>raw().toArray(), Stream.of( 1 ).toArray() );
1395 
1396 
1397  l_return.clear();
1398 
1400  true, IContext.EMPTYPLAN,
1401  Stream.of( l_graph, 1, 3 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1402  l_return
1403  );
1404 
1405  Assert.assertEquals( l_return.size(), 2 );
1406  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), Stream.of( 2, 3, 4 ).toArray() );
1407  Assert.assertArrayEquals( l_return.get( 1 ).<List<?>>raw().toArray(), Stream.of( 1 ).toArray() );
1408  Assert.assertEquals( l_return.get( 0 ).raw().getClass(), Collections.synchronizedList( Collections.emptyList() ).getClass() );
1409  Assert.assertEquals( l_return.get( 1 ).raw().getClass(), Collections.synchronizedList( Collections.emptyList() ).getClass() );
1410  }
1411 
1412 
1416  @Test
1417  public final void isincidentsingle()
1418  {
1419  final List<ITerm> l_return = new ArrayList<>();
1420  final Graph<Integer, String> l_graph1 = new DirectedSparseMultigraph<>();
1421  final Graph<Integer, String> l_graph2 = new DirectedSparseMultigraph<>();
1422 
1423  l_graph1.addEdge( "isincident1", 2, 1 );
1424  l_graph1.addEdge( "isincident2", 3, 1 );
1425  l_graph2.addEdge( "isincident1", 2, 1 );
1426  l_graph2.addEdge( "isincident2", 3, 1 );
1427  l_graph2.addEdge( "isincident3", 4, 1 );
1428 
1429  new CIsIncidentSingle().execute(
1430  false, IContext.EMPTYPLAN,
1431  Stream.of( 1, "isincident2", l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1432  l_return
1433  );
1434 
1435  Assert.assertArrayEquals(
1436  l_return.stream().map( ITerm::raw ).toArray(),
1437  Stream.of( true, true ).toArray()
1438  );
1439  }
1440 
1441 
1445  @Test
1446  public final void isincidentmultiple()
1447  {
1448  final List<ITerm> l_return = new ArrayList<>();
1449  final Graph<Integer, String> l_graph = new DirectedSparseMultigraph<>();
1450 
1451  l_graph.addEdge( "isincident10", 2, 1 );
1452  l_graph.addEdge( "isincident20", 3, 1 );
1453  l_graph.addEdge( "isincident10", 2, 1 );
1454  l_graph.addEdge( "isincident20", 3, 1 );
1455  l_graph.addEdge( "isincident30", 4, 1 );
1456 
1458  false, IContext.EMPTYPLAN,
1459  Stream.of( l_graph, 1, "isincident10", 2, "isincident20" ).map( CRawTerm::from ).collect( Collectors.toList() ),
1460  l_return
1461  );
1462 
1463  Assert.assertArrayEquals(
1464  l_return.stream().map( ITerm::raw ).toArray(),
1465  Stream.of( true, false ).toArray()
1466  );
1467  }
1468 
1472  @Test
1473  public final void oppositesingle()
1474  {
1475  final List<ITerm> l_return = new ArrayList<>();
1476  final Graph<Integer, String> l_graph1 = new DirectedSparseMultigraph<>();
1477  final Graph<Integer, String> l_graph2 = new DirectedSparseMultigraph<>();
1478 
1479  l_graph1.addEdge( "opposite", 2, 1 );
1480  l_graph2.addEdge( "opposite", 3, 1 );
1481 
1482  new COppositeSingle().execute(
1483  false, IContext.EMPTYPLAN,
1484  Stream.of( 1, "opposite", l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1485  l_return
1486  );
1487 
1488  Assert.assertEquals( l_return.size(), 2 );
1489  Assert.assertArrayEquals( l_return.stream().map( ITerm::raw ).toArray(), Stream.of( 2, 3 ).toArray() );
1490  }
1491 
1492 
1496  @Test
1497  public final void oppositemultiple()
1498  {
1499  final List<ITerm> l_return = new ArrayList<>();
1500  final Graph<Integer, String> l_graph = new DirectedSparseMultigraph<>();
1501 
1502  l_graph.addEdge( "opposite1", 2, 1 );
1503  l_graph.addEdge( "opposite2", 3, 4 );
1504 
1505  new COppositeMultiple().execute(
1506  false, IContext.EMPTYPLAN,
1507  Stream.of( l_graph, 1, "opposite1", 3, "opposite2" ).map( CRawTerm::from ).collect( Collectors.toList() ),
1508  l_return
1509  );
1510 
1511  Assert.assertEquals( l_return.size(), 2 );
1512  Assert.assertArrayEquals( l_return.stream().map( ITerm::raw ).toArray(), Stream.of( 2, 4 ).toArray() );
1513  }
1514 
1515 
1519  @Test
1520  public final void outedgessingle()
1521  {
1522  final List<ITerm> l_return = new ArrayList<>();
1523  final Graph<Integer, String> l_graph1 = new DirectedSparseMultigraph<>();
1524  final Graph<Integer, String> l_graph2 = new DirectedSparseMultigraph<>();
1525 
1526  l_graph1.addEdge( "outedgesingle1", 1, 2 );
1527  l_graph1.addEdge( "outedgesingle2", 1, 3 );
1528  l_graph2.addEdge( "outedgesingle3", 1, 4 );
1529  l_graph2.addEdge( "outedgesingle4", 1, 5 );
1530 
1531  new COutEdgesSingle().execute(
1532  false, IContext.EMPTYPLAN,
1533  Stream.of( 1, l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1534  l_return
1535  );
1536 
1537  Assert.assertEquals( l_return.size(), 2 );
1538  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), Stream.of( "outedgesingle2", "outedgesingle1" ).toArray() );
1539  Assert.assertArrayEquals( l_return.get( 1 ).<List<?>>raw().toArray(), Stream.of( "outedgesingle4", "outedgesingle3" ).toArray() );
1540 
1541 
1542  l_return.clear();
1543 
1544  new COutEdgesSingle().execute(
1545  true, IContext.EMPTYPLAN,
1546  Stream.of( 1, l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1547  l_return
1548  );
1549 
1550  Assert.assertEquals( l_return.size(), 2 );
1551  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), Stream.of( "outedgesingle2", "outedgesingle1" ).toArray() );
1552  Assert.assertArrayEquals( l_return.get( 1 ).<List<?>>raw().toArray(), Stream.of( "outedgesingle4", "outedgesingle3" ).toArray() );
1553  Assert.assertEquals( l_return.get( 0 ).raw().getClass(), Collections.synchronizedList( Collections.emptyList() ).getClass() );
1554  Assert.assertEquals( l_return.get( 1 ).raw().getClass(), Collections.synchronizedList( Collections.emptyList() ).getClass() );
1555  }
1556 
1557 
1561  @Test
1562  public final void outedgemultiple()
1563  {
1564  final List<ITerm> l_return = new ArrayList<>();
1565  final Graph<Integer, String> l_graph = new DirectedSparseMultigraph<>();
1566 
1567  l_graph.addEdge( "outedgemultiple1", 1, 2 );
1568  l_graph.addEdge( "outedgemultiple2", 1, 3 );
1569  l_graph.addEdge( "outedgemultiple3", 2, 4 );
1570  l_graph.addEdge( "outedgemultiple4", 2, 5 );
1571 
1572  new COutEdgesMultiple().execute(
1573  false, IContext.EMPTYPLAN,
1574  Stream.of( l_graph, 1, 2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1575  l_return
1576  );
1577 
1578  Assert.assertEquals( l_return.size(), 2 );
1579  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), Stream.of( "outedgemultiple2", "outedgemultiple1" ).toArray() );
1580  Assert.assertArrayEquals( l_return.get( 1 ).<List<?>>raw().toArray(), Stream.of( "outedgemultiple4", "outedgemultiple3" ).toArray() );
1581 
1582 
1583  l_return.clear();
1584 
1585  new COutEdgesMultiple().execute(
1586  true, IContext.EMPTYPLAN,
1587  Stream.of( l_graph, 1, 2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1588  l_return
1589  );
1590 
1591  Assert.assertEquals( l_return.size(), 2 );
1592  Assert.assertArrayEquals( l_return.get( 0 ).<List<?>>raw().toArray(), Stream.of( "outedgemultiple2", "outedgemultiple1" ).toArray() );
1593  Assert.assertArrayEquals( l_return.get( 1 ).<List<?>>raw().toArray(), Stream.of( "outedgemultiple4", "outedgemultiple3" ).toArray() );
1594  Assert.assertEquals( l_return.get( 0 ).raw().getClass(), Collections.synchronizedList( Collections.emptyList() ).getClass() );
1595  Assert.assertEquals( l_return.get( 1 ).raw().getClass(), Collections.synchronizedList( Collections.emptyList() ).getClass() );
1596  }
1597 
1598 
1602  @Test
1603  public final void predecessorcountsingle()
1604  {
1605  final List<ITerm> l_return = new ArrayList<>();
1606  final Graph<Integer, String> l_graph1 = new DirectedSparseMultigraph<>();
1607  final Graph<Integer, String> l_graph2 = new DirectedSparseMultigraph<>();
1608 
1609  l_graph1.addEdge( "predecessorcountsingle1", 1, 2 );
1610  l_graph1.addEdge( "predecessorcountsingle2", 3, 1 );
1611  l_graph2.addEdge( "predecessorcountsingle3", 2, 1 );
1612  l_graph2.addEdge( "predecessorcountsingle4", 5, 1 );
1613 
1615  false, IContext.EMPTYPLAN,
1616  Stream.of( 1, l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1617  l_return
1618  );
1619 
1620  Assert.assertEquals( l_return.size(), 2 );
1621  Assert.assertArrayEquals( l_return.stream().map( ITerm::raw ).toArray(), Stream.of( 1D, 2D ).toArray() );
1622  }
1623 
1624 
1628  @Test
1629  public final void predecessorcountmultiple()
1630  {
1631  final List<ITerm> l_return = new ArrayList<>();
1632  final Graph<Integer, String> l_graph = new DirectedSparseMultigraph<>();
1633 
1634  l_graph.addEdge( "predecessorcountmultiple1", 1, 2 );
1635  l_graph.addEdge( "predecessorcountmultiple2", 1, 3 );
1636  l_graph.addEdge( "predecessorcountmultiple3", 4, 2 );
1637  l_graph.addEdge( "predecessorcountmultiple4", 5, 1 );
1638 
1640  false, IContext.EMPTYPLAN,
1641  Stream.of( l_graph, 1, 2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1642  l_return
1643  );
1644 
1645  Assert.assertEquals( l_return.size(), 2 );
1646  Assert.assertArrayEquals( l_return.stream().map( ITerm::raw ).toArray(), Stream.of( 1D, 2D ).toArray() );
1647  }
1648 
1649 
1653  @Test
1654  public final void vertexremovemultiple()
1655  {
1656  final Graph<Integer, String> l_graph = new DirectedSparseGraph<>();
1657 
1658  l_graph.addVertex( 5 );
1659  l_graph.addVertex( 3 );
1660  l_graph.addEdge( "vertexremovemultiple", 1, 2 );
1661 
1663  false, IContext.EMPTYPLAN,
1664  Stream.of( l_graph, 1, 3, 5 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1665  Collections.emptyList()
1666  );
1667 
1668 
1669  Assert.assertEquals( l_graph.getEdgeCount(), 0 );
1670  Assert.assertArrayEquals( l_graph.getVertices().toArray(), Stream.of( 2 ).toArray() );
1671  }
1672 
1673 
1677  @Test
1678  public final void vertextremovesingle()
1679  {
1680  final Graph<Integer, String> l_graph1 = new DirectedSparseGraph<>();
1681  final Graph<Integer, String> l_graph2 = new DirectedSparseGraph<>();
1682 
1683  l_graph1.addVertex( 5 );
1684  l_graph1.addVertex( 3 );
1685  l_graph1.addEdge( "vertexremovesingle", 5, 7 );
1686  l_graph2.addVertex( 5 );
1687  l_graph2.addVertex( 7 );
1688  l_graph2.addEdge( "vertexremovesingle", 7, 1 );
1689 
1691  false, IContext.EMPTYPLAN,
1692  Stream.of( 5, l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1693  Collections.emptyList()
1694  );
1695 
1696  Assert.assertEquals( l_graph1.getEdgeCount(), 0 );
1697  Assert.assertEquals( l_graph2.getEdgeCount(), 1 );
1698 
1699  Assert.assertArrayEquals( l_graph1.getVertices().toArray(), Stream.of( 3, 7 ).toArray() );
1700  Assert.assertArrayEquals( l_graph2.getVertices().toArray(), Stream.of( 1, 7 ).toArray() );
1701  }
1702 
1703 
1707  @Test
1708  public final void successorcountsingle()
1709  {
1710  final List<ITerm> l_return = new ArrayList<>();
1711 
1712  final Graph<Integer, String> l_graph1 = new DirectedSparseGraph<>();
1713  final Graph<Integer, String> l_graph2 = new DirectedSparseGraph<>();
1714 
1715  l_graph1.addEdge( "successorcountsingle1", 1, 5 );
1716  l_graph1.addEdge( "successorcountsingle2", 1, 7 );
1717  l_graph1.addEdge( "successorcountsingle3", 1, 3 );
1718 
1719  l_graph2.addEdge( "successorcountsingle4", 1, 2 );
1720  l_graph2.addEdge( "successorcountsingle5", 1, 9 );
1721 
1723  false, IContext.EMPTYPLAN,
1724  Stream.of( 1, l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1725  l_return
1726  );
1727 
1728  Assert.assertArrayEquals( l_return.stream().map( ITerm::raw ).toArray(), Stream.of( 3D, 2D ).toArray() );
1729  }
1730 
1731 
1735  @Test
1736  public final void successorcountmultiple()
1737  {
1738  final List<ITerm> l_return = new ArrayList<>();
1739  final Graph<Integer, String> l_graph = new DirectedSparseGraph<>();
1740 
1741  l_graph.addEdge( "successorcountmultiple1", 1, 5 );
1742  l_graph.addEdge( "successorcountmultiple2", 1, 7 );
1743  l_graph.addEdge( "successorcountmultiple3", 1, 3 );
1744  l_graph.addEdge( "successorcountmultiple4", 3, 5 );
1745 
1747  false, IContext.EMPTYPLAN,
1748  Stream.of( l_graph, 1, 3 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1749  l_return
1750  );
1751 
1752  Assert.assertArrayEquals( l_return.stream().map( ITerm::raw ).toArray(), Stream.of( 3D, 1D ).toArray() );
1753  }
1754 
1755 
1759  @Test
1760  public final void removeedgesingle()
1761  {
1762  final Graph<Integer, String> l_graph1 = new DirectedSparseGraph<>();
1763  final Graph<Integer, String> l_graph2 = new DirectedSparseGraph<>();
1764 
1765  l_graph1.addEdge( "removeedgesingle1", 1, 5 );
1766  l_graph1.addEdge( "removeedgesingle2", 1, 7 );
1767  l_graph1.addEdge( "removeedgesingle3", 1, 3 );
1768 
1769  l_graph2.addEdge( "removeedgesingle1", 1, 2 );
1770  l_graph2.addEdge( "removeedgesingle5", 1, 9 );
1771 
1772  new CRemoveEdgeSingle().execute(
1773  false, IContext.EMPTYPLAN,
1774  Stream.of( "removeedgesingle1", l_graph1, l_graph2 ).map( CRawTerm::from ).collect( Collectors.toList() ),
1775  Collections.emptyList()
1776  );
1777 
1778  Assert.assertArrayEquals( l_graph1.getEdges().toArray(), Stream.of( "removeedgesingle2", "removeedgesingle3" ).toArray() );
1779  Assert.assertArrayEquals( l_graph2.getEdges().toArray(), Stream.of( "removeedgesingle5" ).toArray() );
1780  }
1781 
1782 
1786  @Test
1787  public final void removeedgemultiple()
1788  {
1789  final Graph<Integer, String> l_graph = new DirectedSparseGraph<>();
1790 
1791  l_graph.addEdge( "removeedgesingle1", 1, 5 );
1792  l_graph.addEdge( "removeedgesingle2", 1, 7 );
1793  l_graph.addEdge( "removeedgesingle3", 1, 3 );
1794  l_graph.addEdge( "removeedgesingle4", 5, 3 );
1795  l_graph.addEdge( "removeedgesingle5", 5, 7 );
1796 
1798  false, IContext.EMPTYPLAN,
1799  Stream.of( l_graph, "removeedgesingle2", "removeedgesingle5" ).map( CRawTerm::from ).collect( Collectors.toList() ),
1800  Collections.emptyList()
1801  );
1802 
1803  Assert.assertArrayEquals( l_graph.getEdges().toArray(), Stream.of( "removeedgesingle1", "removeedgesingle4", "removeedgesingle3" ).toArray() );
1804  }
1805 
1806 }
returns of an edge the vertices from each graph instance.
returns of any edge the vertices from a single graph instance.
final IFuzzyValue< Boolean > execute(final boolean p_parallel, @Nonnull final IContext p_context, @Nonnull final List< ITerm > p_argument, @Nonnull final List< ITerm > p_return)
defines a plan-body operation
Definition: CVertices.java:65
final IFuzzyValue< Boolean > execute(final boolean p_parallel, @Nonnull final IContext p_context, @Nonnull final List< ITerm > p_argument, @Nonnull final List< ITerm > p_return)
defines a plan-body operation
Definition: CEdges.java:66
returns the number of predecessors of any vertex in a single graph instance.
returns the number of successors of a vertex within each graph instance.
base test class with helpers
Definition: IBaseTest.java:33
final IFuzzyValue< Boolean > execute(final boolean p_parallel, @Nonnull final IContext p_context, @Nonnull final List< ITerm > p_argument, @Nonnull final List< ITerm > p_return)
defines a plan-body operation
Definition: CEdgeCount.java:64
returns the number neighbors of each vertices of a single graph instance.
final void removeedgemultiple()
test remove edge multiple
checks if a vertex is successor of another vertex of each graph instance.
checks all vertex tuple, if the first part is a neighbor of the second one of a single graph instance...
final void neighborscountmultiple()
test neighborscount single
IContext EMPTYPLAN
empty context with plan
Definition: IContext.java:47
final void ispredecessormultiple()
test is-predecessor multiple
final void isincidentmultiple()
test is-incident multiple
final void ispredecessorsingle()
test is-predecessor single
returns a list of incident vertices of each edge of a single graph instance.
final void neighborscountsingle()
test neighborscount single
final void vertextremovesingle()
test remove vertex single
calculates the edge list of the shortest path of two vertices within each graph instance.
final IFuzzyValue< Boolean > execute(final boolean p_parallel, @Nonnull final IContext p_context, @Nonnull final List< ITerm > p_argument, @Nonnull final List< ITerm > p_return)
defines a plan-body operation
returns the in-degree of a vertex of multiple graph instances.
final IFuzzyValue< Boolean > execute(final boolean p_parallel, @Nonnull final IContext p_context, @Nonnull final List< ITerm > p_argument, @Nonnull final List< ITerm > p_return)
defines a plan-body operation
returns the number of predecessors of a vertex in multiple graph instances.
final void successorcountmultiple()
test successor count multiple
final IFuzzyValue< Boolean > execute(final boolean p_parallel, @Nonnull final IContext p_context, @Nonnull final List< ITerm > p_argument, @Nonnull final List< ITerm > p_return)
defines a plan-body operation
returns the neighbors of a vertex of each graph instance.
checks if a vertex and an edge incident for each graph instance.
returns an edge between vertices for each graph instance.
returns the opposit of a vertex and edge of any graph instance.
execution context with local data
Definition: IContext.java:42
returns the number of vertices that are incident to edge of each graph instance.
returns the number of successors of each vertex of a single graph instance.
creates a minimal spanning tree of any graph instance.
final void isneighbormultiple()
test is-neighbor multiple
returns incomming edges of a vertex of each graph instance.
returns the out-degree of a vertex of each graph instance.
calculates the distance of two vertices within each graph instance.
final void incidentverticesmultiple()
test incident-vertices multiple
checks all vertex tuples if the first part the successor of the second on a single graph instance...
final IFuzzyValue< Boolean > execute(final boolean p_parallel, @Nonnull final IContext p_context, @Nonnull final List< ITerm > p_argument, @Nonnull final List< ITerm > p_return)
defines a plan-body operation
returns all edges of all vertex tuples for a single graph instance.
final void vertexremovemultiple()
test remove vertex multiple
returns the opposit of each vertex and edge tuple of a single graph instance.
final void incidentcountsingle()
test incident-count single
add multiple edges to a single graph instance.
checks if a vertex is neighbor of another vertex of each graph instance.
< T > T raw()
cast to any raw value type
checks if a vertex and edge tuple is incident for a single graph instance.
final IFuzzyValue< Boolean > execute(final boolean p_parallel, @Nonnull final IContext p_context, @Nonnull final List< ITerm > p_argument, @Nonnull final List< ITerm > p_return)
defines a plan-body operation
final IFuzzyValue< Boolean > execute(final boolean p_parallel, @Nonnull final IContext p_context, @Nonnull final List< ITerm > p_argument, @Nonnull final List< ITerm > p_return)
defines a plan-body operation
returns outgoing edges of a vertex of each graph.
checks all vertex tuples if the first part the predecessor of the second on a single graph instance...
returns the out-degree of each vertex of a single graph instance.
final void issuccesormultiple()
test is-successor multiple
static< N > CRawTerm< N > from(final N p_value)
factory for a raw term
Definition: CRawTerm.java:104
returns the neighbors of each vertex of single graph instance.
returns incomming edges of all vertices of a single graph instance.
final IFuzzyValue< Boolean > execute(final boolean p_parallel, @Nonnull final IContext p_context, @Nonnull final List< ITerm > p_argument, @Nonnull final List< ITerm > p_return)
defines a plan-body operation
final void addvertexmultiple()
test add-vertex multiple
returns all edges of two vertices of each graph instance.
final void incidentverticessingle()
test incident-vertices single
checks if a vertex is predecessor of another vertex of each graph instance.
returns the vertex degree of multiple graphs.
returns the number of vertices that are incident to each edge of a single graph instance.
final IFuzzyValue< Boolean > execute(final boolean p_parallel, @Nonnull final IContext p_context, @Nonnull final List< ITerm > p_argument, @Nonnull final List< ITerm > p_return)
defines a plan-body operation
final void incidentcountmultiple()
test incident-count single
final void predecessorcountsingle()
test predecessor count single
final void predecessorcountmultiple()
test predecessor count multiple
returns the in-degree of multiple vertices of a single graph instance.
returns multiple vertex degrees of a single graph.
returns all edges between vertices for a graph instance.
returns the number neighbors of a vertex of each graph instance.
returns outgoing edges of any vertex of a single graph.
final void successorcountsingle()
test successor count single
final IFuzzyValue< Boolean > execute(final boolean p_parallel, @Nonnull final IContext p_context, @Nonnull final List< ITerm > p_argument, @Nonnull final List< ITerm > p_return)
defines a plan-body operation
term structure for simple datatypes
Definition: CRawTerm.java:45
returns a list of incident vertices of an edge of each graph instance.