Exemple #1
0
    protected void openFile() {

      int returnVal = fc.showOpenDialog(this);

      if (returnVal == JFileChooser.APPROVE_OPTION) {
        File file = fc.getSelectedFile();
        try {
          //			        	   graph.clear();
          GraphReader r = new InteractiveGraphReader(new FileInputStream(file));
          r.read(graph);
        } catch (FileNotFoundException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
      }
      layouter.makeLayout();
      if (hasOption(VIEW_3D) || hasOption(VIEW_WF)) {
        layouterWF3D.makeLayout();
        canvasWF.repaint();
      }
      canvas.repaint();

      //			        canvasAnim.addContentBranchGroupToNewUniverse(layouterWF3D.createSceneGraph());
    }
  @Test
  public void testWeightThreshold() throws IOException {
    Graph<Integer, Float> testGraph = new ArrayBackedGraph<Float>(3, 2);
    StringIndexGraphWrapper<Float> testGraphIndexed = new StringIndexGraphWrapper<Float>(testGraph);
    testGraphIndexed.addNode("a");
    testGraphIndexed.addNode("b");
    testGraphIndexed.addNode("c");
    testGraphIndexed.addEdge("a", "c", 1.7f);
    testGraphIndexed.addEdge("b", "c", 2.5f);

    File in = new File("src/test/resources/graph/test.txt");
    String input = FileUtils.readFileToString(in, "UTF-8");
    StringIndexGraphWrapper<Float> graphWrapper =
        GraphReader.readABCIndexed(new StringReader(input), true, 2, 1.7f);
    assertEquals(graphWrapper, testGraphIndexed);
  }