Package ons.util

Class WeightedMultiGraphMultiWeight

java.lang.Object
ons.util.WeightedMultiGraphMultiWeight

public class WeightedMultiGraphMultiWeight
extends java.lang.Object
  • Constructor Details

  • Method Details

    • size

      public int size()
      Retrieves the size of the graph, i.e., the amount of vertexes it has.
      Returns:
      integer with the quantity of nodes in the graph
    • addEdge

      public void addEdge​(int source, int target, double w)
      Creates a new edge within the graph, which requires its two vertexes and its weight.
      Parameters:
      source - the edge's source node
      target - the edge's destination node
      w - the value of the edge's weight
    • removeEdge

      public void removeEdge​(int source, long id)
    • removeEdgesUntil

      public void removeEdgesUntil​(int source, long id)
    • getFirstEdge

      public MultiWeightEdge getFirstEdge​(int source)
    • getEdgeIterator

      public java.util.Iterator<MultiWeightEdge> getEdgeIterator​(int source)
    • getFirstEdge

      public MultiWeightEdge getFirstEdge​(int source, int target)
    • getEdges

      public java.util.TreeSet<MultiWeightEdge> getEdges​(int source)
    • isEdge

      public boolean isEdge​(int source, int target)
      Says whether or not a given pair of nodes has an edge between them.
      Parameters:
      source - the source node
      target - the destination node
      Returns:
      true if the edge exists, or false otherwise
    • getWeight

      public double getWeight​(int source, int target, long id, int index)
    • getWeight

      public double getWeight​(int source, int target, int index)
    • setWeight

      public void setWeight​(int source, int target, long id, double w, int index)
    • neighbors

      public int[] neighbors​(int vertex)
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • removeNodeEdge

      public void removeNodeEdge​(int node)
    • removeNode

      public void removeNode​(int node)
    • addNode

      public void addNode()
    • getEdge

      public java.util.TreeSet<MultiWeightEdge> getEdge​(int source, int target)
      Retrieves the set of the Edges linking this pair
      Parameters:
      source - the source node
      target - the destination node
      Returns:
      the the set of the Edges linking this pair, if the edge doesnt existing, returns null set
    • removeEdge

      public void removeEdge​(int source, int target)
      Removes a given edge from the graph. This method removes all the edges linking this pair
      Parameters:
      source - the edge's source node
      target - the edge's destination node
    • getWeight

      public double getWeight​(int source, int target)
    • getGraphDiameter

      public double getGraphDiameter​(int index)
      Retrieves the diameter of this graph in this index.
      Parameters:
      index - the edge index
      Returns:
      the longest of all the calculated shortest paths in a network