Graphviz 13.0.0~dev.20241212.1010
Loading...
Searching...
No Matches
simple.c
Go to the documentation of this file.
1
4
5/*************************************************************************
6 * Copyright (c) 2011 AT&T Intellectual Property
7 * All rights reserved. This program and the accompanying materials
8 * are made available under the terms of the Eclipse Public License v1.0
9 * which accompanies this distribution, and is available at
10 * https://www.eclipse.org/legal/epl-v10.html
11 *
12 * Contributors: Details at https://graphviz.org
13 *************************************************************************/
14
15#include <graphviz/gvc.h>
16#include <stddef.h>
17#include <stdio.h>
18
19int main(int argc, char **argv) {
20
21 GVC_t *gvc = gvContext();
22
23 FILE *fp;
24 if (argc > 1)
25 fp = fopen(argv[1], "r");
26 else
27 fp = stdin;
28 graph_t *g = agread(fp, NULL);
29
30 gvLayout(gvc, g, "dot");
31
32 gvRender(gvc, g, "plain", stdout);
33
34 gvFreeLayout(gvc, g);
35
36 agclose(g);
37
38 return gvFreeContext(gvc);
39}
node NULL
Definition grammar.y:163
int agclose(Agraph_t *g)
deletes a graph, freeing its associated storage
Definition graph.c:102
Agraph_t * agread(void *chan, Agdisc_t *disc)
constructs a new graph
Definition grammar.c:2293
int gvFreeLayout(GVC_t *gvc, graph_t *g)
Definition gvlayout.c:105
int gvLayout(GVC_t *gvc, graph_t *g, const char *engine)
Definition gvc.c:52
GVC_t * gvContext(void)
Definition gvc.c:24
int gvRender(GVC_t *gvc, graph_t *g, const char *format, FILE *out)
Definition gvc.c:84
int gvFreeContext(GVC_t *gvc)
Definition gvcontext.c:64
static GVC_t * gvc
Definition gv.cpp:23
graph or subgraph
Definition cgraph.h:425
Definition gvcint.h:80
int main()