Skip to content

Commit c57ce63

Browse files
committed
feat: add template for data initialization
1 parent 23147e1 commit c57ce63

File tree

1 file changed

+77
-19
lines changed

1 file changed

+77
-19
lines changed

src/main.c

Lines changed: 77 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,60 +2,118 @@
22
#include <stdint.h>
33
#include "../vendor/GraphBLAS/Include/GraphBLAS.h"
44
#include "../vendor/LAGraph/include/LAGraph.h"
5-
typedef enum {
5+
6+
char msg[LAGRAPH_MSG_LEN];
7+
8+
typedef enum
9+
{
610
VISA,
711
MIR,
812
MASTERCARD,
913
} System;
1014

11-
typedef enum {
15+
typedef enum
16+
{
1217
MALE,
1318
FEMALE,
1419
} Gender;
1520

16-
typedef enum {
17-
EDGE_OWNS,
18-
EDGE_CALL,
19-
EDGE_TX
20-
} EdgeType;
21+
// typedef enum
22+
// {
23+
// EDGE_OWNS,
24+
// EDGE_CALL,
25+
// EDGE_TX
26+
// } EdgeType;
2127

22-
typedef struct {
28+
typedef struct
29+
{
2330
Gender gender;
2431
uint8_t age;
2532
} User;
2633

27-
typedef struct {
34+
typedef struct
35+
{
2836
System system;
2937
double limit;
3038
} Card;
3139

32-
typedef struct {
33-
EdgeType type;
40+
typedef struct
41+
{
42+
// EdgeType type;
3443
double weight;
3544
double aux;
36-
} EdgeInfo;
45+
} EdgeOwn;
3746

38-
void edge_mul(void *z, const void *x, const void *y) {
47+
typedef struct
48+
{
49+
// EdgeType type;
50+
double weight;
51+
double aux;
52+
} EdgeCall;
3953

40-
}
54+
typedef struct
55+
{
56+
// EdgeType type;
57+
double weight;
58+
double aux;
59+
} EdgeTX;
4160

42-
void edge_add(void *z, const void *x, const void *y) {
61+
void edge_mul(void *z, const void *x, const void *y)
62+
{
63+
}
4364

65+
void edge_add(void *z, const void *x, const void *y)
66+
{
4467
}
4568

4669
int main()
4770
{
4871
// init graphblas
4972
GrB_Info info = GrB_init(GrB_NONBLOCKING);
50-
if (info != GrB_SUCCESS) {
73+
if (info != GrB_SUCCESS)
74+
{
5175
fprintf(stderr, "GraphBLAS init failed\n");
5276
return 1;
5377
}
5478
printf("GraphBLAS initialized.\n");
79+
LAGraph_Init(msg);
80+
printf("LAGraph initialized.\n");
81+
82+
// read all input
83+
GrB_Matrix call_edges_mat, tx_edges_mat, owns_edges_mat;
84+
char *call_edges_file = "data/minimal_demo/graph/call.mtx";
85+
char *owns_edges_file = "data/minimal_demo/graph/owns.mtx";
86+
char *tx_edges_file = "data/minimal_demo/graph/transaction.mtx";
87+
FILE *fcall = fopen(call_edges_file, "r");
88+
FILE *fowns = fopen(owns_edges_file, "r");
89+
FILE *ftx = fopen(tx_edges_file, "r");
90+
LAGraph_MMRead(&call_edges_mat, fcall, msg);
91+
LAGraph_MMRead(&owns_edges_mat, fowns, msg);
92+
LAGraph_MMRead(&tx_edges_mat, ftx, msg);
93+
94+
// init vetrices
95+
// 1 - 4 --- users
96+
User users[] = {
97+
98+
};
99+
// 5 - 9 --- cards
100+
Card cards[] = {};
101+
102+
// init edges
103+
// 4,6,7 --- call
104+
EdgeCall call_edges[] = {};
105+
// 2,3,9,11,12 --- owns
106+
EdgeOwn owns_edges[] = {};
107+
// 1,5,8,10 --- tx
108+
EdgeTX tx_edges[] = {};
109+
110+
// apply filters
111+
112+
// vertex filter: we will take only prersons over 30 and exclude cards with `mastercard` payment system
55113

56-
// custom type
57-
GrB_Type EdgeInfo_Type;
58-
GrB_Type_new(&EdgeInfo_Type, sizeof(EdgeInfo));
114+
// build matrix M
59115

116+
// build matrix M'
60117

118+
// run pagerank
61119
}

0 commit comments

Comments
 (0)