mirror of
https://github.com/fverdugo/XM_40017.git
synced 2025-11-08 22:44:23 +01:00
Finish todo in asp notebook
This commit is contained in:
parent
9372448ef5
commit
aa26119f34
@ -31,7 +31,7 @@
|
||||
"id": "ade31d26",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## The all pairs of shortest paths (ASP) problem\n",
|
||||
"## The All Pairs of Shortest Paths (ASP) problem\n",
|
||||
"\n",
|
||||
"Let us start by presenting the all pairs of shortest paths (ASP) problem and its solution with the [Floyd–Warshall algorithm](https://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm).\n",
|
||||
"\n",
|
||||
@ -70,10 +70,21 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 1,
|
||||
"id": "4fe447c5",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"floyd! (generic function with 1 method)"
|
||||
]
|
||||
},
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"function floyd!(C)\n",
|
||||
" n = size(C,1)\n",
|
||||
@ -99,10 +110,25 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 2,
|
||||
"id": "860e537c",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"4×4 Matrix{Int64}:\n",
|
||||
" 0 9 6 1\n",
|
||||
" 2 0 8 3\n",
|
||||
" 5 3 0 6\n",
|
||||
" 10 8 5 0"
|
||||
]
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"inf = 1000\n",
|
||||
"C = [\n",
|
||||
@ -296,7 +322,7 @@
|
||||
"id": "db9a3294",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"TODO explain this part"
|
||||
"At each iteration, the processor needs the input values `C[i,j]`, `C[i,k]` and `C[k,j]`. Since we split the data row-wise, the process already has values `C[i,j]` and `C[i,k]`. However, `C[k,j]` may be stored in a different process. "
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -314,6 +340,14 @@
|
||||
"</div>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "a01872ef",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"As we iterate over columns $j$, the process needs input from all values of row $k$. Therefore, at the start of iteration $k$, the whole row $k$ needs to be communicated."
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {
|
||||
"g12957.png": {
|
||||
@ -634,7 +668,7 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Julia 1.9.0",
|
||||
"display_name": "Julia 1.9.1",
|
||||
"language": "julia",
|
||||
"name": "julia-1.9"
|
||||
},
|
||||
@ -642,7 +676,7 @@
|
||||
"file_extension": ".jl",
|
||||
"mimetype": "application/julia",
|
||||
"name": "julia",
|
||||
"version": "1.9.0"
|
||||
"version": "1.9.1"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user