graphunidirected graph implementation using adjacency list |
Mode | Name | Size |
-rw-r--r-- | LICENSE | 21L |
-rw-r--r-- | Makefile | 21L |
-rw-r--r-- | README.md | 50L |
-rw-r--r-- | main.c | 283L |
-rw-r--r-- | queue.c | 64L |
-rw-r--r-- | queue.h | 29L |
-rw-r--r-- | stack.c | 44L |
-rw-r--r-- | stack.h | 25L |
Simple graph data structure implementation in C using adjacency list. Featuring graph output to stdout formatted in dot language.
$ make -j $(nproc)
$ ./main
This is the output when using the graph_print
function:
strict graph G {
1 -- {2, 5}
2 -- {1, 3, 5}
3 -- {2, 4}
4 -- {3, 5, 6}
5 -- {1, 2, 4}
6 -- {4}
}
the output is formatted in dot language so it can be processed later by other
tools. Another function exists graph_print_format
which does the same as
graph_print
but adds graphviz attributes so it produces a nicer representation
of the graph when parsed with
dot
.
First make sure you have graphviz package installed,
then just pipe the output of the program to dot
:
$ ./main | dot -T png -o out.png
this will generate a png file containing a nice representation of the graph. You can open it with you preferred image viewer.