Package squidpony.squidai.graph
Class UndirectedGraph<V>
java.lang.Object
squidpony.squidai.graph.Graph<V>
squidpony.squidai.graph.UndirectedGraph<V>
- Type Parameters:
V
- the vertex type; oftenCoord
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DefaultGraph
public class UndirectedGraph<V> extends Graph<V> implements Serializable
A kind of
Graph
where all connections between vertices are two-way and have equal cost for traveling A to B
or B to A.- Author:
- earlygrey
- See Also:
The DefaultGraph class supports the common case where V is Coord and all costs are 1.
, Serialized Form
-
Field Summary
-
Constructor Summary
Constructors Constructor Description UndirectedGraph()
UndirectedGraph(Collection<V> vertices)
-
Method Summary
Modifier and Type Method Description protected Connection<V>
addConnection(Node<V> a, Node<V> b, float weight)
UndirectedGraphAlgorithms<V>
algorithms()
protected Graph<V>
createNew()
protected Connection<V>
getEdge(Node<V> a, Node<V> b)
boolean
isDirected()
Check if the graph is directed, that is whether the edges form an ordered pair or a set.protected Connection<V>
obtainEdge()
protected boolean
removeConnection(Node<V> a, Node<V> b)
Methods inherited from class squidpony.squidai.graph.Graph
addConnection, addEdge, addEdge, addVertex, addVertices, connectionExists, contains, edgeExists, getEdge, getEdgeCount, getEdges, getEdges, getNode, getNodes, getVertices, removeAllEdges, removeAllVertices, removeEdge, removeEdge, removeNode, removeVertex, removeVertices, size, sortEdges, sortVertices
-
Constructor Details
-
Method Details
-
obtainEdge
- Specified by:
obtainEdge
in classGraph<V>
-
addConnection
- Overrides:
addConnection
in classGraph<V>
-
removeConnection
- Overrides:
removeConnection
in classGraph<V>
-
getEdge
-
isDirected
Description copied from class:Graph
Check if the graph is directed, that is whether the edges form an ordered pair or a set.- Overrides:
isDirected
in classGraph<V>
- Returns:
- whether the graph is directed
-
createNew
-
algorithms
- Specified by:
algorithms
in classGraph<V>
-