PandA-2024.02
simple_API.h
Go to the documentation of this file.
1 #ifndef __GRAPH_H__
2 #define __GRAPH_H__
3 
4 #include <stddef.h>
5 
6 #ifndef N_THREADS
7 #define N_THREADS 8
8 #endif
9 
10 
11 typedef unsigned int NodeId;
12 typedef unsigned int EdgeId;
13 typedef unsigned int PropertyId;
14 
15 
16 typedef struct Edge {
19 } Edge;
20 
21 #ifndef MAX_VERTEX_NUMBER
22 #define MAX_VERTEX_NUMBER 1309073
23 #endif
24 
25 #ifndef MAX_EDGE_NUMBER
26 #define MAX_EDGE_NUMBER 5309056
27 #endif
28 
29 typedef struct Graph {
30  size_t numVertices;
31 // PropertyId * VertexPropertyVector;
32  EdgeId outEdgesIDs[MAX_VERTEX_NUMBER];
34 
36  Edge outEdges[MAX_EDGE_NUMBER];
37 } Graph;
38 
39 
40 //===----------------------------------------------------------------------===//
41 // Backward Star Interface
42 //===----------------------------------------------------------------------===//
43 
44 //size_t getInDegree(Graph * graph, NodeId node);
45 static inline size_t getInDegree(Graph * graph, NodeId node) {
46  return graph->inEdgesIDs[node+1] - graph->inEdgesIDs[node];
47 }
48 
49 //Edge * getInEdges(Graph * graph, NodeId node);
50 static inline Edge * getInEdges(Graph * graph, NodeId node) {
51  EdgeId idx = graph->inEdgesIDs[node];
52  return &graph->inEdges[idx];
53 }
54 
55 //===----------------------------------------------------------------------===//
56 // Forward Star Interface
57 //===----------------------------------------------------------------------===//
58 
59 //size_t getOutDegree(Graph * graph, NodeId node);
60 static inline size_t getOutDegree(Graph * graph, NodeId node) {
61  return graph->outEdgesIDs[node+1] - graph->outEdgesIDs[node];
62 }
63 
64 //Edge * getOutEdges(Graph * graph, NodeId node);
65 static inline Edge * getOutEdges(Graph * graph, NodeId node) {
66  EdgeId idx = graph->outEdgesIDs[node];
67  return &graph->outEdges[idx];
68 }
69 
70 extern void
71 loadGraph(char * InVertexFileName, char * OutVertexFileName, char * InEdgeFileName, char * OutEdgeFileName);
72 
73 extern Graph TheGraph;
74 
75 extern unsigned numAnswers;
76 
77 extern unsigned counter[N_THREADS];
78 
79 #endif /* __GRAPH_H__ */
EdgeId inEdgesIDs[MAX_VERTEX_NUMBER]
Definition: simple_API.h:33
PropertyId property
Definition: simple_API.h:18
unsigned int PropertyId
Definition: simple_API.h:13
#define MAX_VERTEX_NUMBER
Definition: simple_API.h:22
unsigned int NodeId
Definition: simple_API.h:11
unsigned numAnswers
Definition: data.c:5
Edge outEdges[MAX_EDGE_NUMBER]
Definition: simple_API.h:36
#define MAX_EDGE_NUMBER
Definition: simple_API.h:26
static Edge * getInEdges(Graph *graph, NodeId node)
Definition: simple_API.h:50
NodeId node
Definition: simple_API.h:17
static size_t getInDegree(Graph *graph, NodeId node)
Definition: simple_API.h:45
struct Graph Graph
static Edge * getOutEdges(Graph *graph, NodeId node)
Definition: simple_API.h:65
#define N_THREADS
Definition: simple_API.h:7
Edge inEdges[MAX_EDGE_NUMBER]
Definition: simple_API.h:35
unsigned counter[N_THREADS]
Definition: data.c:3
Graph TheGraph
Definition: data.c:7
struct Edge Edge
General class used to describe a graph in PandA.
Definition: graph.hpp:771
size_t numVertices
Definition: simple_API.h:30
static size_t getOutDegree(Graph *graph, NodeId node)
Definition: simple_API.h:60
unsigned int EdgeId
Definition: simple_API.h:12
void loadGraph(char *InVertexFileName, char *OutVertexFileName, char *InEdgeFileName, char *OutEdgeFileName)
Definition: load_graph.c:10
EdgeId outEdgesIDs[MAX_VERTEX_NUMBER]
Definition: simple_API.h:32

Generated on Mon Feb 12 2024 13:02:47 for PandA-2024.02 by doxygen 1.8.13