From 812b4f678c4ec3aa8ccc75c85c53bbd0dd8db358 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 22 Jan 2024 21:44:02 +0200 Subject: [PATCH] documentation for bridge detection --- tutorial/graph.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tutorial/graph.md b/tutorial/graph.md index 26574d76..44367f9a 100644 --- a/tutorial/graph.md +++ b/tutorial/graph.md @@ -9,6 +9,7 @@ graph class algorithms: - cycle - topological_sort - bipartite + - bridge - visualize weighted_graph class algorithms: @@ -20,6 +21,7 @@ weighted_graph class algorithms: - topological_sort - prim - bipartite + - bridge - visualize There are also some functions for both classes like **has_edge(u, v)** that checks if an edge exists from node u to node v, **size()** that returns the number of elements in the graph, **empty()** that checks if a graph is empty and **empty()** that empties the graph. @@ -102,6 +104,19 @@ if(g.bipartite()){ } ``` +### **bridge**: +```cpp +#include +graph g("undirected"); +g.add_edge(1, 4); +g.add_edge(4, 5); +g.add_edge(5, 2); +g.add_edge(2, 8); + +//returns the bridges of the graph(works with weighted graph as well). +std::vector> bridges = g.bridge(1); +``` + ### **visualize**: ```cpp #include