in src/h3lib/lib/vertexGraph.c [135:162]
int removeVertexNode(VertexGraph* graph, VertexNode* node) {
// Determine location
uint32_t index = _hashVertex(&node->from, graph->res, graph->numBuckets);
VertexNode* currentNode = graph->buckets[index];
int found = 0;
if (currentNode != NULL) {
if (currentNode == node) {
graph->buckets[index] = node->next;
found = 1;
}
// Look through the list
while (!found && currentNode->next != NULL) {
if (currentNode->next == node) {
// splice the node out
currentNode->next = node->next;
found = 1;
}
currentNode = currentNode->next;
}
}
if (found) {
H3_MEMORY(free)(node);
graph->size--;
return 0;
}
// Failed to find the node
return 1;
}