Package dev.nm.graph.type
Class SimpleArc<V>
- java.lang.Object
-
- dev.nm.graph.type.SimpleArc<V>
-
- Type Parameters:
V
- vertex type
- All Implemented Interfaces:
Arc<V>
,Edge<V>
,HyperEdge<V>
,WeightedArc<V>
,WeightedEdge<V>
public class SimpleArc<V> extends Object implements WeightedArc<V>
A simple arc has two vertices: head and tail.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
cost()
Gets the cost or weight of this edge.V
head()
V
neighbor(V vertex)
Gets the neighboring vertex connected tovertex
.Set<V>
neighbors(V vertex)
Gets the set of neighboring vertices connected tovertex
.V
tail()
Get the tail of this arc.String
toString()
Set<V>
vertices()
Gets the set of vertices associated with the edge.
-
-
-
Method Detail
-
cost
public double cost()
Description copied from interface:WeightedEdge
Gets the cost or weight of this edge.- Specified by:
cost
in interfaceWeightedEdge<V>
- Returns:
- the edge cost
-
neighbor
public V neighbor(V vertex)
Description copied from interface:Edge
Gets the neighboring vertex connected tovertex
.
-
neighbors
public Set<V> neighbors(V vertex)
Description copied from interface:HyperEdge
Gets the set of neighboring vertices connected tovertex
.
-
vertices
public Set<V> vertices()
Description copied from interface:HyperEdge
Gets the set of vertices associated with the edge.
-
-