Examples of AdjacencyListGraph


Examples of org.graphstream.graph.implementations.AdjacencyListGraph

    return buffer.toString();
  }

  public static void main(String... args) {
    GraphSpells graphSpells = new GraphSpells();
    Graph g = new AdjacencyListGraph("g");

    g.addSink(graphSpells);

    g.addNode("A");
    g.addNode("B");
    g.addNode("C");
    g.stepBegins(1);
    g.getNode("A").setAttribute("test1", 100);
    g.addEdge("AB", "A", "B");
    g.addEdge("AC", "A", "C");
    g.stepBegins(2);
    g.addEdge("CB", "C", "B");
    g.removeNode("A");
    g.stepBegins(3);
    g.addNode("A");
    g.addEdge("AB", "A", "B");
    g.stepBegins(4);
    g.removeNode("C");
    g.stepBegins(5);

    System.out.println(graphSpells);
  }
View Full Code Here

Examples of org.graphstream.graph.implementations.AdjacencyListGraph

  /**
   *
   * @param source
   */
  public void begin(Source source) {
    initialGraph = new AdjacencyListGraph("initial");
    currentGraph = new AdjacencyListGraph("initial");
    begin();
  }
View Full Code Here

Examples of org.graphstream.graph.implementations.AdjacencyListGraph

  public void clearSinks() {
    pipe.clearSinks();
  }

  public static void main(String... strings) throws Exception {
    Graph g = new AdjacencyListGraph("g");
    Timeline timeline = new Timeline();
    timeline.addSink(new VerboseSink());

    timeline.begin(g);

    g.stepBegins(0.0);
    g.addNode("A");
    g.addNode("B");
    g.stepBegins(1.0);
    g.addNode("C");

    timeline.end();

    System.out.printf("############\n");
    System.out.printf("# Play :\n");
View Full Code Here

Examples of org.graphstream.graph.implementations.AdjacencyListGraph

      events.add(e);
    }
  }

  public static void main(String... args) throws Exception {
    Graph g1 = new AdjacencyListGraph("g1");
    Graph g2 = new AdjacencyListGraph("g2");

    Node a1 = g1.addNode("A");
    a1.addAttribute("attr1", "test");
    a1.addAttribute("attr2", 10.0);
    a1.addAttribute("attr3", 12);

    Node a2 = g2.addNode("A");
    a2.addAttribute("attr1", "test1");
    a2.addAttribute("attr2", 10.0);
    g2.addNode("B");
    g2.addNode("C");

    GraphDiff diff = new GraphDiff(g2, g1);
    System.out.println(diff);
  }
View Full Code Here

Examples of org.graphstream.graph.implementations.AdjacencyListGraph

public class TestGraph {
  @Test
  public void testBasic() {
    testBasic(new SingleGraph("sg"));
    testBasic(new MultiGraph("mg"));
    testBasic(new AdjacencyListGraph("alg"));
    testBasic(new AdjacencyListGraph("AL")); // XXX
    testBasic(new SingleGraph("S")); // XXX
    testBasic(new MultiGraph("M")); // XXX
  }
View Full Code Here

Examples of org.graphstream.graph.implementations.AdjacencyListGraph

    testBasic(new MultiGraph("M")); // XXX
  }

  @Test
  public void testReplay() {
    AbstractGraph g1 = new AdjacencyListGraph("g1");
    Graph g2 = new AdjacencyListGraph("g2");

    Node A1 = g1.addNode("A");
    Node B1 = g1.addNode("B");
    Node C1 = g1.addNode("C");

    Edge AB1 = g1.addEdge("AB", "A", "B");
    Edge BC1 = g1.addEdge("BC", "B", "C");
    Edge CA1 = g1.addEdge("CA", "C", "A");

    A1.addAttribute("string", "an example");
    B1.addAttribute("double", 42.0);
    C1.addAttribute("array", new int[] { 1, 2, 3 });

    AB1.addAttribute("string", "an example");
    BC1.addAttribute("double", 42.0);
    CA1.addAttribute("array", new int[] { 1, 2, 3 });

    Replayable.Controller controller = g1.getReplayController();
    controller.addSink(g2);
    controller.replay();

    Node A2 = g2.getNode("A");
    Node B2 = g2.getNode("B");
    Node C2 = g2.getNode("C");

    assertNotNull(A2);
    assertNotNull(B2);
    assertNotNull(C2);

    checkAttribute(A1, A2);
    checkAttribute(B1, B2);
    checkAttribute(C1, C2);

    Edge AB2 = g2.getEdge("AB");
    Edge BC2 = g2.getEdge("BC");
    Edge CA2 = g2.getEdge("CA");

    assertNotNull(AB2);
    assertNotNull(BC2);
    assertNotNull(CA2);
View Full Code Here

Examples of org.graphstream.graph.implementations.AdjacencyListGraph

  @Test
  public void testDirected() {
    testDirected(new SingleGraph("sg"));
    testDirected(new MultiGraph("mg"));
    // testDirected( new AdjacencyListGraph( "alg" ) );
    testDirected(new AdjacencyListGraph("AL")); // XXX
    testDirected(new SingleGraph("S")); // XXX
    testDirected(new MultiGraph("M")); // XXX
  }
View Full Code Here

Examples of org.graphstream.graph.implementations.AdjacencyListGraph

  @Test
  public void testIterables() {
    testIterables(new SingleGraph("sg"));
    testIterables(new MultiGraph("mg"));
    // testIterables( new AdjacencyListGraph( "alg" ) );
    testIterables(new AdjacencyListGraph("AL")); // XXX
    testIterables(new SingleGraph("S")); // XXX
    testIterables(new MultiGraph("M")); // XXX
  }
View Full Code Here

Examples of org.graphstream.graph.implementations.AdjacencyListGraph

  @Test
  public void testRemoval() {
    testRemoval(new SingleGraph("sg"));
    testRemoval(new MultiGraph("mg"));
    // testRemoval( new AdjacencyListGraph( "alg" ) );
    testRemoval(new AdjacencyListGraph("AL")); // XXX
    testRemoval(new SingleGraph("S")); // XXX
    testRemoval(new MultiGraph("M")); // XXX
  }
View Full Code Here

Examples of org.graphstream.graph.implementations.AdjacencyListGraph

  @Test
  public void testGraphListener() {
    testGraphListener(new SingleGraph("sg"));
    testGraphListener(new MultiGraph("mg"));
    // testGraphListener( new AdjacencyListGraph( "alg" ) );
    testGraphListener(new AdjacencyListGraph("AL")); // XXX
    testGraphListener(new SingleGraph("S")); // XXX
    testGraphListener(new MultiGraph("M")); // XXX
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.