Contenu connexe
Similaire à spanning tree (20)
spanning tree
- 1. Script started on Fri Feb 21 23:07:09 2014
Script on a049418[1]% g++ s#panningTree.cpp
Script on a049418[2]% a.out
Script on a049418[4]% a.out
File successfully open
1 0 2 3 4 0 0 0 0 0 0 0 0 0 0 0
2 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0
3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4 1 0 3 0 5 6 7 0 0 0 0 0 0 0 0
5 1 2 3 4 0 6 7 8 0 0 0 0 0 0 0
6 1 2 3 0 5 0 0 0 0 0 0 0 0 0 0
7 1 2 0 4 5 0 0 0 0 0 0 0 0 0 0
8 0 0 0 0 0 0 0 0 0 10 0 12 13 14 15
9 1 2 3 4 5 0 0 0 0 0 0 0 0 0 0
10 1 2 0 0 0 0 0 0 0 0 11 0 0 0 0
11 0 2 3 0 0 0 0 0 0 0 0 0 0 0 0
12 1 2 0 4 5 6 0 0 0 0 0 0 0 0 0
13 1 0 3 4 0 0 0 0 0 0 0 0 0 0 0
14 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0
15 1 2 3 4 5 6 7 8 9 10 11 0 0 0 0
weight
1 0 0.333333 0.333333 0.333333 0 0 0 0 0 0 0 0 0 0 0
2 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4 0.2 0 0.2 0 0.2 0.2 0.2 0 0 0 0 0 0 0 0
5 0.142857 0.142857 0.142857 0.142857 0 0.142857 0.142857 0.142857 0 0 0 0 0 0 0
6 0.25 0.25 0.25 0 0.25 0 0 0 0 0 0 0 0 0 0
7 0.25 0.25 0 0.25 0.25 0 0 0 0 0 0 0 0 0 0
8 0 0 0 0 0 0 0 0 0 0.2 0 0.2 0.2 0.2 0.2
9 0.2 0.2 0.2 0.2 0.2 0 0 0 0 0 0 0 0 0 0
10 0.333333 0.333333 0 0 0 0 0 0 0 0 0.333333 0 0 0 0
11 0 0.5 0.5 0 0 0 0 0 0 0 0 0 0 0 0
12 0.2 0.2 0 0.2 0.2 0.2 0 0 0 0 0 0 0 0 0
13 0.333333 0 0.333333 0.333333 0 0 0 0 0 0 0 0 0 0 0
14 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
15 0.0909091 0.0909091 0.0909091 0.0909091 0.0909091 0.0909091 0.0909091 0.0909091
0.0909091 0.0909091 0.0909091 0 0 0 0
Output file is opened
spanning tree test is
Program prints 'visited' for each connected edge
edge 1 is visited
edge 2 is visited
edge 3 is visited
edge 4 is visited
edge 5 is visited
edge 6 is visited
edge 7 is visited
edge 8 is visited
edge 9 is visited
edge 10 is visited
edge 11 is visited
- 2. edge 12 is visited
edge 13 is visited
edge 14 is visited
edge 15 is visited
Spanning tree were built
Script on a049418[3]% cat input.txt
1 2
1 3
1 4
2 3
3 1
4 1
4 3
4 5
4 6
4 7
5 1
5 2
5 3
5 4
5 6
5 7
5 8
6 1
6 2
6 3
6 5
7 1
7 2
7 4
7 5
8 10
8 12
8 13
8 14
8 15
9 1
9 2
9 3
9 4
9 5
10 1
10 2
10 11
11 2
11 3
12 1
12 2
12 4
12 5
12 6
13 1
- 3. 13 3
13 4
14 4
15 1
15 2
15 3
15 4
15 5
15 6
15 7
15 8
15 9
15 10
15 11
Script on a049418[4]% cat o#utput.txt
{{ 0, 0, 1, 0.2, 0.14, 0.25, 0.25, 0, 0.2, 0.33, 0, 0.2, 0.33, 0, 0.091,}
{ 0.33, 0, 0, 0, 0.14, 0.25, 0.25, 0, 0.2, 0.33, 0.5, 0.2, 0, 0, 0.091,}
{ 0.33, 1, 0, 0.2, 0.14, 0.25, 0, 0, 0.2, 0, 0.5, 0, 0.33, 0, 0.091,}
{ 0.33, 0, 0, 0, 0.14, 0, 0.25, 0, 0.2, 0, 0, 0.2, 0.33, 1, 0.091,}
{ 0, 0, 0, 0.2, 0, 0.25, 0.25, 0, 0.2, 0, 0, 0.2, 0, 0, 0.091,}
{ 0, 0, 0, 0.2, 0.14, 0, 0, 0, 0, 0, 0, 0.2, 0, 0, 0.091,}
{ 0, 0, 0, 0.2, 0.14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.091,}
{ 0, 0, 0, 0, 0.14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.091,}
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.091,}
{ 0, 0, 0, 0, 0, 0, 0, 0.2, 0, 0, 0, 0, 0, 0, 0.091,}
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.33, 0, 0, 0, 0, 0.091,}
{ 0, 0, 0, 0, 0, 0, 0, 0.2, 0, 0, 0, 0, 0, 0, 0,}
{ 0, 0, 0, 0, 0, 0, 0, 0.2, 0, 0, 0, 0, 0, 0, 0,}
{ 0, 0, 0, 0, 0, 0, 0, 0.2, 0, 0, 0, 0, 0, 0, 0,}
{ 0, 0, 0, 0, 0, 0, 0, 0.2, 0, 0, 0, 0, 0, 0, 0,}
}Script on a049418[5]% ls
#[0m#[01;32ma.out#[0m* eigenvector.o main.cpp #[01;32mout#[0m*
spanningTree.cpp
eigenvector.cpp input.txt main.o output.txt spanningTree.log
#[mScript on a049418[6]% g##[K#out
6.963586e-01
2.781108e-01
5.933367e-01
2.634466e-01
8.660807e-02
6.581677e-02
6.531639e-02
1.240411e-02
2.276694e-04
2.718989e-03
1.128732e-03
2.491319e-03
2.491319e-03
2.491319e-03
2.491319e-03
Script on a049418[7]% out###ls#[K##cat output.txt#[27G#[Pin#[36G#[23Ga.out#[K#[23Gg++
- 4. spanningTree.cpp##
Script on a049418[8]% cat input.txt
1 2
1 3
1 4
2 3
2 4
3 1
4 1
4 3Script on a049418[9]% cat input.txt#[23Gg++
spanningTree.cpp#[23Gout#[K##[K##[K##[K####################ls##cat
output.txt#[27G#[Pin#[36G#[23Ga.out#[K#[23Gg++ spanningTree.cpp##[23Ga.out#[K
File successfully open
1 0 2 3 4 0 0 0 0 0 0 0 0 0 0 0
2 0 0 3 4 0 0 0 0 0 0 0 0 0 0 0
3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4 1 0 3 0 0 0 0 0 0 0 0 0 0 0 0
5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
13 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
weight
1 0 0.333333 0.333333 0.333333 0 0 0 0 0 0 0 0 0 0 0
2 0 0 0.5 0.5 0 0 0 0 0 0 0 0 0 0 0
3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4 0.5 0 0.5 0 0 0 0 0 0 0 0 0 0 0 0
5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
13 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Output file is opened
spanning tree test is
Program prints 'visited' for each connected edge
edge 1 is visited
edge 2 is visited
edge 3 is visited
edge 4 is visited
Spanning tree cannot be built
- 5. Script on a049418[10]% pico spa#nningTree.cpp
#[1;1H#[J#[7m UW PICO(tm) 4.10 New Buffer
#[27m#[23;1H#[K#[24;1H#[K#[23;1H#[7m^#[27m#[7mG#[27m Get Help
#[7m^#[27m#[7mO#[27m WriteOut #[7m^#[27m#[7mR#[27m Read File
#[7m^#[27m#[7mY#[27m Prev Pg #[7m^#[27m#[7mK#[27m Cut Text
#[7m^#[27m#[7mC#[27m Cur Pos #[K#[24;1H#[7m^#[27m#[7mX#[27m Exit
#[7m^#[27m#[7mJ#[27m Justify #[7m^#[27m#[7mW#[27m Where is #[7m^#[27m#[7mV#[27m
Next Pg #[7m^#[27m#[7mU#[27m UnCut Text#[7m^#[27m#[7mT#[27m To Spell
#[K#[3;1H#[22;1H#[K#[22;33H#[7m[ Reading file ]#[27m#[22;1H#[K#[22;32H#[7m[ Read 332
lines ]#[27m#[1;32H#[7mFile:
spanningTree.cpp#[27m#[3;1H#include<iostream>#[4;1H#include<string>#[5;1H#include
<fstream>#[6;1H#include <iomanip>#[7;1Husing namespace std;#[8;1Hconst int
NO_OF_ELEMENTS=16;#[9;1H/////////////////////// ///data structure//////////////#[10;1Hstruct
follower;#[11;1Hstruct follower#[12;1H{#[13;9Hint vertex;#[14;9Hint distance;#[15;9Hfollower*
NextFollower;#[16;1H};#[17;1Hstruct Leader#[18;1H{#[19;9Hint vertex;#[20;9Hbool
know;#[21;9Hint
distance;#[3;1H#[4;1H#[5;1H#[6;1H#[7;1H#[8;1H#[8;2H#[8;3H#[8;4H#[8;5H#[8;6H#[8;7H#[8;8
H#[8;9H#[8;10H#[8;11H#[8;12H#[8;13H#[8;14H#[8;15H#[8;16H#[8;17H#[8;18H#[8;19H#[8;20
H#[8;21H#[22;1H#[K#[8;22H#[8;23H#[8;24H#[8;25H#[8;26H#[8;27H#[8;28H#[1;70H#[7mModi
fied#[27m#[8;27H; #[8;27H#[8;26H; #[8;26H##[22;1H#[K#[22;31H#[7m[ #Unknown Command ]
#[27m#[8;26H##[22;1H#[K#[22;31H#[7m[ #Unknown Command ]
#[27m#[8;26H5;#[8;27H#[23;1H #[7mY#[27m Yes
#[K#[24;2H#[7mC#[27m Cancel #[7mN#[27m No
#[K#[22;1H#[K#[7mSave modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?
#[22;62H#[27m#[7mYes#[27m#[22;1H#[K#[7mFile Name to write :
#[22;22H#[27m#[7mspanningTree.cpp#[27m#[23;1H#[7m^#[27m#[7mG#[27m Get Help
#[7m^#[27m#[7mT#[27m To Files
#[K#[24;14H#[7mT#[27m#[7mA#[27m#[7mB#[27m Complete
#[K#[7m#[22;38H#[27m#[22;1H#[K#[22;34H#[7m[ Writing... ]
#[27m#[22;1H#[K#[22;31H#[7m[ Wrote 332 lines ]#[27m#[23;1H#[K#[24;1H#[KScript on
a049418[11]% pico spanningTree.cpp#[24Ga.out#[K#[24Gcat input.txt#[24Gg++
spanningTree.cpp
Script on a049418[12]% g++ spanningTree.cpp#[24G#[1@pico#[45G#[24Ga.out#[K
File successfully open
1 0 2 3 4
2 0 0 3 4
3 1 0 0 0
4 1 0 3 0
weight
1 0 0.333333 0.333333 0.333333
2 0 0 0.5 0.5
3 1 0 0 0
4 0.5 0 0.5 0
Output file is opened
spanning tree test is
Program prints 'visited' for each connected edge
edge 1 is visited
edge 2 is visited
edge 3 is visited
edge 4 is visited
Spanning tree were built
Script on a049418[13]% o##[Kcay##[Kt ou#tput.txt
- 6. {{ 0, 0, 1, 0.5,}
{ 0.33, 0, 0, 0,}
{ 0.33, 0.5, 0, 0.5,}
{ 0.33, 0.5, 0, 0,}
}Script on a049418[14]% exit
exit
Script done on Fri Feb 21 23:15:20 2014
- 7. {{ 0, 0, 1, 0.5,}
{ 0.33, 0, 0, 0,}
{ 0.33, 0.5, 0, 0.5,}
{ 0.33, 0.5, 0, 0,}
}Script on a049418[14]% exit
exit
Script done on Fri Feb 21 23:15:20 2014