Class SimpleGraph<V,​E>

java.lang.Object
org.jgrapht.graph.AbstractGraph<V,​E>
org.jgrapht.graph.AbstractBaseGraph<V,​E>
org.jgrapht.graph.SimpleGraph<V,​E>
Type Parameters:
V - the graph vertex type
E - the graph edge type
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Graph<V,​E>
Direct Known Subclasses:
BlockCutpointGraph, SimpleWeightedGraph

public class SimpleGraph<V,​E>
extends AbstractBaseGraph<V,​E>
Implementation of a Simple Graph. A Simple Graph is an undirected graph containing no graph loops or multiple edges. This particular implementation supports both weighted and unweighted edges.
See Also:
Serialized Form
  • Constructor Details

    • SimpleGraph

      public SimpleGraph​(java.lang.Class<? extends E> edgeClass)
      Creates a new simple graph.
      Parameters:
      edgeClass - class on which to base the edge supplier
    • SimpleGraph

      public SimpleGraph​(java.util.function.Supplier<V> vertexSupplier, java.util.function.Supplier<E> edgeSupplier, boolean weighted)
      Creates a new simple graph.
      Parameters:
      vertexSupplier - the vertex supplier, can be null
      edgeSupplier - the edge supplier, can be null
      weighted - whether the graph is weighted or not
  • Method Details

    • createBuilder

      public static <V,​ E> GraphBuilder<V,​E,​? extends SimpleGraph<V,​E>> createBuilder​(java.lang.Class<? extends E> edgeClass)
      Create a builder for this kind of graph.
      Type Parameters:
      V - the graph vertex type
      E - the graph edge type
      Parameters:
      edgeClass - class on which to base factory for edges
      Returns:
      a builder for this kind of graph
    • createBuilder

      public static <V,​ E> GraphBuilder<V,​E,​? extends SimpleGraph<V,​E>> createBuilder​(java.util.function.Supplier<E> edgeSupplier)
      Create a builder for this kind of graph.
      Type Parameters:
      V - the graph vertex type
      E - the graph edge type
      Parameters:
      edgeSupplier - the edge supplier of the new graph
      Returns:
      a builder for this kind of graph