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