progress
This commit is contained in:
48
algorithms.h
Normal file
48
algorithms.h
Normal file
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// Created by Tiago Batista Cardoso on 2/26/2026.
|
||||
//
|
||||
|
||||
#ifndef GRAPHE_ALGORITHMS_H
|
||||
#define GRAPHE_ALGORITHMS_H
|
||||
|
||||
#include "structs.h"
|
||||
|
||||
// -- k-clique communities
|
||||
struct community_t {
|
||||
int *members; // node ids in this community
|
||||
int size;
|
||||
};
|
||||
typedef struct community_t community_t;
|
||||
|
||||
struct community_result_t {
|
||||
community_t *communities;
|
||||
int count;
|
||||
int *node_community; // node_community[i] = community index of node i (-1 if none)
|
||||
};
|
||||
typedef struct community_result_t community_result_t;
|
||||
|
||||
community_result_t *find_k_clique_communities(const graph_t *graph, int k);
|
||||
void free_community_result(community_result_t *result);
|
||||
|
||||
// -- louvain
|
||||
struct louvain_result_t {
|
||||
int *node_community; // node_community[i] = community id of node i
|
||||
int count; // total number of communities
|
||||
double modularity; // final modularity score
|
||||
};
|
||||
typedef struct louvain_result_t louvain_result_t;
|
||||
|
||||
louvain_result_t *compute_louvain(const graph_t *graph);
|
||||
void free_louvain_result(louvain_result_t *result);
|
||||
|
||||
// -- hybrid algorithm
|
||||
struct hybrid_result_t {
|
||||
int *node_community; // node_community[i] = community id of node i
|
||||
int count; // total number of communities
|
||||
};
|
||||
typedef struct hybrid_result_t hybrid_result_t;
|
||||
|
||||
hybrid_result_t *hybrid_community_detection(const graph_t *graph, int k);
|
||||
void free_hybrid_result(hybrid_result_t *result);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user