appendix - core

6
APPENDIX Main Program from operator import itemgetter from StrukturData import DataStructure class KruskalJaringan: def __init__(self, parent):     Frame.__init__(self, parent)     self.window = parent     def ConvertNodes(string):        hasil = list(string.split(","))        return hasil  def ConvertEdges(string):        hasil = list(string.split(";"))        return hasil         def parse_tuple(string):        try:            s = eval(str(string)) A

Upload: others

Post on 06-Feb-2022

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: APPENDIX - CORE

APPENDIX

Main Program

from operator import itemgetter 

from StrukturData import DataStructure 

class KruskalJaringan: 

def __init__(self, parent): 

    Frame.__init__(self, parent) 

    self.window = parent 

    

def ConvertNodes(string): 

         hasil = list(string.split(",")) 

         return hasil 

 

def ConvertEdges(string): 

         hasil = list(string.split(";")) 

         return hasil 

      

     def parse_tuple(string): 

         try: 

            s = eval(str(string)) 

A

Page 2: APPENDIX - CORE

         if type(s) == tuple: 

             return s 

         return 

         except: 

         return 

    

def kruskal( nodes, edges): 

    jmlnodes = len(nodes) ­ 1 

    counter = 0 

    total = 0 

    meter = float 

         

    struktur = DataStructure() 

    mst = [] 

    for n in nodes: 

 struktur.add( n ) 

 #print n        

    if counter == jmlnodes:

#check counter 

return mst 

      

    for e in sorted( edges, key=itemgetter( 2

) ): 

B

Page 3: APPENDIX - CORE

 n1, n2, x = e 

 t1 = struktur.find(n1) 

 t2 = struktur.find(n2) 

        

 if t1 != t2: 

     mst.append(e) 

     total = total + x 

     #meter = total/100 

     counter = counter + 1 

     if counter == jmlnodes: #proses

berhenti 

          print

'==================================================' 

         print 'Total panjang kabel

=', total,'kilometer /'#, meter,'meter' 

          print   'Total   jumlah   sisi

yang terpilih = ', counter,'sisi' 

         print 'Dengan rincian jalur

sebagai berikut :' 

        return mst 

     

     struktur.union(t1, t2) 

 

C

Page 4: APPENDIX - CORE

 

datanodes = open('nodes.txt', 'r') # 

str1 = datanodes.read().rstrip("\n") # 

nodes = (ConvertNodes(str1)) #   DATA

NODES 

dataedges = open('edges.txt', 'r') # 

str2 = dataedges.read().rstrip("\n") # 

edges = (ConvertEdges(str2)) #   DATA

EDGES 

#print type(edges)         

index = 0 

#print edges 

for name in edges: 

