Generate Voronoi using the graph of triangle computed by {@link #generateTriangleNeighbors(org.locationtech.jts.geom.Geometry)}
@return Collection of LineString (edges of Voronoi)
19637
public GeometryCollection generateVoronoi(int outputDimension) throws TopologyException {
        GeometryFactory geometryFactory = inputTriangles.getFactory();
        if(triangleNeighbors == null || triangleNeighbors.length == 0) {
            return geometryFactory.createMultiLineString(new LineString[0]);
        }
        Coordinate[] triangleCircumcenter = new Coordinate[inputTriangles.getNumGeometries()];
        if(outputDimension == 2 && envelope == null) {
            List<Polygon> polygons = new ArrayList<Polygon>(triangleCircumcenter.length);
            Set<Integer> processedVertex = new HashSet<Integer>();
            for (int idgeom = 0; idgeom < triangleCircumcenter.length; idgeom++) {
                    Geometry geomItem = inputTriangles.getGeometryN(idgeom);
                    if (geomItem instanceof Polygon) {
                        if(doProcessTriangle(idgeom, triangleCircumcenter)) {
                            Triple neigh = triangleNeighbors[idgeom];
                            for (int sideNeigh = 0; sideNeigh < 3; sideNeigh++) {
                                int neighIndex = neigh.get(sideNeigh);
                                for (int vertexSide = 0; vertexSide < 3; vertexSide++) {
                                    // If vertex is shared by this neighbor (see ascii art of triangle)
                                    if (vertexSide != sideNeigh) {
                                        int vertexIndex = triangleVertex[idgeom].get(vertexSide);
                                        if (neighIndex != -1 && !processedVertex.contains(vertexIndex)) {
                                            // Add voronoi edge between circumcentre of A and current triangle circumcenter
                                            Polygon result = generateVoronoiPolygon(idgeom, vertexIndex, triangleCircumcenter);
                                            if (result != null) {
                                                polygons.add(result);
                                            }
                                            processedVertex.add(vertexIndex);
                                        }
                                    }
                                }
                            }
                        }
                } else {
                    throw new TopologyException("Voronoi method accept only polygons");
                }
            }
            MultiPolygon result = geometryFactory.createMultiPolygon(polygons.toArray(new Polygon[0]));
            if(envelope == null) {
                return result;
            } else {
                return (GeometryCollection)geometryFactory.toGeometry(envelope).intersection(result);
            }
        } else if(outputDimension == 1 || (envelope != null && outputDimension == 2)) {
            //.. later
            List<LineString> lineStrings = new ArrayList<LineString>(triangleCircumcenter.length);
            List<LineString> voronoiBorderLines = new ArrayList<LineString>();
            for (int idgeom = 0; idgeom < triangleCircumcenter.length; idgeom++) {
                Geometry geomItem = inputTriangles.getGeometryN(idgeom);
                if (geomItem instanceof Polygon) {
                    if(doProcessTriangle(idgeom, triangleCircumcenter))  {
                        Triple neigh = triangleNeighbors[idgeom];
                        for(int side = 0;side < 3; side ++) {
                            int neighIndex = neigh.get(side);
                            if(neighIndex >= 0 && !doProcessTriangle(neighIndex, triangleCircumcenter)) {
                                neighIndex = -1;
                            }
                            // If segment not already processed
                            if (neighIndex > idgeom) {
                                LineString lineString = geometryFactory.createLineString(new Coordinate[]{getCircumcenter(idgeom,
                                        triangleCircumcenter), getCircumcenter(neighIndex, triangleCircumcenter)});
                                if(lineString.getLength() > epsilon) {
                                    lineStrings.add(lineString);
                                }
                            } else if(neighIndex == -1 && envelope != null) {
                                LineString lineString = voronoiSide(idgeom, side, geometryFactory,
                                        getCircumcenter(idgeom, triangleCircumcenter));
                                if(lineString != null) {
                                    voronoiBorderLines.add(lineString);
                                }
                            }
                        }
                    }
                } else {
                    throw new TopologyException("Voronoi method accept only polygons");
                }
            }
            // Generate envelope segments
            if(envelope != null) {
                voronoiBorderLines.add(((Polygon)geometryFactory.toGeometry(envelope)).getExteriorRing());
                MultiLineString env = (MultiLineString)geometryFactory.createMultiLineString(voronoiBorderLines.
                        toArray(new LineString[0])).union();
                for (int i = 0; i < env.getNumGeometries(); i++) {
                    lineStrings.add((LineString) env.getGeometryN(i));
                }
            }
            if(outputDimension == 1) {
                return geometryFactory.createMultiLineString(lineStrings.toArray(new LineString[0]));
            } else {
                Polygonizer polygonizer = new Polygonizer();
                MultiLineString voronoiSegs = geometryFactory.createMultiLineString(lineStrings.toArray(new LineString[0]));
                polygonizer.add(voronoiSegs);
                return geometryFactory.createMultiPolygon(GeometryFactory.toPolygonArray(polygonizer.getPolygons()));
            }
        } else {
            Coordinate[] circumcenters = new Coordinate[inputTriangles.getNumGeometries()];
            for (int idgeom = 0; idgeom < triangleCircumcenter.length; idgeom++) {
                Geometry geomItem = inputTriangles.getGeometryN(idgeom);
                if (geomItem instanceof Polygon) {
                    circumcenters[idgeom] = getCircumcenter(idgeom, triangleCircumcenter);
                }
            }
            MultiPoint result = geometryFactory.createMultiPoint(circumcenters);
            if(envelope == null) {
                return result;
            } else {
                return (GeometryCollection)geometryFactory.toGeometry(envelope).intersection(result);
            }
        }
    }
780246
public Map<String,Map> getDependenciesGraph() {
        Map<String,Map> graph = new HashMap<String,Map>();
        
        if ( preorderedNodeList != null ) {

            List<DependencyNode> nodes = preorderedNodeList.getNodes();
            Set<String> notations = new HashSet<String>();
            
            for (Dependency dependency : getDependencies() ) {
                notations.add(Notation.generate(dependency));
            }
            
            for( DependencyNode node: nodes) {
                String notation = Notation.generate( node.getDependency().getArtifact() );
            
                // Show Graph with dependenices as root and transitive as children
                if ( notations.contains( notation ) ) {
                    graph.put( notation, mapDependenciesFromNode( node ) );
                }
            }
        }
        
        return graph;
    }
777360
protected Set<Integer> getNeighbors(int node) {

        Set<Integer> neighbors = new HashSet<Integer>();
        Set<DefaultEdge> edges = undirectedGraph.edgesOf(node);
        for (DefaultEdge edge : edges) {
            if (undirectedGraph.getEdgeSource(edge) != node) {
                neighbors.add(undirectedGraph.getEdgeSource(edge));
            }
            if (undirectedGraph.getEdgeTarget(edge) != node) {
                neighbors.add(undirectedGraph.getEdgeTarget(edge));
            }
        }
        return neighbors;
    }
1259844
public static Geometry drapeMultiLineString(MultiLineString lines, Geometry triangles, STRtree sTRtree) {
        GeometryFactory factory = lines.getFactory();         
        //Split the triangles in lines to perform all intersections
        Geometry triangleLines = LinearComponentExtracter.getGeometry(triangles, true);
        int nbLines = lines.getNumGeometries();
        LineString[] lineStrings = new LineString[nbLines];
        for (int i = 0; i < nbLines; i++) {
            lineStrings[i] = (LineString) lineMerge(lines.getGeometryN(i).difference(triangleLines), factory);
        }
        Geometry diffExt = factory.createMultiLineString(lineStrings);
        CoordinateSequenceFilter drapeFilter = new DrapeFilter(sTRtree);
        diffExt.apply(drapeFilter);
        return diffExt;
    }
108379
public static String toDot(GraphvizGraph graph) {
    StringBuilder builder = new StringBuilder();
    builder.append(graph.isDirected() ? "digraph" : "graph");
    builder.append(INDENT);
    builder.append(graph.getName());
    builder.append(" {\n");
    builder.append(INDENT);
    builder.append("node [color=lightblue2, style=filled];\n");

    final String edgeSymbol = graph.isDirected() ? ARROW : LINE;

    List<GraphvizNode> nodes = graph.getGraphvizNodes();

    String[] nodeNames = new String[nodes.size()];

    for (int i = 0; i < nodeNames.length; i++) {
      GraphvizNode gNode = nodes.get(i);
      nodeNames[i] =
          gNode.getId()
              + " [label=\""
              + gNode.getLabel()
              + "\" color=\""
              + gNode.getColor()
              + "\"]";
    }

    // We sort the nodes so we get a deterministic output every time regardless
    // of the implementation of the graph data structure.
    Arrays.sort(nodeNames);

    for (String nodeName : nodeNames) {
      builder.append(INDENT);
      builder.append(nodeName);
      builder.append(";\n");
    }

    List<GraphvizEdge> edges = graph.getGraphvizEdges();

    String[] edgeNames = new String[edges.size()];

    for (int i = 0; i < edgeNames.length; i++) {
      GraphvizEdge edge = edges.get(i);
      edgeNames[i] = edge.getNode1Id() + edgeSymbol + edge.getNode2Id();
    }

    // Again, we sort the edges as well.
    Arrays.sort(edgeNames);

    for (String edgeName : edgeNames) {
      builder.append(INDENT);
      builder.append(edgeName);
      builder.append(";\n");
    }

    builder.append("}\n");
    return builder.toString();
  }
807306
public static Geometry toDto(org.geomajas.gwt.client.spatial.geometry.Geometry geometry) {
		if (geometry == null) {
			return null;
		}
		int srid = geometry.getSrid();
		int precision = geometry.getPrecision();

		Geometry dto;
		if (geometry instanceof Point) {
			dto = new Geometry(Geometry.POINT, srid, precision);
			dto.setCoordinates(geometry.getCoordinates());
		} else if (geometry instanceof LinearRing) {
			dto = new Geometry(Geometry.LINEAR_RING, srid, precision);
			dto.setCoordinates(geometry.getCoordinates());
		} else if (geometry instanceof LineString) {
			dto = new Geometry(Geometry.LINE_STRING, srid, precision);
			dto.setCoordinates(geometry.getCoordinates());
		} else if (geometry instanceof Polygon) {
			dto = new Geometry(Geometry.POLYGON, srid, precision);
			Polygon polygon = (Polygon) geometry;
			if (!polygon.isEmpty()) {
				Geometry[] geometries = new Geometry[polygon.getNumInteriorRing() + 1];
				for (int i = 0; i < geometries.length; i++) {
					if (i == 0) {
						geometries[i] = toDto(polygon.getExteriorRing());
					} else {
						geometries[i] = toDto(polygon.getInteriorRingN(i - 1));
					}
				}
				dto.setGeometries(geometries);
			}
		} else if (geometry instanceof MultiPoint) {
			dto = new Geometry(Geometry.MULTI_POINT, srid, precision);
			dto.setGeometries(convertGeometries(geometry));
		} else if (geometry instanceof MultiLineString) {
			dto = new Geometry(Geometry.MULTI_LINE_STRING, srid, precision);
			dto.setGeometries(convertGeometries(geometry));
		} else if (geometry instanceof MultiPolygon) {
			dto = new Geometry(Geometry.MULTI_POLYGON, srid, precision);
			dto.setGeometries(convertGeometries(geometry));
		} else {
			String msg = "GeometryConverter.toDto() unrecognized geometry type";
			Log.logServer(Log.LEVEL_ERROR, msg);
			throw new IllegalStateException(msg);
		}

		return dto;
	}
230655
public static LineString createLine(GeometryCollection points) throws SQLException {
        if(points == null) {
            return null;
        }
        final int size = points.getNumGeometries();
        if (!atLeastTwoPoints(points)) {
            throw new SQLException("At least two points are required to make a line.");
        }
        List<Coordinate> coordinateList = new LinkedList<Coordinate>();
        for (int i = 0; i < size; i++) {
            coordinateList.addAll(Arrays.asList(points.getGeometryN(i).getCoordinates()));
        }
        return points.getGeometryN(0).getFactory().createLineString(
                coordinateList.toArray(new Coordinate[size]));
    }
808982
public String originalGeometry() {
    if (originalDirectionRoute() == null || TextUtils.isEmpty(originalDirectionRoute().geometry())) {
      return "";
    }

    List<Point> geometryPositions
      = PolylineUtils.decode(originalDirectionRoute().geometry(), Constants.PRECISION_6);
    return PolylineUtils.encode(geometryPositions, Constants.PRECISION_5);
  }
1167304
public static @Nonnull JsonArray lineStringToPolygon(@Nonnull double[][] lineString) {
        JsonArray jsonJLineString = toJsonJLineString(lineString);
        if (lineString[0][0] != lineString[lineString.length - 1][0] || lineString[0][1] != lineString[lineString.length - 1][1]) {
            // add last coordinate to close the polygon
            jsonJLineString.add(array(lineString[0][0], lineString[0][1]));
        }
        JsonArray result = array();
        result.add(jsonJLineString);
        return result;
    }
527638
@Override
  public Set<EndpointPair<N>> edges() {
    return new AbstractSet<EndpointPair<N>>() {
      @Override
      public UnmodifiableIterator<EndpointPair<N>> iterator() {
        return EndpointPairIterator.of(AbstractGraph.this);
      }

      @Override
      public int size() {
        return Ints.saturatedCast(edgeCount());
      }

      @Override
      public boolean contains(@Nullable Object obj) {
        if (!(obj instanceof EndpointPair)) {
          return false;
        }
        EndpointPair<?> endpointPair = (EndpointPair<?>) obj;
        return isDirected() == endpointPair.isOrdered()
            && nodes().contains(endpointPair.nodeU())
            && successors(endpointPair.nodeU()).contains(endpointPair.nodeV());
      }
    };
  }
741719
public Collection<Line> getPoints()
    {
        final Collection<Line> list = new ArrayList<>(npoints);
        for (int i = 0; i < npoints / 2; i++)
        {
            list.add(new Line(xpoints[i], ypoints[i], xpoints[i + npoints / 2], ypoints[i + npoints / 2]));
        }
        return list;
    }
649984
public List vertexList() {
        List vertices = new ArrayList(edgeSet().size());

        Object startVertex = vertexSet().iterator().next();

        Object vertex = startVertex;
        Object previousVertex = null;
        Object nextVertex = null;

        while (nextVertex != startVertex) {
            assert (degreeOf(vertex) == 2);
            List edges = edgesOf(vertex);

            vertices.add(vertex);

            Edge edge = (Edge) edges.get(0);
            nextVertex = edge.oppositeVertex(vertex);

            if (nextVertex == previousVertex) {
                edge = (Edge) edges.get(1);
                nextVertex = edge.oppositeVertex(vertex);
            }

            previousVertex = vertex;
            vertex = nextVertex;

        }

        return vertices;
    }
677923
public String[][] getEdgeArray()
    {
        String[][] edge = new String[word.length + 1][word.length + 1];
        for (CoNLLWord coNLLWord : word)
        {
            edge[coNLLWord.ID][coNLLWord.HEAD.ID] = coNLLWord.DEPREL;
        }

        return edge;
    }
203938
public List<String> nextParagraphs() {
        return nextParagraphs(Math.min(Math.max(4 + (int) (random.nextGaussian() * 3d), 1), 8));
    }
53831
@Override
    public Collection<N> getNodes() {
        List<N> nodes = new ArrayList<>();
        Iterables.addAll(nodes, GraphTraversal.breadthFirstOrder(this, Collections.singleton(root)));
        return nodes;
    }
846858
Map<String, Map<String, PropertyType>> getAllTables() {
        Map<String, Map<String, PropertyType>> result = new HashMap<>();
        for (Map.Entry<String, VertexLabel> vertexLabelEntry : this.vertexLabels.entrySet()) {
            String vertexQualifiedName = this.name + "." + VERTEX_PREFIX + vertexLabelEntry.getValue().getLabel();
            result.put(vertexQualifiedName, vertexLabelEntry.getValue().getPropertyTypeMap());
        }
        if (this.topology.isSqlWriteLockHeldByCurrentThread()) {
            for (Map.Entry<String, VertexLabel> vertexLabelEntry : this.uncommittedVertexLabels.entrySet()) {
                String vertexQualifiedName = vertexLabelEntry.getKey();
                VertexLabel vertexLabel = vertexLabelEntry.getValue();
                result.put(vertexQualifiedName, vertexLabel.getPropertyTypeMap());
            }
        }
        for (EdgeLabel edgeLabel : this.getEdgeLabels().values()) {
            String edgeQualifiedName = this.name + "." + EDGE_PREFIX + edgeLabel.getLabel();
            result.put(edgeQualifiedName, edgeLabel.getPropertyTypeMap());
        }
        return result;
    }
136252
public Polygon getHull() {
    if(hull == null) {
      run(true);
    }
    DoubleMinMax minmaxX = new DoubleMinMax();
    DoubleMinMax minmaxY = new DoubleMinMax();
    List<double[]> hullp = new ArrayList<>(hull.size());
    for(IntIntPair pair : hull) {
      double[] v = points.get(pair.first);
      hullp.add(v);
      minmaxX.put(v[0]);
      minmaxY.put(v[1]);
    }
    return new Polygon(hullp, minmaxX.getMin(), minmaxX.getMax(), minmaxY.getMin(), minmaxY.getMax());
  }