-
Notifications
You must be signed in to change notification settings - Fork 312
Add C++ Backend for BFS and Use std::variant for Graph Node Data #684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
prex03
commented
Jun 14, 2025
- Added C++ implementations for DFS and BFS to improve traversal performance.
- Updated graph node data handling to use std::variant for type-safe storage.
- Adjusted Python bindings to support these backend changes.
self->data_type = DataType::String; | ||
self->data = std::string(str); | ||
} else { | ||
PyErr_SetString(PyExc_TypeError, "Unsupported data type. Must be int, float, str, or None."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other cases set to normal PyObject
data type.
@@ -13,7 +13,6 @@ typedef struct { | |||
} AdjacencyMatrixGraphNode; | |||
|
|||
static void AdjacencyMatrixGraphNode_dealloc(AdjacencyMatrixGraphNode* self){ | |||
Py_XDECREF(self->super.data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is PyObject
then keep this inside if
.
Tests for PyObject* type of data for nodes added in test_misc_util.py lines 39 and 47 |