Package edu.uci.ics.jung.io

Examples of edu.uci.ics.jung.io.GraphMLFile


  /**
   * Save the current converter graph to the user's home directory

   */
  private void saveGraph() {
    GraphMLFile writer = new GraphMLFile();
    Graph g = (Graph) graph.copy();
    for (Iterator edges = g.getEdges().iterator(); edges.hasNext();) {
      Edge e = (Edge) edges.next();
      e.removeUserDatum(SERVICE_LIST);
    }

    writer.save(g, System.getProperty("user.home")
        + File.separator
        + "convertGraph.xml");
  }
View Full Code Here


  public static void main(String[] args){
    File graphDir = new File(args[0]);//new File(System.getProperty("user.dir")+System.getProperty("file.separator")+"resources"+
    //System.getProperty("file.separator")+"TestGraphs"+System.getProperty("file.separator") +args[0]);
    String wholePath = graphDir.getAbsolutePath()+System.getProperty("file.separator");
    GraphMLFile graphmlFile = new GraphMLFile();
    graphmlFile.setGraphMLFileHandler(new ExperimentGraphMLHandler());
    DirectedSparseGraph dg = new DirectedSparseGraph();
    dg.getEdgeConstraints().clear();
    dg = (DirectedSparseGraph)graphmlFile.load(wholePath+args[1]);
    GraphMLVisualiser gmlVis = new GraphMLVisualiser();
    gmlVis.construct(dg);
  }
View Full Code Here

    Configuration config = Configuration.getDefaultConfiguration();
    //config.setConsistencyCheckMode(true);
    //config.setQuestionGenerator(QuestionGeneratorKind.SYMMETRIC);
    synchronized (LearnerGraph.syncObj)
    {// ensure that the calls to Jung's vertex-creation routines do not occur on different threads.
        GraphMLFile graphmlFile = new GraphMLFile();
        graphmlFile.setGraphMLFileHandler(new ExperimentGraphMLHandler());
        graph = new LearnerGraph(graphmlFile.load(
            //"resources/pcodaExperiments/5StatesCrowded/5Inputs_15_13.xml"
            "resources/pcodaExperiments/25StatesCrowded/25Inputs_75_12.xml"
            ),config);
    }
   
View Full Code Here

    LearnerGraph graph = null;
    int ThreadNumber=AbstractExperiment.getCpuNumber();
    long tmStarted = new Date().getTime(),tmFinished = 0;;
    synchronized (LearnerGraph.syncObj)
    {// ensure that the calls to Jung's vertex-creation routines do not occur on different threads.
        GraphMLFile graphmlFile = new GraphMLFile();
        graphmlFile.setGraphMLFileHandler(new ExperimentGraphMLHandler());
        graph = new LearnerGraph(graphmlFile.load(
            //"../../W_experiment/experiment_4300.xml"
            //"../W_experiment/3000/N_3000_1.xml"
            "resources/LargeGraphs/experiment_1000.xml"
            ),config);
    }
View Full Code Here

      LearnerGraph learned = null;
      Collection<List<String>> minusTrainingSet = null, testSet = null;
      try {
        synchronized (LearnerGraph.syncObj)
        {// ensure that the calls to Jung's vertex-creation routines do not occur on different threads.
            GraphMLFile graphmlFile = new GraphMLFile();
            graphmlFile.setGraphMLFileHandler(new ExperimentGraphMLHandler());
            final String mostOfFileName = "_"+(new File(inputFileName).getName());
            assert new File(origDir).isDirectory();
            for(String name:new File(origDir).list(new FilenameFilter(){
            public boolean accept(@SuppressWarnings("unused") File dir, String fileName) {
              return fileName.contains(mostOfFileName);
View Full Code Here

    public static FSMStructure loadGraph(Reader from, Configuration cnf) throws IOException
    {
      FSMStructure graph = null;
      synchronized (computeStateScores.syncObj)
      {// ensure that the calls to Jung's vertex-creation routines do not occur on different threads.
          GraphMLFile graphmlFile = new GraphMLFile();
          graphmlFile.setGraphMLFileHandler(new statechum.analysis.learning.experiments.ExperimentGraphMLHandler());
          graph = new FSMStructure(graphmlFile.load(from),cnf);
        from.close();
      }
      return graph;
    }
View Full Code Here

    */
    public static FSMStructure loadGraph(String fileName,Configuration config)
    {
      synchronized (computeStateScores.syncObj)
      {// ensure that the calls to Jung's vertex-creation routines do not occur on different threads.
          GraphMLFile graphmlFile = new GraphMLFile();
          graphmlFile.setGraphMLFileHandler(new statechum.analysis.learning.experiments.ExperimentGraphMLHandler());
          String fileToLoad = fileName;
          if (!new java.io.File(fileToLoad).canRead()) fileToLoad+=".xml";
          FSMStructure graph = new FSMStructure(graphmlFile.load(fileToLoad),config);
          return graph;
      }
    }
View Full Code Here

  {
    LearnerGraph gr = new LearnerGraph(TestFSMAlgo.buildGraph(TestRpniLearner.largeGraph1_invalid5, "testMerge_fail1"),Configuration.getDefaultConfiguration());
    StringWriter writer = new StringWriter();gr.transform322.writeGraphML(writer);
    synchronized (LearnerGraph.syncObj)
    {// ensure that the calls to Jung's vertex-creation routines do not occur on different threads.
        GraphMLFile graphmlFile = new GraphMLFile();
        graphmlFile.setGraphMLFileHandler(new ExperimentGraphMLHandler());
        try
        {
          new LearnerGraph(graphmlFile.load(new StringReader(writer.toString().replace("ACCEPTED=\"false\"", "ACCEPTED=\"aa\""))),Configuration.getDefaultConfiguration());
        }
        catch(FatalException ex)
        {
          Assert.assertTrue(ex.getCause() instanceof IllegalUserDataException);
        }
View Full Code Here

  {
    LearnerGraph gr = new LearnerGraph(TestFSMAlgo.buildGraph(TestRpniLearner.largeGraph1_invalid5, "testMerge_fail1"),Configuration.getDefaultConfiguration());
    StringWriter writer = new StringWriter();gr.transform322.writeGraphML(writer);
    synchronized (LearnerGraph.syncObj)
    {// ensure that the calls to Jung's vertex-creation routines do not occur on different threads.
        GraphMLFile graphmlFile = new GraphMLFile();
        graphmlFile.setGraphMLFileHandler(new ExperimentGraphMLHandler());
       
        try
        {
          new LearnerGraph(graphmlFile.load(new StringReader(writer.toString().replace("COLOUR=\"red\"", "COLOUR=\"aa\""))),Configuration.getDefaultConfiguration());
        }
        catch(FatalException ex)
        {
          Assert.assertTrue(ex.getCause() instanceof IllegalUserDataException);
        }
View Full Code Here

  {
    LearnerGraph gr = new LearnerGraph(TestFSMAlgo.buildGraph(TestRpniLearner.largeGraph1_invalid5, "testMerge_fail1"),Configuration.getDefaultConfiguration());
    StringWriter writer = new StringWriter();gr.transform322.writeGraphML(writer);
    synchronized (LearnerGraph.syncObj)
    {// ensure that the calls to Jung's vertex-creation routines do not occur on different threads.
        GraphMLFile graphmlFile = new GraphMLFile();
        graphmlFile.setGraphMLFileHandler(new ExperimentGraphMLHandler());
        Graph brokenGraph=graphmlFile.load(new StringReader(writer.toString().replace("VERTEX=\"BB1\"", "VERTEX=\""+Transform322.Initial+" BB1\"")));
        try
        {
          new LearnerGraph(brokenGraph,Configuration.getDefaultConfiguration());
        }
        catch(IllegalArgumentException ex)
View Full Code Here

TOP

Related Classes of edu.uci.ics.jung.io.GraphMLFile

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.