Skip to content

Commit 68266d7

Browse files
wifi:)wifi:)
authored andcommitted
Updates king ordering functionality and includes related files
1 parent f13462c commit 68266d7

File tree

4 files changed

+8
-43
lines changed

4 files changed

+8
-43
lines changed

sql/ordering/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ SET(LOCAL_FILES
33
cuthillMckeeOrdering.sql
44
_minDegreeOrdering.sql
55
minDegreeOrdering.sql
6-
# _kingOrdering.sql
7-
# kingOrdering.sql
6+
_kingOrdering.sql
7+
kingOrdering.sql
88
)
99

1010
# Do not modify below this line

src/ordering/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ADD_LIBRARY(ordering OBJECT
22
cuthillMckeeOrdering.c
33
cuthillMckeeOrdering_driver.cpp
44
minDegreeOrdering.c
5-
# kingOrdering.c
5+
kingOrdering.c
66
ordering_driver.cpp
77
ordering_process.cpp
88
)

src/ordering/kingOrdering.c

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -35,47 +35,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
3535
#include "c_types/ii_t_rt.h"
3636

3737

38-
#include "drivers/ordering/kingOrdering_driver.h"
38+
#include "process/ordering_process.h"
3939

4040
PGDLLEXPORT Datum _pgr_kingordering(PG_FUNCTION_ARGS);
4141
PG_FUNCTION_INFO_V1(_pgr_kingordering);
4242

43-
static
44-
void
45-
process(
46-
char* edges_sql,
47-
48-
II_t_rt **result_tuples,
49-
size_t *result_count) {
50-
pgr_SPI_connect();
51-
char* log_msg = NULL;
52-
char* notice_msg = NULL;
53-
char* err_msg = NULL;
54-
55-
(*result_tuples) = NULL;
56-
(*result_count) = 0;
57-
58-
clock_t start_t = clock();
59-
pgr_do_kingOrdering(
60-
edges_sql,
61-
62-
result_tuples,
63-
result_count,
64-
&log_msg,
65-
&notice_msg,
66-
&err_msg);
67-
time_msg("processing kingordering", start_t, clock());
68-
69-
if (err_msg && (*result_tuples)) {
70-
pfree(*result_tuples);
71-
(*result_tuples) = NULL;
72-
(*result_count) = 0;
73-
}
74-
75-
pgr_global_report(&log_msg, &notice_msg, &err_msg);
76-
77-
pgr_SPI_finish();
78-
}
7943

8044
PGDLLEXPORT Datum
8145
_pgr_kingordering(PG_FUNCTION_ARGS) {
@@ -90,8 +54,9 @@ _pgr_kingordering(PG_FUNCTION_ARGS) {
9054
funcctx = SRF_FIRSTCALL_INIT();
9155
oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
9256

93-
process(
57+
pgr_process_ordering(
9458
text_to_cstring(PG_GETARG_TEXT_P(0)),
59+
3, /*King Ordering*/
9560
&result_tuples,
9661
&result_count);
9762

src/ordering/ordering_process.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ void pgr_process_ordering(
6767
which,
6868
result_tuples, result_count,
6969
&log_msg, &notice_msg, &err_msg);
70-
if ( which == 1) {
70+
if ( which == 1) {
7171

7272
time_msg(std::string(" processing pgr_cuthillMckeeOrdering").c_str(), start_t, clock());
7373
} else if ( which == 2) {
7474

7575
time_msg(std::string(" processing pgr_minDegreeOrdering").c_str(), start_t, clock());
76-
} else {
76+
} else if ( which == 3) {
7777

7878
time_msg(std::string(" processing pgr_kingOrdering").c_str(), start_t, clock());
7979
}

0 commit comments

Comments
 (0)