Package org.graphstream.graph.implementations

Examples of org.graphstream.graph.implementations.MultiGraph


    assertNotNull(A.getAttribute("array"));
  }

  @Test
  public void testElementUtilityMethods() {
    Graph graph = new MultiGraph("g1");

    Node A = graph.addNode("A");

    assertEquals("A", A.getId());
    assertEquals(0, A.getAttributeCount());

    // First attribute of.
View Full Code Here


    assertEquals(1, n);
  }

  @Test
  public void testElementIterables() {
    Graph graph = new MultiGraph("g1");

    Node A = graph.addNode("A");

    assertEquals("A", A.getId());
    assertEquals(0, A.getAttributeCount());

    // First attribute of.
View Full Code Here

    assertTrue(keys.contains("C"));
  }

  @Test
  public void testNullAttributes() {
    Graph graph = new MultiGraph("g1");

    graph.addAttribute("foo");
    graph.addAttribute("bar", (Object) null); // Yes an attribute with a
                          // null value, You can !

    assertTrue(graph.hasAttribute("foo"));
    assertTrue(graph.hasAttribute("bar"));

    graph.removeAttribute("foo");
    graph.removeAttribute("bar");

    assertFalse(graph.hasAttribute("foo"));
    assertFalse(graph.hasAttribute("bar"));
  }
View Full Code Here

    //
    // /-------> g2
    // | |
    // g1 <-------/

    testGraphSyncBase(new MultiGraph("g1"), new MultiGraph("g2"));
    testGraphSyncBase(new SingleGraph("g1"), new SingleGraph("g2"));
    testGraphSyncBase(new AdjacencyListGraph("g1"), new AdjacencyListGraph(
        "g2"));
    testGraphSyncBase(new MultiGraph("g1"), new AdjacencyListGraph("g2"));
   
  }
View Full Code Here

    // | |
    // /--------> g2 |
    // | |
    // g1 <--------------------/

    testGraphSyncCycleSimple(new MultiGraph("g1"), new MultiGraph("g2"),
        new MultiGraph("g3"));
    testGraphSyncCycleSimple(new SingleGraph("g1"), new SingleGraph("g2"),
        new SingleGraph("g3"));
    testGraphSyncCycleSimple(new AdjacencyListGraph("g1"),
        new AdjacencyListGraph("g2"), new AdjacencyListGraph("g3"));
    testGraphSyncCycleSimple(new MultiGraph("g1"), new SingleGraph("g2"),
        new AdjacencyListGraph("g3"));
  }
View Full Code Here

    // | |
    // /--------> g2 <---------+
    // | |
    // g1 <--------------------/

    testGraphSyncCycleProblem(new MultiGraph("g1"), new MultiGraph("g2"),
        new MultiGraph("g3"));
    testGraphSyncCycleProblem(new SingleGraph("g1"), new SingleGraph("g2"),
        new SingleGraph("g3"));
    testGraphSyncCycleProblem(new AdjacencyListGraph("g1"),
        new AdjacencyListGraph("g2"), new AdjacencyListGraph("g3"));
    testGraphSyncCycleProblem(new MultiGraph("g1"), new SingleGraph("g2"),
        new AdjacencyListGraph("g3"));
  }
View Full Code Here

*
*/
public class ExampleSender {

  public static void main(String[] args) {
    Graph g = new MultiGraph("G");
    // - the sender
    NetStreamSender nsc = null;
    try {
      nsc = new NetStreamSender(2001);
    } catch (UnknownHostException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
   
    nsc.setPacker(new Base64Packer());
   
    // - plug the graph to the sender so that graph events can be
    // sent automatically
    g.addSink(nsc);
    // - generate some events on the client side
    String style = "node{fill-mode:plain;fill-color:#567;size:6px;}";
    g.addAttribute("stylesheet", style);
    g.addAttribute("ui.antialias", true);
    g.addAttribute("layout.stabilization-limit", 0);
    for (int i = 0; i < 500; i++) {
      g.addNode(i + "");
      if (i > 0) {
        g.addEdge(i + "-" + (i - 1), i + "", (i - 1) + "");
        g.addEdge(i + "--" + (i / 2), i + "", (i / 2) + "");
      }
    }
  }
View Full Code Here

  public static void main(String[] args) throws UnknownHostException, IOException, InterruptedException {
    // ----- On the receiver side -----
    //
    // - a graph that will display the received events
    Graph g = new MultiGraph("G",false,true);
    g.display();
    // - the receiver that waits for events
    NetStreamReceiver net = new NetStreamReceiver("localhost",2001,false);
   
    net.setUnpacker(new  Base64Unpacker());
   
View Full Code Here

  }

  public void test(TestEntry entry) throws IOException {
    System.out.printf("> \"%s\"\n", entry.ressourceName);
   
    Graph graph = new MultiGraph("foo");
    FileSourcePajek in = new FileSourcePajek();

    graph.addAttribute("ui.quality");
    if (!entry.veryLarge)
      graph.addAttribute("ui.antialias");
    if (entry.addLabels)
      graph.addAttribute(
          "ui.stylesheet",
          String.format(
              "node { text-alignment: center; size: %dpx; fill-color: grey; %s } edge { fill-color: #333; }",
              entry.veryLarge ? 6 : 16, entry.veryLarge ? ""
                  : "stroke-mode: plain; stroke-color: #333;"));
    else
      graph.addAttribute(
          "ui.stylesheet",
          String.format(
              "node { text-alignment: at-right; size: %dpx; fill-color: grey; %s text-background-mode: plain; text-offset: 2px, 0px; text-padding: 2px; text-background-color: #FFFFFFAA; } edge { fill-color: #333; }",
              entry.veryLarge ? 6 : 16, entry.veryLarge ? ""
                  : "stroke-mode: plain; stroke-color: #333;"));
   
    Viewer v = graph.display(entry.autoLayout);
    v.setCloseFramePolicy(CloseFramePolicy.CLOSE_VIEWER);
   
    in.addSink(graph);
    in.readAll(TestPajekParser.class
        .getResourceAsStream(entry.ressourceName));
View Full Code Here

  // Test

  @Before
  public void setup2() {
    outGraph = new MultiGraph("out");
    inGraph = new MultiGraph("in");
  }
View Full Code Here

TOP

Related Classes of org.graphstream.graph.implementations.MultiGraph

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.