Package upenn.junto.util

Examples of upenn.junto.util.RyanAlphabet


  private RyanAlphabet la;
  public CountMinSketch cms;
  private int[] dummyLabel;
 
  public CountMinSketchLabelManager(int depth, int width) {
    la = new RyanAlphabet(String.class);
    la.allowGrowth();
   
    // add dummy label
    la.lookupIndex(Constants.GetDummyLabel(), true);
   
View Full Code Here


      BufferedWriter graphWriter =
        new BufferedWriter(new FileWriter(graphOutputFile));
      BufferedWriter seedWriter =
        new BufferedWriter(new FileWriter(graphOutputFile + ".seed_vertices"));

      RyanAlphabet alpha = new RyanAlphabet();
      // we would like to avoid 0 as the index
      alpha.lookupIndex("", true);
     
      Iterator<String> vIter = _vertices.keySet().iterator();     
      while (vIter.hasNext()) {
        String vName = vIter.next();
        int vIdx = alpha.lookupIndex(vName, true);
       
        // seed node writer
        if (_vertices.get(vName).IsSeedNode()) {
          seedWriter.write(vIdx + "\t" + vIdx + "\t" + 1.0 + "\n");
        }

        Vertex2 v = _vertices.get(vName);
        Object[] neighNames = v.GetNeighborNames();
        int totalNeighbors = neighNames.length;
        for (int ni = 0; ni < totalNeighbors; ++ni) {
          int nIdx = alpha.lookupIndex(neighNames[ni], true);
         
          // edge writer
          graphWriter.write(vIdx + "\t" +
                            nIdx + "\t" +
                            v.GetNeighborWeight((String) neighNames[ni]) +
                            "\n");
        }       
      }
      graphWriter.close();
      seedWriter.close();
     
      // write out the alphabet file
      alpha.dump(graphOutputFile + ".alpha");
     
    } catch (IOException ioe) {
      ioe.printStackTrace();
    }
  }
View Full Code Here

TOP

Related Classes of upenn.junto.util.RyanAlphabet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.