Class SimpleWeightedDigraph


@Deprecated(forRemoval=true, since="10.2") public class SimpleWeightedDigraph extends WeightedDigraph
Deprecated, for removal: This API element is subject to removal in a future version.
A simple graph is a graph with no parallel edges or loops. This class models a simple digraph -- edges are directed and a single edge may go from any vertex to any other vertex. It is possible to have edges A-->B and B-->A however. Attempting to add an edge from A to B when an edge from A to B already exists causes the edge weight to be increased by the defaultEdgeWeight or the weight specified. This class may be used when simple unweighted graphs are desired. (Simply ignore edge weights.)
  • Constructor Details

    • SimpleWeightedDigraph

      public SimpleWeightedDigraph(int vertexCapacity, int edgeCapacity, double defaultEdgeWeight, boolean loopsAllowed)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Constructor for SimpleWeightedDigraph.
      Parameters:
      vertexCapacity - initially allocate space for this many vertices.
      edgeCapacity - initially allocate space for this many edges.
      defaultEdgeWeight - edges are given this weight at creation time by default. the default is 1.0 for constructors where not specified.
      loopsAllowed - Loops are allowed in the graph if this value set true in constructor. Default value is false. If vertex weights are desired, the class can either be extended or a vertex attribute can be defined using the code DoubleAttribute vertexWeights = (DoubleAttribute)this.vertexAttributes().createAttribute("weight", AttributeManager.DOUBLE_TYPE);
    • SimpleWeightedDigraph

      public SimpleWeightedDigraph(int vertexCapacity, int edgeCapacity, double defaultEdgeWeight)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Constructor for SimpleWeightedDigraph. AllowLoops is false by default.
      Parameters:
      vertexCapacity -
      edgeCapacity -
      defaultEdgeWeight -
    • SimpleWeightedDigraph

      public SimpleWeightedDigraph(int vertexCapacity, int edgeCapacity)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Constructor for SimpleWeightedDigraph. AllowLoops is false by default. The defaultEdgeWeight is 1.0.
      Parameters:
      vertexCapacity -
      edgeCapacity -
  • Method Details

    • add

      public boolean add(Edge e)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Add an edge with the the default edge weight. If an edge from and to the vertices specified by the edge already exists in the graph, then the edge weight in increased by the default value.
      Overrides:
      add in class WeightedDigraph
      Parameters:
      e - the edge to add.
      Returns:
      true if the edge was added sucessfully.
    • add

      public boolean add(Edge e, double weight)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Add an edge with the the specified edge weight. If an edge from and to the vertices specified by the edge already exists in the graph, then the edge weight in increased by the specified value.
      Overrides:
      add in class WeightedDigraph
      Returns:
      true if the edge was added sucessfully.
    • remove

      public boolean remove(Edge e)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from class: DirectedGraph
      Removes Edge e from the graph. No effect if the edge is not in the graph.
      Overrides:
      remove in class DirectedGraph
    • getWeight

      public double getWeight(Edge e)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from class: WeightedDigraph
      Returns the weight of the specified edge.
      Overrides:
      getWeight in class WeightedDigraph
    • copy

      public DirectedGraph copy()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Overrides:
      copy in class WeightedDigraph
      Returns:
      A directed graph with the same vertices, edges, and attributes.