Package edu.uci.ics.jung.io

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


  public static void main(String[] args){
    System.out.println("started.");
    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]);
      int size = dg.getEdges().size()*4;
    RandomPathGenerator rpg = new RandomPathGenerator(dg, new Random(1),size, 5);
    Collection<List<String>> fullSet = rpg.getAllPaths();
    final FSMStructure expected = getGraphData(dg);
   
View Full Code Here


  public static LearnerGraph loadGraph(Reader from, Configuration cnf) throws IOException
  {
    LearnerGraph graph = null;
    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(from),cnf);
      from.close();
    }
    return graph;
  }
View Full Code Here

  */
  public static LearnerGraph loadGraph(String fileName,Configuration config)
  {
    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());
        LearnerGraph graph = new LearnerGraph(graphmlFile.load(fileName+".xml"),config);
        int acceptNumber = graph.getAcceptStateNumber();
        int rejectNumber = graph.getStateNumber()-acceptNumber;
        graph.vertPositiveID=acceptNumber;
        graph.vertNegativeID=1+rejectNumber;
        return graph;
View Full Code Here

      LearnerGraph learnt = 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

   
    protected void loadGraph()
    {
      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());
          Configuration cnf = (Configuration)config.clone();cnf.setLearnerCloneGraph(true);cnf.setLearnerUseStrings(true);
          graph = new LearnerGraph(graphmlFile.load(inputFileName),cnf);
      }
    }
View Full Code Here

  {
    FSMStructure gr = new FSMStructure(TestFSMAlgo.buildGraph(TestRpniLearner.largeGraph1_invalid5, "testMerge_fail1"),Configuration.getDefaultConfiguration());
    StringWriter writer = new StringWriter();gr.transform322.writeGraphML(writer);
    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 ExperimentGraphMLHandler());
        Graph brokenGraph=graphmlFile.load(new StringReader(writer.toString().replace("VERTEX=\"BB1\"", "VERTEX=\""+Transform322.Initial+" BB1\"")));
        try
        {
          new FSMStructure(brokenGraph,Configuration.getDefaultConfiguration());
        }
        catch(IllegalArgumentException ex)
View Full Code Here

    if (graphs.getLength() > 1)
      throw new IllegalArgumentException("duplicate graph element");
    Element graphElement = (Element)graphs.item(0);

    DOMExperimentGraphMLHandler graphHandler = new DOMExperimentGraphMLHandler();
      GraphMLFile graphmlFile = new GraphMLFile();
      graphmlFile.setGraphMLFileHandler(graphHandler);
      synchronized(LearnerGraph.syncObj)
      {// multi-core execution understandably fails if I forget to sync on that object
        try
        {
          graphHandler.startElement(graphElement.getNamespaceURI(), graphElement.getLocalName(), graphElement.getNodeName(), Attributes_DOM_to_SAX(graphElement.getAttributes())); // so as to applease the lack of any clue Jung has about graphml namespaces
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

  public static DirectedSparseGraph loadGraph(String fileName)
  {
    DirectedSparseGraph 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 ExperimentGraphMLHandler());
        graph = new DirectedSparseGraph();
        graph.getEdgeConstraints().clear();
        graph = (DirectedSparseGraph)graphmlFile.load(fileName);
    }
    return graph;
  }
View Full Code Here

    if (graphs.getLength() > 1)
      throw new IllegalArgumentException("duplicate graph element");
    Element graphElement = (Element)graphs.item(0);

    DOMExperimentGraphMLHandler graphHandler = new DOMExperimentGraphMLHandler();
      GraphMLFile graphmlFile = new GraphMLFile();
      graphmlFile.setGraphMLFileHandler(graphHandler);
      synchronized(computeStateScores.syncObj)
      {// multi-core execution understandably fails if I forget to sync on that object
        try
        {
          graphHandler.startElement(graphElement.getNamespaceURI(), graphElement.getLocalName(), graphElement.getNodeName(), Attributes_DOM_to_SAX(graphElement.getAttributes())); // so as to applease the lack of any clue Jung has about graphml namespaces
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.