Skip to content

Commit 0c399b4

Browse files
Prerak SinghPrerak Singh
authored andcommitted
bug fix
1 parent 7808ff7 commit 0c399b4

File tree

2 files changed

+43
-14
lines changed

2 files changed

+43
-14
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- name: Build package
4343
run: |
4444
CXXFLAGS=--coverage CFLAGS=--coverage python scripts/build/install.py
45-
# coverage tests
45+
# coverage tests
4646
- name: Run tests
4747
run: |
4848
python -m pytest --doctest-modules --cov=./ --cov-report=xml -s
@@ -102,7 +102,7 @@ jobs:
102102
103103
- name: Build package
104104
run: |
105-
python scripts/build/install.py
105+
CXXFLAGS="-std=c++17 python scripts/build/install.py
106106
107107
- name: Run tests
108108
run: |
@@ -143,7 +143,7 @@ jobs:
143143
144144
- name: Build package
145145
run: |
146-
python scripts/build/install.py
146+
CXXFLAGS="-std=c++17 python scripts/build/install.py
147147
148148
- name: Run tests
149149
run: |
@@ -191,6 +191,7 @@ jobs:
191191
192192
- name: Build package
193193
run: |
194+
set CL=/std:c++17
194195
python scripts/build/install.py
195196
196197
- name: Run tests

pydatastructs/graphs/_backend/cpp/AdjacencyList.hpp

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <vector>
77
#include <unordered_map>
88
#include <string>
9+
#include <algorithm>
910
#include "AdjacencyListGraphNode.hpp"
1011
#include "GraphEdge.hpp"
1112

@@ -349,17 +350,44 @@ static PyMethodDef AdjacencyListGraph_methods[] = {
349350

350351

351352
PyTypeObject AdjacencyListGraphType = {
352-
PyVarObject_HEAD_INIT(NULL, 0)
353-
.tp_init= 0,
354-
.tp_name = "_graph.AdjacencyListGraph",
355-
.tp_basicsize = sizeof(AdjacencyListGraph),
356-
.tp_itemsize = 0,
357-
.tp_dealloc = (destructor)AdjacencyListGraph_dealloc,
358-
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
359-
.tp_doc = "Adjacency List Graph data structure",
360-
.tp_methods = AdjacencyListGraph_methods,
361-
.tp_new = AdjacencyListGraph_new,
362-
.tp_dictoffset = offsetof(AdjacencyListGraph, dict)
353+
PyVarObject_HEAD_INIT(NULL, 0) // ob_base
354+
"_graph.AdjacencyListGraph", // tp_name
355+
sizeof(AdjacencyListGraph), // tp_basicsize
356+
0, // tp_itemsize
357+
(destructor)AdjacencyListGraph_dealloc, // tp_dealloc
358+
0, // tp_vectorcall_offset or tp_print (depends on Python version)
359+
0, // tp_getattr
360+
0, // tp_setattr
361+
0, // tp_as_async / tp_reserved
362+
0, // tp_repr
363+
0, // tp_as_number
364+
0, // tp_as_sequence
365+
0, // tp_as_mapping
366+
0, // tp_hash
367+
0, // tp_call
368+
0, // tp_str
369+
0, // tp_getattro
370+
0, // tp_setattro
371+
0, // tp_as_buffer
372+
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, // tp_flags
373+
"Adjacency List Graph data structure", // tp_doc
374+
0, // tp_traverse
375+
0, // tp_clear
376+
0, // tp_richcompare
377+
0, // tp_weaklistoffset
378+
0, // tp_iter
379+
0, // tp_iternext
380+
AdjacencyListGraph_methods, // tp_methods
381+
0, // tp_members
382+
0, // tp_getset
383+
0, // tp_base
384+
0, // tp_dict
385+
0, // tp_descr_get
386+
0, // tp_descr_set
387+
offsetof(AdjacencyListGraph, dict), // tp_dictoffset
388+
0, // tp_init
389+
0, // tp_alloc
390+
AdjacencyListGraph_new // tp_new
363391
};
364392

365393
#endif

0 commit comments

Comments
 (0)