Package org.graphstream.graph.implementations

Examples of org.graphstream.graph.implementations.SingleGraph


*/
public class ExampleJSONSender {

    public static void main(String args[]) {

  Graph graph = new SingleGraph("Tutorial 1");

  Viewer viewer = graph.display();

  JSONSender sender = new JSONSender("localhost", 8080, "workspace0");
  sender.setDebug(true);
  graph.addSink(sender);

  graph.addNode("A");
  graph.addNode("B");
  graph.addNode("C");
  sleep();
  graph.addEdge("AB", "A", "B");
  graph.addEdge("BC", "B", "C");
  graph.addEdge("CA", "C", "A");
  sleep();

  // graph.clear();
    }
View Full Code Here


import org.junit.Test;

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

    assertEquals(A, AA.getTargetNode());   
  }

  @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

    assertEquals(4, A.getDegree());
  }

  @Test
  public void testSingle() {
    SingleGraph graph = new SingleGraph("g");
    Node A = graph.addNode("A");
    Node B = graph.addNode("B");

    graph.addEdge("AB1", "A", "B");

    try {
      graph.addEdge("AB2", "A", "B");
      fail();
    } catch (Exception e) {
      // Ok !
    }
View Full Code Here

    assertEquals(1, B.getDegree());
  }

  @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

    edges.clear();
  }

  @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

    assertEquals(0, graph.getEdgeCount());
  }

  @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

    // /-------> 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

    // | |
    // 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

    // | |
    // 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

TOP

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

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.