Skip to content

Add C++ Backend for DFS/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

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

prex03
Copy link
Contributor

@prex03 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.");
Copy link
Member

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);
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants