| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11232 | HW4-Graph |
|
Description
The target of the homework is to construct an simple undirected graph (No self loops, No multiple edges)
To implement this undirected simple graph, you are asked to implement these 7 functions
addEdge(A, B, C)
add an edge between A & B with weight C, if A or B doesn't exist in the graph, create new vertex A or B in this graph too
deleteEdge(A, B)
delete the edge between A & B, if this edge doesn't exist, then do nothing
deleteVertex(A)
delete the vertex A and all edges that connect to A, if A doesn't exist, do nothing
degree(A)
return the degree of vertex A, return 0 if A doesn't exist
isExistPath(A, B)
return true(bool) if there is at least one path between A & B, else return false(bool), if A or B doesn't exist in the graph, return false
deleteGraph()
delete all vertices and edges in the graph
num_of_component()
return the number of the components, if this graph doesn't have any vertex, then return 0
You must #include "function.h" in your code
https://gist.github.com/anonymous/37ad60919dc41232c7cf0f0d7935782d
Input
some graph instructions
Output
results that after finishing these instructions