Skip to content

Korea University 2016-01 Data Structure(Class 02) Term

Notifications You must be signed in to change notification settings

wltjr1007/WordTweet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WordTweet Manual

######Korea University 2016-01 Data Structure(Class 02) Term Project. ######Yoon Jee Seok(윤지석) 2012210073

##Project Description WordTweet is similar to Twitter, but it can only accept one word.

It has various search, delete, graph functions. However, input is manually inserted into the data file.

###Requirements Python 3 ##General description ###Data file user.txt contains user profile containing ID #, sign up date, nickname in three parts.

Example

433072426
Sat Dec 10 03:28:31 +0000 2011
qhals0086

174670917
Wed Aug 04 14:30:51 +0000 2010
soloist_shin

friends.txt contains friendship information in two parts.

Example

313426093
323060839

313426093
107145933

word.txt contains tweets in three parts. It contains user ID, date, content.

Example

433072426
Sat Mar 17 14:31:34 +0000 2012
그건

433072426
Sat Mar 17 14:31:34 +0000 2012
혼자만의

##Functions ###Prompt

0. Read data files
1. Display statistics
2. Top 5 most tweeted words
3. Top 5 most tweeted users
4. Find users who tweeted a word (e.g., ’연세대’)
5. Find all people who are friends of the above users
6. Delete all mentions of a word
7. Delete all users who mentioned a word
8. Find strongly connected components
9. Find shortest path from a given user
99. Quit
Select Menu:

Input: 0~9, 99

Output: Various

###Function Description ####0. Read data files Read records from data files and print # of users, frienship, tweets.

Example Input:

Path for User Profile file (Default: .\user.txt): C:\xxx\user.txt
Path for Friendship file (Default: .\friend.txt): C:\xxx\friend.txt
Path for Word Tweet file (Default: .\word.txt): C:\xxx\word.txt

Example Output:

Total users: xxx
Total friendship records (excluding duplicates): xxx
Total tweets: xxx

####1. display statistics Read and analyze data and display average, minimum, maximum of each data.

Example output:

Average number of friends: xxx
Minimum friends: xxx
Maximum number of friends: xxx
Average tweets per user: xxx
Minium tweets per user: xxx
Maximum tweets per user: xxx

####2. Top 5 most tweeted words Print the 5 most tweeted words in order. If # of different tweet is less than 5, only display that amount of tweet.

Example output:

Top 5 most tweeted words
1. ['xxxxx', xx]
2. ['xxxxx', xx]
3. ['xxxxx', xx]
4. ['xxxxx', xx]
5. ['xxxxx', xx]

####3. Top 5 most tweeted users Print the 5 most tweeted users in order. If # of users is less than 5, only display that amount of tweet.

Example output:

