Package dev.nm.graph.type
Class SimpleEdge<V>
- java.lang.Object
-
- dev.nm.graph.type.SimpleEdge<V>
-
- Type Parameters:
V- vertex type
- All Implemented Interfaces:
Edge<V>,HyperEdge<V>,UndirectedEdge<V>,WeightedEdge<V>
public class SimpleEdge<V> extends Object implements WeightedEdge<V>, UndirectedEdge<V>
A simple edge has two vertices.
-
-
Constructor Summary
Constructors Constructor Description SimpleEdge(V v1, V v2)Construct a simple edge.SimpleEdge(V v1, V v2, double cost)Construct a simple edge.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublecost()Gets the cost or weight of this edge.Vneighbor(V vertex)Get the unique neighboring vertex connected tovertex.Set<V>neighbors(V vertex)Gets the set of neighboring vertices connected tovertex.StringtoString()Set<V>vertices()Gets the set of vertices associated with the edge.
-
-
-
Method Detail
-
cost
public double cost()
Description copied from interface:WeightedEdgeGets the cost or weight of this edge.- Specified by:
costin interfaceWeightedEdge<V>- Returns:
- the edge cost
-
vertices
public Set<V> vertices()
Description copied from interface:HyperEdgeGets the set of vertices associated with the edge.
-
neighbors
public Set<V> neighbors(V vertex)
Description copied from interface:HyperEdgeGets the set of neighboring vertices connected tovertex.
-
neighbor
public V neighbor(V vertex)
Get the unique neighboring vertex connected tovertex. It may be the same asvertexto account for self loop.
-
-