Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
rawgraph.h
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (c) 2011 AT&T Intellectual Property
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors: Details at https://graphviz.org
9 *************************************************************************/
10
11#pragma once
12
13#include <cgraph/list.h>
14#include <stdbool.h>
15#include <stddef.h>
16
17DEFINE_LIST(adj_list, size_t)
18
19typedef struct {
20 int color;
22 adj_list_t adj_list;
23} vertex;
24
25typedef struct {
26 size_t nvs;
28} rawgraph;
29
31rawgraph *make_graph(size_t n);
32
33extern void free_graph(rawgraph*);
34
36void insert_edge(rawgraph *, size_t v1, size_t v2);
37
39void remove_redge(rawgraph *, size_t v1, size_t v2);
40
42bool edge_exists(rawgraph *, size_t v1, size_t v2);
43
44 /* topologically sorts the directed graph */
45extern void top_sort(rawgraph*);
#define DEFINE_LIST(name, type)
Definition list.h:26
void remove_redge(rawgraph *, size_t v1, size_t v2)
removes any edge between v1 to v2 – irrespective of direction
Definition rawgraph.c:46
void free_graph(rawgraph *)
Definition rawgraph.c:32
rawgraph * make_graph(size_t n)
makes a graph with n vertices, 0 edges
Definition rawgraph.c:21
void insert_edge(rawgraph *, size_t v1, size_t v2)
inserts edge FROM v1 to v2
Definition rawgraph.c:40
bool edge_exists(rawgraph *, size_t v1, size_t v2)
tests if there is an edge FROM v1 TO v2
Definition rawgraph.c:55
void top_sort(rawgraph *)
Definition rawgraph.c:80
size_t nvs
Definition rawgraph.h:26
vertex * vertices
Definition rawgraph.h:27
Definition legal.c:31
int topsort_order
Definition rawgraph.h:21
adj_list_t adj_list
adjacency list
Definition rawgraph.h:22
int color
Definition rawgraph.h:20