Top 5 most tweeted users [ID #, nickname, tweet count]
1 . [456476773, 'luvchandeul', 45]
2 . [60220613, 'rohgrang', 41]
3 . [297106356, 'wls2808', 40]
4 . [165478556, 'akaqlc', 39]
5 . [217803288, '_911027', 39]

####4. Find users who tweeted a word (e.g., ’연세대’) Print users who tweeted a word.

Example input

Input a word to search:ㅋㅋㅋㅋㅋ

Example output:

These users tweeted the word ㅋㅋㅋㅋㅋ
1 . 225753656 Pink_NonSook
2 . 469109354 infinite2010_
3 . 361267968 lionsrules
4 . 294108100 skylove90876

####5. Find all people who are friends of the above users Print friends of a user.

Example output:

Friends of users searched in Function #4.
1 . ( 225753656 Pink_NonSook )'s friends are : [142989083, 181371198, 195027763, 269216781, 298994094, 360688803, 410902968, 428833283, 456476773, 496012126]
2 . ( 469109354 infinite2010_ )'s friends are : [189914712, 234699394, 388340593, 401493206, 428833283, 433322045, 446189166, 446199877, 493051189]
3 . ( 361267968 lionsrules )'s friends are : [143014771, 162002335, 181371198, 251608342, 355326530, 421089550, 422359825, 461879947, 463769129, 477890996]
4 . ( 294108100 skylove90876 )'s friends are : [113200585, 165478556, 206646411, 269216781, 279311945, 434521399, 437524660, 455504268, 493051189, 501576189]

####6. Delete all mentions of a word Delete all tweets of a word.

Example input

Input a word to delete:ㅋㅋㅋ

Example output:

18 tweets deleted.

####7. Delete all users who mentioned a word Delete all tweets of a word.

Example input

Input a word to delete users who tweeted it:ㅋㅋㅋ

Example output:

Deleting user id [149073571, 203485077, 219241221, 229926622, 234699394, 235514475, 241424851, 343831549, 358790822, 381997754, 395186812, 405387693, 423091464, 437524660, 448062359, 468163169, 491963952] from friendship, tweets, and user profile.

####8. Find strongly connected components Find Strongly Connected Components and display only top 5 that has the biggest Strongly Connected Components.

Top 5 SCC
1 .319299609 456476773 395763758 353421862 445595750 217803288 494247491 521543311 350622224 225753656 360688803 290621479 115294226 375160363 206848012 368239324 285563508 265145029 488473313 354628783 490440290 446189166 450730276 485828726 206646411 493113491 494757793 400796772 430609056 454514286 215215359 448427743 277475041 300137579 279311945 45509813 422359825 457466031 445488814 172656897 460898954 469109354 189914712 234263625 399468775 361267968 355326530 152223499 526562079 463769129 465227917 150850727 60220613 477482057 270664489 395826355 167635608 469926743 412986997 414676739 436685991 384138094 488629566 420357930 344472808 436560092 388340593 162002335 244371363 356885748 90375441 481901489 251608342 401493206 493051189 206179608 356186381 431347948 409632468 110151414 416821451 231850863 433072426 516539796 346490646 302048490 432323065 181371198 146217198 116648173 142989083 298994094 161724208 195027763 525209403 382053881 351605665 490141958 496012126 497109769 183990604 472713562 210410304 434521399 248557567 458095548 410902968 358531435 294108100 455504268 244165466 421089550 373248331 143014771 254405984 173846834 413756265 345786756 480434641 379467184 399216608 478561189 432546298 235904473 477890996 256906097 416738787 501576189 285599631 221778890 113200585 371835256 242682849 302427576 440702915 419584442 521366990 159411137 406041477 399303136 297106356 179090391 428833283
2 .281005065 269216781 165478556 95318066 445595750 217803288 494247491 521543311 350622224 225753656 360688803 290621479 115294226 375160363 206848012 368239324 285563508 265145029 488473313 354628783 490440290 446189166 450730276 485828726 206646411 493113491 494757793 400796772 430609056 454514286 215215359 448427743 277475041 300137579 279311945 45509813 422359825 457466031 445488814 172656897 460898954 469109354 189914712 234263625 399468775 361267968 355326530 152223499 526562079 463769129 465227917 150850727 60220613 477482057 270664489 395826355 167635608 469926743 412986997 414676739 436685991 384138094 488629566 420357930 344472808 436560092 388340593 162002335 244371363 356885748 90375441 481901489 251608342 401493206 493051189 206179608 356186381 431347948 409632468 110151414 416821451 231850863 433072426 516539796 346490646 302048490 432323065 181371198 146217198 116648173 142989083 298994094 161724208 195027763 525209403 382053881 351605665 490141958 496012126 497109769 183990604 472713562 210410304 434521399 248557567 458095548 410902968 358531435 294108100 455504268 244165466 421089550 373248331 143014771 254405984 173846834 413756265 345786756 480434641 379467184 399216608 478561189 432546298 235904473 477890996 256906097 416738787 501576189 285599631 221778890 113200585 371835256 242682849 302427576 440702915 419584442 521366990 159411137 406041477 399303136 297106356 179090391 428833283
3 .310828049 174670917 165478556 95318066 445595750 217803288 494247491 521543311 350622224 225753656 360688803 290621479 115294226 375160363 206848012 368239324 285563508 265145029 488473313 354628783 490440290 446189166 450730276 485828726 206646411 493113491 494757793 400796772 430609056 454514286 215215359 448427743 277475041 300137579 279311945 45509813 422359825 457466031 445488814 172656897 460898954 469109354 189914712 234263625 399468775 361267968 355326530 152223499 526562079 463769129 465227917 150850727 60220613 477482057 270664489 395826355 167635608 469926743 412986997 414676739 436685991 384138094 488629566 420357930 344472808 436560092 388340593 162002335 244371363 356885748 90375441 481901489 251608342 401493206 493051189 206179608 356186381 431347948 409632468 110151414 416821451 231850863 433072426 516539796 346490646 302048490 432323065 181371198 146217198 116648173 142989083 298994094 161724208 195027763 525209403 382053881 351605665 490141958 496012126 497109769 183990604 472713562 210410304 434521399 248557567 458095548 410902968 358531435 294108100 455504268 244165466 421089550 373248331 143014771 254405984 173846834 413756265 345786756 480434641 379467184 399216608 478561189 432546298 235904473 477890996 256906097 416738787 501576189 285599631 221778890 113200585 371835256 242682849 302427576 440702915 419584442 521366990 159411137 406041477 399303136 297106356 179090391 428833283
4 .504650783 521254409 95318066 445595750 217803288 494247491 521543311 350622224 225753656 360688803 290621479 115294226 375160363 206848012 368239324 285563508 265145029 488473313 354628783 490440290 446189166 450730276 485828726 206646411 493113491 494757793 400796772 430609056 454514286 215215359 448427743 277475041 300137579 279311945 45509813 422359825 457466031 445488814 172656897 460898954 469109354 189914712 234263625 399468775 361267968 355326530 152223499 526562079 463769129 465227917 150850727 60220613 477482057 270664489 395826355 167635608 469926743 412986997 414676739 436685991 384138094 488629566 420357930 344472808 436560092 388340593 162002335 244371363 356885748 90375441 481901489 251608342 401493206 493051189 206179608 356186381 431347948 409632468 110151414 416821451 231850863 433072426 516539796 346490646 302048490 432323065 181371198 146217198 116648173 142989083 298994094 161724208 195027763 525209403 382053881 351605665 490141958 496012126 497109769 183990604 472713562 210410304 434521399 248557567 458095548 410902968 358531435 294108100 455504268 244165466 421089550 373248331 143014771 254405984 173846834 413756265 345786756 480434641 379467184 399216608 478561189 432546298 235904473 477890996 256906097 416738787 501576189 285599631 221778890 113200585 371835256 242682849 302427576 440702915 419584442 521366990 159411137 406041477 399303136 297106356 179090391 428833283
5 .119337132 179747403 494247491 521543311 350622224 225753656 360688803 290621479 115294226 375160363 206848012 368239324 285563508 265145029 488473313 354628783 490440290 446189166 450730276 485828726 206646411 493113491 494757793 400796772 430609056 454514286 215215359 448427743 277475041 300137579 279311945 45509813 422359825 457466031 445488814 172656897 460898954 469109354 189914712 234263625 399468775 361267968 355326530 152223499 526562079 463769129 465227917 150850727 60220613 477482057 270664489 395826355 167635608 469926743 412986997 414676739 436685991 384138094 488629566 420357930 344472808 436560092 388340593 162002335 244371363 356885748 90375441 481901489 251608342 401493206 493051189 206179608 356186381 431347948 409632468 110151414 416821451 231850863 433072426 516539796 346490646 302048490 432323065 181371198 146217198 116648173 142989083 298994094 161724208 195027763 525209403 382053881 351605665 490141958 496012126 497109769 183990604 472713562 210410304 434521399 248557567 458095548 410902968 358531435 294108100 455504268 244165466 421089550 373248331 143014771 254405984 173846834 413756265 345786756 480434641 379467184 399216608 478561189 432546298 235904473 477890996 256906097 416738787 501576189 285599631 221778890 113200585 371835256 242682849 302427576 440702915 419584442 521366990 159411137 406041477 399303136 297106356 179090391 428833283

####9. Find shortest path from a given user Find the shortest path from a given user to all other users and display only top 5 users with highest path cost.

Example Input

Input a user id to find shortest path for all other users: 246546356

Example Output

Top 5 users with hightest path cost
1 .319299609 200
2 .281005065 190
3 .310828049 180
4 .504650783 180
5 .119337132 170

####99. Quit End the program.

About

Korea University 2016-01 Data Structure(Class 02) Term

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages