1 | /* $Id$Revision: */ |
2 | /* vim:set shiftwidth=4 ts=8: */ |
3 | |
4 | /************************************************************************* |
5 | * Copyright (c) 2011 AT&T Intellectual Property |
6 | * All rights reserved. This program and the accompanying materials |
7 | * are made available under the terms of the Eclipse Public License v1.0 |
8 | * which accompanies this distribution, and is available at |
9 | * http://www.eclipse.org/legal/epl-v10.html |
10 | * |
11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ |
12 | *************************************************************************/ |
13 | |
14 | #ifndef RAWGRAPH_H |
15 | #define RAWGRAPH_H |
16 | |
17 | #include <cdt.h> |
18 | |
19 | typedef struct { |
20 | int color; |
21 | int topsort_order; |
22 | Dt_t* adj_list; /* adj_list */ |
23 | } vertex; |
24 | |
25 | typedef struct { |
26 | int nvs; |
27 | vertex* vertices; |
28 | } rawgraph; |
29 | |
30 | extern rawgraph* make_graph(int n); /* makes a graph with n vertices, 0 edges */ |
31 | extern void free_graph(rawgraph*); |
32 | /* inserts edge FROM v1 to v2 */ |
33 | extern void insert_edge(rawgraph*, int v1, int v2); |
34 | /* removes any edge between v1 to v2 -- irrespective of direction */ |
35 | extern void remove_redge(rawgraph*, int v1, int v2); |
36 | /* tests if there is an edge FROM v1 TO v2 */ |
37 | extern int edge_exists(rawgraph*, int v1, int v2); |
38 | /* topologically sorts the directed graph */ |
39 | extern void top_sort(rawgraph*); |
40 | |
41 | #endif |
42 | |