1 # Graph implementation in C 2 ![example-output](https://user-images.githubusercontent.com/64109770/215203106-649a479e-c757-42c0-9acd-9bb4f719ab6c.png) 3 4 Simple graph data structure implementation in C using adjacency list. Featuring 5 graph output to stdout formatted in 6 [dot language](https://graphviz.org/doc/info/lang.html). 7 8 ## Compiling and running 9 10 ```shell 11 $ make -j $(nproc) 12 $ ./main 13 ``` 14 15 ## Example output 16 17 This is the output when using the `graph_print` function: 18 19 ```shell 20 strict graph G { 21 1 -- {2, 5} 22 2 -- {1, 3, 5} 23 3 -- {2, 4} 24 4 -- {3, 5, 6} 25 5 -- {1, 2, 4} 26 6 -- {4} 27 } 28 ``` 29 30 the output is formatted in dot language so it can be processed later by other 31 tools. Another function exists `graph_print_format` which does the same as 32 `graph_print` but adds graphviz attributes so it produces a nicer representation 33 of the graph when parsed with 34 [`dot`](https://graphviz.org/doc/info/command.html). 35 36 ## Generating a preview of the graph 37 38 First make sure you have [graphviz](https://graphviz.org/) package installed, 39 then just pipe the output of the program to `dot`: 40 41 ```shell 42 $ ./main | dot -T png -o out.png 43 ``` 44 45 this will generate a png file containing a nice representation of the graph. You 46 can open it with you preferred image viewer. 47 48 ## License 49 50 [MIT](https://opensource.org/licenses/MIT)