Пример #1
0
  public void testLaplacian() {
    UndirectedGraph<String, DefaultEdge> g =
        new SimpleGraph<String, DefaultEdge>(DefaultEdge.class);
    g.addVertex(V1);
    g.addVertex(V2);
    g.addEdge(V1, V2);
    g.addVertex(V3);
    g.addEdge(V3, V1);

    StringWriter w = new StringWriter();
    exporter.exportLaplacianMatrix(w, g);
    assertEquals(LAPLACIAN, w.toString());

    w = new StringWriter();
    exporter.exportNormalizedLaplacianMatrix(w, g);
    assertEquals(NORMALIZED_LAPLACIAN, w.toString());
  }
Пример #2
0
  public void testAdjacencyDirected() {
    DirectedGraph<String, DefaultEdge> g =
        new DirectedMultigraph<String, DefaultEdge>(DefaultEdge.class);
    g.addVertex(V1);
    g.addVertex(V2);
    g.addEdge(V1, V2);
    g.addVertex(V3);
    g.addEdge(V3, V1);
    g.addEdge(V3, V1);

    Writer w = new StringWriter();
    exporter.exportAdjacencyMatrix(w, g);
    assertEquals(DIRECTED_ADJACENCY, w.toString());
  }