Class GraphExamples

java.lang.Object
com.zybooks.dsaj.graph.GraphExamples

public class GraphExamples extends Object
This class provides a utility to build a graph from a list of edges. It also contains specific factory methods to generate graph instances used as examples within Data Structures and Algorithms in Java, 6th edition.
  • Constructor Details

    • GraphExamples

      public GraphExamples()
  • Method Details

    • graphFromEdgelist

      public static Graph<String,Integer> graphFromEdgelist(String[][] edges, boolean directed)
      Constructs a graph from an array of array strings. An edge can be specified as { "SFO", "LAX" }, in which case edge is created with default edge value of 1, or as { "SFO", "LAX", "337" }, in which case the third entry should be a string that will be converted to an integral value.
    • figure14_3

      public static Graph<String,Integer> figure14_3()
      Returns the unweighted, directed graph from Figure 14.3 of DSAJ6.
    • figure14_8

      public static Graph<String,Integer> figure14_8()
      Returns the unweighted, directed graph from Figure 14.8 of DSAJ6.
    • figure14_9

      public static Graph<String,Integer> figure14_9()
      Returns the unweighted, undirected graph from Figure 14.9 of DSAJ6. This is the same graph as in Figure 14.10.
    • figure14_11

      public static Graph<String,Integer> figure14_11()
      Returns the unweighted, directed graph from Figure 14.11 of DSAJ6.
    • figure14_12

      public static Graph<String,Integer> figure14_12()
      Returns the unweighted, directed graph from Figure 14.12 of DSAJ6. This is the same graph as in Figure 14.13.
    • figure14_14

      public static Graph<String,Integer> figure14_14()
      Returns the weighted, undirected graph from Figure 14.14 of DSAJ6.
    • figure14_15

      public static Graph<String,Integer> figure14_15()
      Returns the weighted, undirected graph from Figure 14.15 of DSAJ6. This is the same graph as in Figures 14.16, 14.17, and 14.20-14.24.
    • main

      public static void main(String[] args)