summaryrefslogtreecommitdiffstats
path: root/web/server/h2o/libh2o/deps/klib/test/kgraph_test.c
blob: 3da1cd71b155e7258a6f42ca4e140b62665dd029 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <stdio.h>
#include "kgraph.h"

KHASH_INIT2(e32, extern, uint32_t, int, 1, kh_int_hash_func, kh_int_hash_equal)

typedef struct {
	int i;
	khash_t(e32) *_arc;
} vertex_t;

KGRAPH_INIT(g, extern, vertex_t, int, e32)
KGRAPH_PRINT(g, extern)

int main()
{
	int *pb, *pe;
	kgraph_t(g) *g;
	g = kg_init_g();
	kg_put_a_g(g, 10, 20, 0, &pb, &pe);
	kg_put_a_g(g, 20, 30, 0, &pb, &pe);
	kg_put_a_g(g, 30, 10, 1, &pb, &pe);
	kg_del_v_g(g, 20);
	kg_print_g(g);
	kg_destroy_g(g);
	return 0;
}