| 构造器和说明 |
|---|
EntityGraph(boolean directed)
Construct the entity graph
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addEdge(int i,
int j,
double weight)
add an edge to the graph
|
int |
addVertex(E e)
add a vertex
|
void |
addVertex(int id,
E e)
add a vertex with an ID
|
Collection<Integer> |
adjacentVertices(int i) |
void |
clear()
clear the vertices and edges in the graph
|
double |
edgeWeight(int i,
int j) |
E |
getVertex(int id)
get the value of vertex by id
|
boolean |
isDirected()
if this graph is directed or not
|
void |
removeEdge(int i,
int j)
remove the edge that is specified by ordered index pair <i, j>
|
void |
removeVertex(E e)
remove the vertex if this graph contains this vertex.
|
void |
removeVertex(int id)
remove the vertex if this graph contains this vertex.
|
Collection<Integer> |
vertices()
the vertices of this graph
|
public EntityGraph(boolean directed)
directed - if true, construct a directed graph, false, an undirected graphpublic int addVertex(E e)
e - the value of vertexpublic void addVertex(int id,
E e)
id - the id of the vertexe - the value of vertexpublic void removeVertex(int id)
id - the index of the vertex which is to be removedpublic void removeVertex(E e)
e - the value of the vertex which is to be removedpublic E getVertex(int id)
id - the index of vertexpublic void addEdge(int i,
int j,
double weight)
i - the index of vertex i, if vi equals vj, do nothingj - the index of vertex j, if vj equals vi, no nothingweight - the weight of the edge to be added, must be non-negativepublic void removeEdge(int i,
int j)
i - the index of vertex i, if vi equals vj, do nothingj - the index of vertex j, if vj equals vi, no nothingpublic void clear()
public 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 Collection<Integer> vertices()
public boolean isDirected()
isDirected 在接口中 BaseGraphCopyright © 2019. All rights reserved.