Skip to content

Commit

Permalink
Merge pull request #24 from ldm2468/minor-improvements
Browse files Browse the repository at this point in the history
Minor improvements
  • Loading branch information
ldm2468 authored Jul 21, 2022
2 parents a63e94a + 3cb14cd commit c7046cc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.o
*.d
main
test
data
Expand Down
24 changes: 15 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
CXX = g++
MAIN = main
MAIN_OBJECTS = main.o graph.o parse.o stat.o basicstat.o connectstat.o biconnected.o eigencentrality.o closenesscentrality.o betweennesscentrality.o countstat.o makeplot.o html.o statanalyzer.o
TEST = test
TEST_OBJECTS = test.o graph.o parse.o diameter.o
PYPLOT_DIR = pyplot
CXXFLAGS = -std=c++17 -Wall -O3
LDFLAGS =
CXX := g++
MAIN := main
MAIN_OBJECTS := main.o graph.o parse.o stat.o basicstat.o connectstat.o biconnected.o eigencentrality.o closenesscentrality.o betweennesscentrality.o countstat.o makeplot.o html.o statanalyzer.o
TEST := test
TEST_OBJECTS := test.o graph.o parse.o diameter.o
PYPLOT_DIR := pyplot
CXXFLAGS := -std=c++17 -Wall -O3
LDFLAGS :=
MAIN_DEPS := $(MAIN_OBJECTS:.o=.d)
TEST_DEPS := $(TEST_OBJECTS:.o=.d)
CPPFLAGS := -MMD -MP

all: $(MAIN) $(TEST) $(PYPLOT_DIR)

Expand All @@ -19,4 +22,7 @@ $(PYPLOT_DIR):
mkdir -p pyplot

clean:
rm -rf $(MAIN) $(MAIN_OBJECTS) $(TEST) $(TEST_OBJECTS) *.html pyplot __pycache__
rm -rf $(MAIN) $(MAIN_OBJECTS) $(TEST) $(TEST_OBJECTS) $(MAIN_DEPS) $(TEST_DEPS) *.html pyplot __pycache__

-include $(MAIN_DEPS)
-include $(TEST_DEPS)
2 changes: 1 addition & 1 deletion betweennesscentrality.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "graph.h"
#include "stat.h"

#define MAX_BETWEENNESS_SAMPLE_SZ 50
#define MAX_BETWEENNESS_SAMPLE_SZ 300

namespace snu {
class BetweennessCentrality : public CommonStat {
Expand Down
4 changes: 2 additions & 2 deletions testers/test_centrality.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@
test_dict[vid] = i

f_out.write(f'Comparing Stat: {stat_to_compare}\n\n')
f_out.write(f'{"B-rank" :<8}{"T-rank" :<8}{"vid" :<8}{"B-value" :<16}{"T-value" :<16}{"R-Err" :<8}\n')
f_out.write(f'{"SNAP-rank" :<14}{"OUR-rank" :<14}{"vid" :<8}{"SNAP-value" :<16}{"OUR-value" :<16}{"R-Err" :<8}\n')
for i in range (min(len(base_lis), len(test_lis))):
(val, vid) = base_lis[i]
t_idx = test_dict[vid]
t_val = test_lis[t_idx][0]
err = str(t_val/val - 1) if (val > 0 and t_val > 0) else "A:" + str(abs(t_val - val))
l = f'{i :<8}{t_idx :<8}{vid :<8}{val :<16}{t_val :<16}{err :<8}\n'
l = f'{i :<14}{t_idx :<14}{vid :<8}{val :<16}{t_val :<16}{err :<8}\n'
f_out.write(l)

0 comments on commit c7046cc

Please sign in to comment.