Interface WeightedGraph<V,W>
- All Superinterfaces:
Graph<V>
- All Known Implementing Classes:
BayesianBeliefNetwork, DirectedWeightedGraph, SocialNetwork
A graph with weighted edges.
Extends the basic Graph interface to support edges with numeric weights. Weights can be any comparable type (Real, Integer, Double, etc.).
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Nested Class Summary
Nested classes/interfaces inherited from interface Graph
Graph.Edge<V> -
Method Summary
Modifier and TypeMethodDescriptiondefault booleanAdds an unweighted edge using the default weight.booleanAdds a weighted edge to the graph.Returns the default weight for unweighted edge additions.Returns the weight of an edge.Set<WeightedEdge<V, W>> Returns all weighted edges in the graph.Set<WeightedEdge<V, W>> getWeightedEdgesFrom(V vertex) Returns weighted edges originating from a vertex.default booleanChecks if an edge exists with a specific weight.Methods inherited from interface Graph
addVertex, bfs, degree, dfs, edges, isDirected, neighbors, vertexCount, vertices
-
Method Details
-
addEdge
-
getWeight
-
getWeightedEdges
Set<WeightedEdge<V,W>> getWeightedEdges()Returns all weighted edges in the graph.- Returns:
- unmodifiable set of weighted edges
-
getWeightedEdgesFrom
Returns weighted edges originating from a vertex.- Parameters:
vertex- the source vertex- Returns:
- set of weighted edges from vertex
-
hasEdge
-
getDefaultWeight
W getDefaultWeight()Returns the default weight for unweighted edge additions.Used when addEdge(V, V) is called without a weight. Subclasses should override to provide appropriate default.
- Returns:
- the default weight (e.g., 1.0, Real.ONE)
-
addEdge
-