public void updateGraph(
      List<ClusterRectangle> clusterRectangles, List<Period> indoorPeriods, String android_id) {
    // Graph Update
    // Make Graph
    Configuration conf = new BaseConfiguration();
    conf.setProperty("storage.backend", "cassandra");
    conf.setProperty("storage.hostname", "127.0.0.1");
    TitanGraph g = TitanFactory.open(conf);

    // Get Smartphone Vertex
    Vertex v = TitanHelper.getVertex(g, "android_id", android_id);
    if (v == null) {
      v = g.addVertex(null);
      v.setProperty("android_id", android_id);
      v.setProperty("ltype", "Object");
    }

    // Process Outdoor Cluster
    for (int i = 0; i < clusterRectangles.size(); i++) {
      ClusterRectangle clusterRectangle = clusterRectangles.get(i);
      double minLon = clusterRectangle.getMinLon();
      double minLat = clusterRectangle.getMinLat();
      double maxLon = clusterRectangle.getMaxLon();
      double maxLat = clusterRectangle.getMaxLat();

      for (int j = 0; j < clusterRectangle.getPeriods().size(); j++) {
        Vertex place = g.addVertex(null);
        place.setProperty("ltype", "Place.outdoor");
        place.setProperty("minLon", minLon);
        place.setProperty("minLat", minLat);
        place.setProperty("maxLon", maxLon);
        place.setProperty("maxLat", maxLat);

        Period period = clusterRectangle.getPeriods().get(j);
        long from = period.getFrom() * 1000;
        long to = period.getTo() * 1000;
        Edge isLocatedIn = g.addEdge(null, v, place, "isLocatedIn");
        Edge isContaining = g.addEdge(null, place, v, "isContaining");
        isLocatedIn.setProperty("from", from);
        isLocatedIn.setProperty("to", to);
        isContaining.setProperty("from", from);
        isContaining.setProperty("to", to);
      }
    }

    // Process Indoor Points
    for (int i = 0; i < indoorPeriods.size(); i++) {
      Period indoor = indoorPeriods.get(i);
      Vertex place = g.addVertex(null);
      place.setProperty("ltype", "Place.indoor");
      place.setProperty("longitude", indoor.getLongitude());
      place.setProperty("latitude", indoor.getLatitude());
      place.setProperty("from", indoor.getFrom());
      place.setProperty("to", indoor.getTo());
    }

    g.commit();
    g.shutdown();
  }
  /**
   * @param string
   * @param indoorPeriods
   */
  private void makeRIndoorPoint(String path, List<Period> indoorPeriods) {

    String outStr = "lon\tlat\n";

    for (int i = 0; i < indoorPeriods.size(); i++) {
      Period period = indoorPeriods.get(i);
      double longitude = period.getLongitude();
      double latitude = period.getLatitude();
      outStr += "\t" + longitude + "\t" + latitude + "\n";
    }
    try {
      BufferedWriter writer = new BufferedWriter(new FileWriter(path));
      writer.write(outStr);
      writer.close();
    } catch (Exception ex) {

    }
  }