📄 specification files
字号:
Specification File by 07302010036 范豪钧
adjacencyListGragh
class GeneralGraph:
use adjacency list to implement the graph which data structure is vector
Construct methods:
* public GeneralGraph():
contain an empty vector store the vertex and a boolean determines whether graph is directed or not, defaulted is undirected
* public GeneralGraph(boolean bool):
contain an empty vector store the vertex and if bool is true then the graph is directed or else it is undirected
Public methods:
Accessor methods:
* Vertex[] endVertices(Edge edge):
return an array of the two endvertices of e
* boolean areAdjacent(Vertex v , Vertex w ):
return true iff v and w are adjacent
* Integer outDegree(Vertex v):
return the out degree of a directed graph, if the graph is undirected or v doesn't exist, return null
* Integer inDegree(Vertex v):
return the in degree of a directed graph, if the graph is undirected or v doesn't exist, return null
* Integer Degree(Vertex v):
return the degree of a undirected graph, if the graph is directed or v doesn't exist, return null
Update methods :
* void replace(Edge e , Object element):
replace element at vertex v with x
* void replace(Vertex v , Object element):
replace element at edge e with x
* Vertex insertVertex(Object element):
insert a vertex storing element, and return the vertex
* Edge insertEdge(Vertex v , Vertex w, Object element):
insert an edge (v,w) storing element, and return the edge
* void removeVertex(Vertex v):
remove vertex v (and its incident edges)
* void removeEdge(Edge e):
remove edge e
Iterator methods:
* Vector<Edge> incidentEdges(Vertex v):
return a vector contain the edges incident to v
* Vector<Vertex> vertices():
return a vector contain all the vertices in the graph
* Vector<Edge> edges():
return a vector contain all the edges in the graph
//MORE DETAILS GOES TO MY CODE, THERE WILL BE A MORE CLEAR EXPLANATION FOR EVERY METHOD
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -