V
- vertex typepublic class SimpleEdge<V> extends Object implements WeightedEdge<V>, UndirectedEdge<V>
Constructor and Description |
---|
SimpleEdge(V v1,
V v2)
Construct a simple edge.
|
SimpleEdge(V v1,
V v2,
double cost)
Construct a simple edge.
|
Modifier and Type | Method and Description |
---|---|
double |
cost()
Gets the cost or weight of this edge.
|
V |
neighbor(V vertex)
Get the unique neighboring vertex connected to
vertex . |
Set<V> |
neighbors(V vertex)
Gets the set of neighboring vertices connected to
vertex . |
String |
toString() |
Set<V> |
vertices()
Gets the set of vertices associated with the edge.
|
public SimpleEdge(V v1, V v2, double cost)
v1
- a vertexv2
- a vertexcost
- the edge costpublic double cost()
WeightedEdge
cost
in interface WeightedEdge<V>
public Set<V> vertices()
HyperEdge
public Set<V> neighbors(V vertex)
HyperEdge
vertex
.public V neighbor(V vertex)
vertex
.
It may be the same as vertex
to account for self loop.Copyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.