Package ons.util
Class WeightedMultiGraphMultiWeight
java.lang.Object
ons.util.WeightedMultiGraphMultiWeight
public class WeightedMultiGraphMultiWeight
extends java.lang.Object
-
Constructor Summary
Constructors Constructor Description WeightedMultiGraphMultiWeight(int n)
WeightedMultiGraphMultiWeight(WeightedGraph g)
WeightedMultiGraphMultiWeight(WeightedMultiGraphMultiWeight g)
-
Method Summary
Modifier and Type Method Description void
addEdge(int source, int target, double w)
Creates a new edge within the graph, which requires its two vertexes and its weight.void
addNode()
java.util.TreeSet<MultiWeightEdge>
getEdge(int source, int target)
Retrieves the set of the Edges linking this pairjava.util.Iterator<MultiWeightEdge>
getEdgeIterator(int source)
java.util.TreeSet<MultiWeightEdge>
getEdges(int source)
MultiWeightEdge
getFirstEdge(int source)
MultiWeightEdge
getFirstEdge(int source, int target)
double
getGraphDiameter(int index)
Retrieves the diameter of this graph in this index.double
getWeight(int source, int target)
double
getWeight(int source, int target, int index)
double
getWeight(int source, int target, long id, int index)
boolean
isEdge(int source, int target)
Says whether or not a given pair of nodes has an edge between them.int[]
neighbors(int vertex)
void
removeEdge(int source, int target)
Removes a given edge from the graph.void
removeEdge(int source, long id)
void
removeEdgesUntil(int source, long id)
void
removeNode(int node)
void
removeNodeEdge(int node)
void
setWeight(int source, int target, long id, double w, int index)
int
size()
Retrieves the size of the graph, i.e., the amount of vertexes it has.java.lang.String
toString()
-
Constructor Details
-
WeightedMultiGraphMultiWeight
public WeightedMultiGraphMultiWeight(int n) -
WeightedMultiGraphMultiWeight
-
WeightedMultiGraphMultiWeight
-
-
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 nodetarget
- the edge's destination nodew
- the value of the edge's weight
-
removeEdge
public void removeEdge(int source, long id) -
removeEdgesUntil
public void removeEdgesUntil(int source, long id) -
getFirstEdge
-
getEdgeIterator
-
getFirstEdge
-
getEdges
-
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 nodetarget
- 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 classjava.lang.Object
-
removeNodeEdge
public void removeNodeEdge(int node) -
removeNode
public void removeNode(int node) -
addNode
public void addNode() -
getEdge
Retrieves the set of the Edges linking this pair- Parameters:
source
- the source nodetarget
- 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 nodetarget
- 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
-