pagerank implementation

This commit is contained in:
2025-04-18 09:46:23 +02:00
parent 67e846c758
commit 151ffe8dd8
19 changed files with 575 additions and 0 deletions

51
Makefile Normal file
View File

@ -0,0 +1,51 @@
# --------------------------------------------------
# Configuration
# --------------------------------------------------
CC := gcc
CFLAGS := -Wall -fopenmp -O3
SRCDIR := src
OBJDIR := out
DATAPATH := data/web-Google/web-Google.mtx
#
SRCS := $(wildcard $(SRCDIR)/*.c)
OBJS := $(patsubst $(SRCDIR)/%.c,$(OBJDIR)/%.o,$(SRCS))
# --------------------------------------------------
# Phony targets
# --------------------------------------------------
.PHONY: all sparse clean
all: sparse
sparse: $(OBJDIR)/sparse | $(OBJDIR)
@echo "→ Running sparse"
./$(OBJDIR)/sparse
# --------------------------------------------------
# Link
# --------------------------------------------------
$(OBJDIR)/sparse: $(OBJS) $(DATAPATH) | $(OBJDIR)
@echo "→ Copying input data"
cp $(DATAPATH) $(OBJDIR)/input.rb
@echo "→ Linking $@"
$(CC) $(CFLAGS) -o $@ $(OBJS)
# --------------------------------------------------
# Compile
# --------------------------------------------------
$(OBJDIR)/%.o: $(SRCDIR)/%.c | $(OBJDIR)
@echo "→ Compiling $<"
$(CC) $(CFLAGS) -c $< -o $@
# --------------------------------------------------
# Check if output directory exists
# --------------------------------------------------
$(OBJDIR):
mkdir -p $(OBJDIR)
# --------------------------------------------------
# Clean
# --------------------------------------------------
clean:
rm -rf $(OBJDIR)/*