Package ons.util
Class WeightedMultiGraph
java.lang.Object
ons.util.WeightedMultiGraph
public class WeightedMultiGraph
extends java.lang.Object
-
Constructor Summary
Constructors Constructor Description WeightedMultiGraph(int n)WeightedMultiGraph(WeightedGraph g)WeightedMultiGraph(WeightedMultiGraph g) -
Method Summary
Modifier and Type Method Description voidaddEdge(int source, int target, double weight)voidaddNode()java.util.Iterator<Edge>getEdgeIterator(int source)java.util.TreeSet<Edge>getEdges(int source)java.util.ArrayList<Edge>getEdges(int source, int target)Retrieves the set of the Edges linking this pairEdgegetFirstEdge(int source)EdgegetFirstEdge(int source, int target)doublegetGraphDiameter()Retrieves the diameter of this graph.doublegetWeight(int source, int target)doublegetWeight(int source, int target, long id)booleanisEdge(int source, int target)int[]neighbors(int vertex)voidremoveEdge(int source, int target)voidremoveEdge(int source, long id)voidremoveEdgesUntil(int source, long id)voidremoveNode(int node)voidremoveNodeEdge(int node)voidsetWeight(int source, int target, double w)voidsetWeight(int source, int target, long id, double w)intsize()java.lang.StringtoString()
-
Constructor Details
-
WeightedMultiGraph
public WeightedMultiGraph(int n) -
WeightedMultiGraph
-
WeightedMultiGraph
-
-
Method Details
-
size
public int size() -
addEdge
public void addEdge(int source, int target, double 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) -
getEdges
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
-
getWeight
public double getWeight(int source, int target, long id) -
getWeight
public double getWeight(int source, int target) -
setWeight
public void setWeight(int source, int target, long id, double w) -
setWeight
public void setWeight(int source, int target, double w) -
neighbors
public int[] neighbors(int vertex) -
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
removeNodeEdge
public void removeNodeEdge(int node) -
removeNode
public void removeNode(int node) -
addNode
public void addNode() -
removeEdge
public void removeEdge(int source, int target) -
getGraphDiameter
public double getGraphDiameter()Retrieves the diameter of this graph.- Returns:
- the longest of all the calculated shortest paths in a network
-