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 void
addEdge(int source, int target, double weight)
void
addNode()
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 pairEdge
getFirstEdge(int source)
Edge
getFirstEdge(int source, int target)
double
getGraphDiameter()
Retrieves the diameter of this graph.double
getWeight(int source, int target)
double
getWeight(int source, int target, long id)
boolean
isEdge(int source, int target)
int[]
neighbors(int vertex)
void
removeEdge(int source, int target)
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, double w)
void
setWeight(int source, int target, long id, double w)
int
size()
java.lang.String
toString()
-
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:
toString
in 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
-