| 限定符和类型 | 字段和说明 |
|---|---|
protected Map<Integer,Map<Integer,Double>> |
edges
the edges of this graph, weight is represented using a double value
|
| 构造器和说明 |
|---|
DirectedGraph() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addEdge(int vi,
int vj,
double weight)
add an edge to the graph
|
void |
addVertex(int vi)
add a vertex to the graph
|
Collection<Integer> |
adjacentVertices(int i) |
void |
clear()
clear all vertices and edges in the graph.
|
double |
edgeWeight(int i,
int j) |
boolean |
hasVertex(int vi)
determine if this graph has vertex vi
|
boolean |
isDirected()
if this graph is directed or not
|
void |
removeEdge(int vi,
int vj)
remove the edge that is specified by ordered index pair <i, j>
|
void |
removeVertex(int vi)
remove the vertex
|
void |
updateEdge(int vi,
int vj,
double weight)
update the weight of edge that is specified by ordered index pair <i, j>
|
Collection<Integer> |
vertices()
the vertices of this graph
|
public void addEdge(int vi,
int vj,
double weight)
public void removeEdge(int vi,
int vj)
removeEdge 在接口中 Graphvi - the index of vertex i, if vi equals vj, do nothingvj - the index of vertex j, if vj equals vi, no nothingpublic void updateEdge(int vi,
int vj,
double weight)
updateEdge 在接口中 Graphvi - the index of vertex i, if vi equals vj, do nothingvj - the index of vertex j, if vj equals vi, no nothingweight - the weight of edge that is to be updated, must be non-negativepublic void addVertex(int vi)
public void removeVertex(int vi)
removeVertex 在接口中 Graphvi - the index of vertex which is to be removedpublic void clear()
Graphpublic Collection<Integer> vertices()
public boolean isDirected()
BaseGraphisDirected 在接口中 BaseGraphpublic double edgeWeight(int i,
int j)
edgeWeight 在接口中 BaseGraphi - the index of one vertexj - the index of another vertexBaseGraph.Npublic Collection<Integer> adjacentVertices(int i)
adjacentVertices 在接口中 BaseGraphi - ith vertexpublic boolean hasVertex(int vi)
vi - the index of vertexCopyright © 2019. All rights reserved.