Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c4b203c

Browse files
committed
fix some images and links
1 parent 5d055db commit c4b203c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+108
-108
lines changed

src/graph/01_bfs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<!--?title 0-1 BFS -->
22
# 0-1 BFS
33

4-
It is well-known, that you can find the shortest paths between a single source and all other vertices in $O(|E|)$ using [Breadth First Search](./graph/breadth-first-search.html) in an **unweighted graph**, i.e. the distance is the minimal number of edges that you need to traverse from the source to another vertex.
4+
It is well-known, that you can find the shortest paths between a single source and all other vertices in $O(|E|)$ using [Breadth First Search](breadth-first-search.md) in an **unweighted graph**, i.e. the distance is the minimal number of edges that you need to traverse from the source to another vertex.
55
We can interpret such a graph also as a weighted graph, where every edge has the weight $1$.
6-
If not all edges in graph have the same weight, that we need a more general algorithm, like [Dijkstra](./graph/dijkstra.html) which runs in $O(|V|^2 + |E|)$ or $O(|E| \log |V|)$ time.
6+
If not all edges in graph have the same weight, that we need a more general algorithm, like [Dijkstra](dijkstra.md) which runs in $O(|V|^2 + |E|)$ or $O(|E| \log |V|)$ time.
77

88
However if the weights are more constrained, we can often do better.
99
In this article we demonstrate how we can use BFS to solve the SSSP (single-source shortest path) problem in $O(|E|)$, if the weight of each edge is either $0$ or $1$.

src/graph/2SAT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ b \Rightarrow a & \lnot b \Rightarrow \lnot a & b \Rightarrow \lnot a & c \Right
3535

3636
You can see the implication graph in the following image:
3737

38-
<center>!["Implication Graph of 2-SAT example"](&imgroot&/2SAT.png)</center>
38+
<center>!["Implication Graph of 2-SAT example"](2SAT.png)</center>
3939

4040
It is worth paying attention to the property of the implication graph:
4141
if there is an edge $a \Rightarrow b$, then there also is an edge $\lnot b \Rightarrow \lnot a$.
@@ -55,7 +55,7 @@ The following image shows all strongly connected components for the example.
5555
As we can check easily, neither of the four components contain a vertex $x$ and its negation $\lnot x$, therefore the example has a solution.
5656
We will learn in the next paragraphs how to compute a valid assignment, but just for demonstration purposes the solution $a = \text{false}$, $b = \text{false}$, $c = \text{false}$ is given.
5757

58-
<center>!["Strongly Connected Components of the 2-SAT example"](&imgroot&/2SAT_SCC.png)</center>
58+
<center>!["Strongly Connected Components of the 2-SAT example"](2SAT_SCC.png)</center>
5959

6060
Now we construct the algorithm for finding the solution of the 2-SAT problem on the assumption that the solution exists.
6161

File renamed without changes.
File renamed without changes.

src/graph/Assignment-problem-min-flow.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ The **assignment problem** has two equivalent statements:
77
- Given a square matrix $A[1..N, 1..N]$, you need to select $N$ elements in it so that exactly one element is selected in each row and column, and the sum of the values of these elements is the smallest.
88
- There are $N$ orders and $N$ machines. The cost of manufacturing on each machine is known for each order. Only one order can be performed on each machine. It is required to assign all orders to the machines so that the total cost is minimized.
99

10-
Here we will consider the solution of the problem based on the algorithm for finding the [minimum cost flow (min-cost-flow)](./graph/min_cost_flow.html), solving the assignment problem in $\mathcal{O}(N^5)$.
10+
Here we will consider the solution of the problem based on the algorithm for finding the [minimum cost flow (min-cost-flow)](min_cost_flow.md), solving the assignment problem in $\mathcal{O}(N^5)$.
1111

1212
## Description
1313

1414
Let's build a bipartite network: there is a source $S$, a drain $T$, in the first part there are $N$ vertices (corresponding to rows of the matrix, or orders), in the second there are also $N$ vertices (corresponding to the columns of the matrix, or machines). Between each vertex $i$ of the first set and each vertex $j$ of the second set, we draw an edge with bandwidth 1 and cost $A_{ij}$. From the source $S$ we draw edges to all vertices $i$ of the first set with bandwidth 1 and cost 0. We draw an edge with bandwidth 1 and cost 0 from each vertex of the second set $j$ to the drain $T$.
1515

1616
We find in the resulting network the maximum flow of the minimum cost. Obviously, the value of the flow will be $N$. Further, for each vertex $i$ of the first segment there is exactly one vertex $j$ of the second segment, such that the flow $F_{ij}$ = 1. Finally, this is a one-to-one correspondence between the vertices of the first segment and the vertices of the second part, which is the solution to the problem (since the found flow has a minimal cost, then the sum of the costs of the selected edges will be the lowest possible, which is the optimality criterion).
1717

18-
The complexity of this solution of the assignment problem depends on the algorithm by which the search for the maximum flow of the minimum cost is performed. The complexity will be $\mathcal{O}(N^5)$ using [Dijkstra](./graph/dijkstra.html) or $\mathcal{O}(N^6)$ using [Bellman-Ford](./graph/bellman_ford.html).
18+
The complexity of this solution of the assignment problem depends on the algorithm by which the search for the maximum flow of the minimum cost is performed. The complexity will be $\mathcal{O}(N^5)$ using [Dijkstra](dijkstra.md) or $\mathcal{O}(N^6)$ using [Bellman-Ford](bellman_ford.md).
1919

2020
## Implementation
2121

2222
The implementation given here is long, it can probably be significantly reduced.
23-
It uses the [SPFA algorithm](./graph/bellman_ford.html) for finding shortest paths.
23+
It uses the [SPFA algorithm](bellman_ford.md) for finding shortest paths.
2424

2525
```cpp
2626
const int INF = 1000 * 1000 * 1000;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)