Package bgu.bio.adt.graphs

Examples of bgu.bio.adt.graphs.FlexibleGraph


public class TestFlexibleGraphs {

  @Test
  public void testDirected1() {
    FlexibleGraph graph = new FlexibleGraph();
    graph.addNode();
    graph.addNode();
    graph.addNode();
    graph.addNode();
    graph.addNode();
    graph.addNode();
    graph.addNode();
    graph.addEdge(0, 1);
    graph.addEdge(0, 4);
    graph.addEdge(0, 3);
    graph.addEdge(3, 2);
    graph.addEdge(5, 3);
    Assert.assertEquals("wrong number of leaves", 4,
        graph.getNumberOfLeaves());
    Assert.assertEquals("wrong maximal out degree", 3, graph.getMaxOutDeg());
    Assert.assertEquals("wrong number of edges", 5, graph.getEdgeNum());
  }
View Full Code Here


    Assert.assertEquals("wrong number of edges", 5, graph.getEdgeNum());
  }

  @Test
  public void testDirected2() {
    FlexibleGraph graph = new FlexibleGraph();
    graph.addNode();
    graph.addNode();
    graph.addNode();
    graph.addNode();
    graph.addNode();
    graph.addNode();
    graph.addNode();
    graph.addEdge(6, 3);
    graph.addEdge(0, 1);
    graph.addEdge(0, 4);
    graph.addEdge(0, 3);
    graph.addEdge(3, 2);
    graph.addEdge(5, 3);
    Assert.assertEquals("wrong number of incoming edges", 3, graph.inDeg(3));
    graph.removeEdge(6, 3);
    Assert.assertEquals("wrong number of leaves", 4,
        graph.getNumberOfLeaves());
    Assert.assertEquals("wrong maximal out degree", 3, graph.getMaxOutDeg());
    Assert.assertEquals("wrong number of edges", 5, graph.getEdgeNum());

  }
View Full Code Here

TOP

Related Classes of bgu.bio.adt.graphs.FlexibleGraph

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.