edges[index]=edges[index].lstrip("

").rstrip(" ") 

edges[index]=edges[index].lstrip("(").rstrip(")") 

edges[index]=parse_tuple(edges[index]) 

index += 1 

   

 

print kruskal( nodes, edges )

D

Page 5: APPENDIX - CORE

Data Nodes

v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14,v15,v16,v17,v18,v19,v20,v21,v

22,v23,v24,v25,v26,v27,v28,v29,v30,v31,v32,v33,v34,v35,v36,v37,v38,v39,v40,

v41,v42,v43,v44,v45,v46,v47,v48,v49,v50

Data Edges

('v1', 'v2', 150); ('v1', 'v50', 1870); ('v2', 'v3', 20); ('v3', 'v4', 20); ('v4', 'v5', 20);

('v5', 'v6', 280); ('v6', 'v7', 40); ('v7', 'v8', 550); ('v8', 'v9', 40); ('v9', 'v10', 550);

('v10', 'v11', 40); ('v11', 'v12', 550); ('v12', 'v13', 40); ('v13', 'v14', 550); ('v14',

'v15', 40); ('v15', 'v19', 1860); ('v15', 'v29', 3150); ('v16', 'v17', 40); ('v17', 'v18',

40); ('v18', 'v23', 720); ('v19', 'v20', 40); ('v20', 'v21', 40);('v21', 'v22', 40); ('v22',

'v16', 70); ('v22', 'v23', 850); ('v23', 'v24', 20); ('v24', 'v25', 20); ('v25', 'v26', 590);

('v25', 'v30', 200); ('v26', 'v27', 40); ('v27', 'v28', 40); ('v28', 'v29', 40); ('v30', 'v36',

660); ('v31', 'v26', 450); ('v31', 'v32', 40); ('v32', 'v33', 40); ('v33', 'v34', 150);

('v34', 'v35', 40); ('v35', 'v36', 640); ('v36', 'v37', 520); ('v37', 'v38', 180); ('v38',

'v39', 370);('v39', 'v40', 40); ('v40', 'v41', 30); ('v41', 'v42', 250); ('v42', 'v43', 40);

('v43', 'v44', 20); ('v44', 'v45', 30); ('v45', 'v46', 480); ('v45', 'v48', 400); ('v46',

'v47', 40); ('v47', 'v49', 790); ('v49', 'v50', 40); ('v50', 'v48', 600)

E

Page 6: APPENDIX - CORE

F

98% Originality

2% Similarity

95 Sources

Doc vs Internet + Library

Web sources: 85 sources found

1. https://journal.unnes.ac.id/sju/index.php/ujm/article/view/7418/5135 0.56%

2. http://intranet.nbme.org/research/grantsawarded.html 0.27%

3. http://www.nbme.org/research/grantsawarded.html 0.27%

4. http://www.studymode.com/subjects/accreditation-task-3-page1.html 0.27%

5. http://archive.unu.edu/unupress/unupbooks/80473e/80473E0f.htm 0.27%

6. http://www.studymode.com/subjects/task-310-2-3-08-develop-an-ethics-program-page1.html 0.27%

7. http://www.studymode.com/subjects/construct-a-project-charter-to-revamp-the-compensation-and-b…0.27%

8. https://portal.nifa.usda.gov/web/areera/Reports/2006/ND/Combined.ND.doc 0.27%

9. http://www.studymode.com/subjects/why-does-the-cost-of-equity-increase-with-an-increased-use-o…0.27%

10. http://www.readbag.com/aiaa-daycin-sites-default-files-2011-bookofabstracts 0.27%

11. https://nepis.epa.gov/Exe/ZyPURL.cgi?Dockey=9100QYD4.TXT 0.27%

12. https://reeis.usda.gov/web/areera/Reports/2006/ND/Combined.ND.doc 0.27%

13. http://docshare.tips/psychological-symptoms_5892cbedb6d87fa80b8b492d.html 0.27%

14. https://www.acq.osd.mil/osbp/sbir//solicitations/sbir19911/navy911.htm 0.27%

15. http://www.sefi.org/register/titlecheck.php?x=0 0.27%

16. https://www.nursingcenter.com/journalarticle?Article_ID=1505534 0.27%

17. http://www.gmu.edu/schools/chss/dacce/abstracts.html 0.27%

18. https://www.science.gov/topicpages/m/modified+wingate+tests.html 0.27%

19. http://www.virtualsciencefair.org/display2003/PublicDisplay2013.asp 0.27%

20. https://www.science.gov/topicpages/g/genetic+algorithm+bga.html 0.27%

21. https://libguides.msoe.edu/thesis/mse 0.27%

22. https://training.fema.gov/hiedu/docs/grist%20-%20dissertation%20-%20changing%20pradigm%2…0.27%

23. http://www.studymode.com/subjects/huntsville-project-charter-user-acceptance-criteria-quality-pa…0.27%

24. https://ascpt.onlinelibrary.wiley.com/doi/full/10.1111/cts.12047 0.27%

25. https://www.studymode.com/subjects/mgt2-genrays-project-charter-essay-hris-page1.html 0.27%

26. https://nbme.org/research/grantsawarded.html 0.27%

27. http://www.uu.edu/events/uuss/2016/SymposiumProgram_Web.pdf 0.27%

28. http://www.health.ny.gov/statistics/sparcs/dgc/appr_data_req.htm 0.27%

29. https://www.e-education.psu.edu/geog862/print/l7.html 0.27%

30. http://www.studymode.com/subjects/amt-task-3-service-line-page1.html 0.27%

31. http://www.gmu.edu/lahs/dacce/abstracts.html 0.27%

32. https://studentsimple.com/tag/differences 0.27%

33. https://www.health.ny.gov/statistics/sparcs/dgc/appr_data_req.htm 0.27%

34. http://www.studymode.com/subjects/mgt2-genrays-project-charter-essay-hris-page1.html 0.27%

14K10048- Yunianto

Bagas

Uploaded: 07/24/2018

Checked: 07/24/2018

Similarity

Similarity from a chosen source

Possible character replacementabc

Citation

References