public class GraphBuilder<T> extends Object
Constructor and Description |
---|
GraphBuilder(Graph.GraphType type)
Generic constructor
|
Modifier and Type | Method and Description |
---|---|
GraphBuilder |
addEdge(T u,
T v)
Adds an edge to the graph with weight 1.
|
GraphBuilder |
addEdge(T u,
T v,
double wt)
Adds an edge to the graph
|
GraphBuilder |
addNode(T n)
Adds a single node
|
Graph |
build() |
public GraphBuilder(Graph.GraphType type)
type
- The type of graph to constructpublic Graph build()
public GraphBuilder addNode(T n)
n
- A nodepublic GraphBuilder addEdge(T u, T v)
u
- The first node in the edgev
- The second node in the edgepublic GraphBuilder addEdge(T u, T v, double wt)
u
- The first node in the edgev
- The second node in the edgewt
- The weight of the edgeCopyright © 2018. All rights reserved.