示例#1
0
 public static Digraph merge(Digraph destination, DigraphIteration graphToMerge) {
   for (Iterator i = graphToMerge.vertexIterator(); i.hasNext(); ) {
     destination.addVertex(i.next());
   }
   for (ArcIterator i = graphToMerge.arcIterator(); i.hasNext(); ) {
     Object arc = i.next();
     Object origin = i.getOrigin();
     Object dst = i.getDestination();
     destination.putArc(origin, dst, arc);
   }
   return destination;
 }
示例#2
0
 public static Digraph transform(
     Digraph result,
     DigraphIteration source,
     Transformer vertexTransform,
     Transformer arcTransform) {
   for (Iterator i = new TransformIterator(source.vertexIterator(), vertexTransform);
       i.hasNext(); ) {
     result.addVertex(i.next());
   }
   for (ArcIterator i =
           new TransformArcIterator(source.arcIterator(), vertexTransform, arcTransform);
       i.hasNext(); ) {
     Object arc = i.next();
     Object origin = i.getOrigin();
     Object dst = i.getDestination();
     result.putArc(origin, dst, arc);
   }
   return result;
 }