[parser] using a bipartite graph (indptr + indices) to represent postal code<=>admin relationships instead of a set of 64-bit ints. Requires |V(postal codes)| + |E| 32 bit ints instead of |E| 64 bit ints. Saves several hundred MB in file size and even more space in memory because of the hashtable overhead
This commit is contained in:
@@ -27,6 +27,7 @@ Currently we're not implementing edge types, graph traversal, etc.
|
||||
#include "collections.h"
|
||||
#include "file_utils.h"
|
||||
#include "vector.h"
|
||||
#include "vector_math.h"
|
||||
|
||||
typedef enum {
|
||||
GRAPH_DIRECTED,
|
||||
@@ -55,8 +56,11 @@ void graph_clear(graph_t *self);
|
||||
void graph_append_edge(graph_t *self, uint32_t col);
|
||||
void graph_append_edges(graph_t *self, uint32_t *col, size_t n);
|
||||
|
||||
void graph_finalize_vertex_no_sort(graph_t *self);
|
||||
void graph_finalize_vertex(graph_t *self);
|
||||
|
||||
bool graph_has_edge(graph_t *self, uint32_t i, uint32_t j);
|
||||
|
||||
bool graph_write(graph_t *self, FILE *f);
|
||||
bool graph_save(graph_t *self, char *path);
|
||||
graph_t *graph_read(FILE *f);
|
||||
|
||||
Reference in New Issue
Block a user