Graph
This commit is contained in:
+5
-5
@@ -30,7 +30,7 @@ void c_Graph_Destroy(c_Graph_t* self) {
|
||||
}
|
||||
|
||||
|
||||
c_err_t c_Graph_AddEdge(c_Graph_t* self, c_size_t v, c_size_t w) {
|
||||
c_err_t c_Graph_AddEdge(c_Graph_t* self, c_VertexId_t v, c_VertexId_t w) {
|
||||
if (!self || v >= self->V || w >= self->V) {
|
||||
return C_ERR_PARAM;
|
||||
}
|
||||
@@ -70,7 +70,7 @@ c_err_t c_Graph_AddEdge(c_Graph_t* self, c_size_t v, c_size_t w) {
|
||||
return C_SUCCESS;
|
||||
}
|
||||
|
||||
c_err_t c_Graph_RemoveEdge(c_Graph_t* self, c_size_t v, c_size_t w) {
|
||||
c_err_t c_Graph_RemoveEdge(c_Graph_t* self, c_VertexId_t v, c_VertexId_t w) {
|
||||
if (!self || v >= self->V || w >= self->V) {
|
||||
return C_ERR_PARAM;
|
||||
}
|
||||
@@ -123,7 +123,7 @@ c_err_t c_Graph_RemoveEdge(c_Graph_t* self, c_size_t v, c_size_t w) {
|
||||
return C_SUCCESS;
|
||||
}
|
||||
|
||||
c_bool_t c_Graph_HasEdge(const c_Graph_t* self, c_size_t v, c_size_t w) {
|
||||
c_bool_t c_Graph_HasEdge(const c_Graph_t* self, c_VertexId_t v, c_VertexId_t w) {
|
||||
// Return false immediately if the graph is NULL or if indices are out of bounds
|
||||
if (!self || v >= self->V || w >= self->V) {
|
||||
return C_FALSE;
|
||||
@@ -142,12 +142,12 @@ c_bool_t c_Graph_HasEdge(const c_Graph_t* self, c_size_t v, c_size_t w) {
|
||||
}
|
||||
|
||||
|
||||
c_size_t c_Graph_Degree(c_Graph_t* self, c_size_t v) {
|
||||
c_size_t c_Graph_Degree(c_Graph_t* self, c_VertexId_t v) {
|
||||
if (!self || v >=self->V) return 0;
|
||||
return self->adj_list[v].size;
|
||||
}
|
||||
|
||||
c_AdjList_t* c_Graph_GetAdjList(c_Graph_t* self, c_size_t v) {
|
||||
c_AdjList_t* c_Graph_GetAdjList(c_Graph_t* self, c_VertexId_t v) {
|
||||
if (!self || v >= self->V) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user