Skip to content

Commit

Permalink
documentation for bridge detection
Browse files Browse the repository at this point in the history
  • Loading branch information
spirosmaggioros committed Jan 22, 2024
1 parent 3f327df commit 812b4f6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tutorial/graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ graph class algorithms:
- cycle
- topological_sort
- bipartite
- bridge
- visualize

weighted_graph class algorithms:
Expand All @@ -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.
Expand Down Expand Up @@ -102,6 +104,19 @@ if(g.bipartite()){
}
```

### **bridge**:
```cpp
#include <algoplus/graph>
graph<int> 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<std::vector<int>> bridges = g.bridge(1);
```
### **visualize**:
```cpp
#include <algoplus/graph>
Expand Down

0 comments on commit 812b4f6

Please sign in to comment.