private List createSubgraphs(PlanarGraph graph) {
   List subgraphList = new ArrayList();
   for (Iterator i = graph.getNodes().iterator(); i.hasNext(); ) {
     Node node = (Node) i.next();
     if (!node.isVisited()) {
       BufferSubgraph subgraph = new BufferSubgraph();
       subgraph.create(node);
       subgraphList.add(subgraph);
     }
   }
   /**
    * Sort the subgraphs in descending order of their rightmost coordinate. This ensures that when
    * the Polygons for the subgraphs are built, subgraphs for shells will have been built before
    * the subgraphs for any holes they contain.
    */
   Collections.sort(subgraphList, Collections.reverseOrder());
   return subgraphList;
 }
 /**
  * Because Delete Events have a link to their corresponding Insert event, it is possible to
  * compute exactly the range of events which must be compared to a given Insert event object.
  */
 private void prepareEvents() {
   Collections.sort(events);
   for (int i = 0; i < events.size(); i++) {
     SweepLineEvent ev = (SweepLineEvent) events.get(i);
     if (ev.isDelete()) {
       ev.getInsertEvent().setDeleteEventIndex(i);
     }
   }
 }