Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Lab_III_3_24_11_2020
#python 3.6.9 print ("Hello, world!") print("i like this subject but i do understand well ") # Anand Panchal has started it all. graph = { "a" : ["c"], "b" : ["c", "e"], "c" : ["a", "b", "d", "e"], "d" : ["c"], "e" : ["c", "b"], "f" : [] } print(graph ["c"]) #Arman Kitarov print(graph.keys()) for key in graph: print(key, graph[key]) #Brian Bvunza def generate_edges(graph): edges = [] no_app = 0 for node in graph: for neighbour in graph[node]: edges.append((node, neighbour)) no_app += 1 print("Total numbers of appends: ", no_app) return edges print(generate_edges(graph)) #Eldiiar Sourbaev 48273 graph1 = { "1" : [], "2" : [], "3" : [], "4" : [] } print(generate_edges(graph1)) #Fatih Demir 47926 #I drew 2 graphs (Gaous Saklaen) graph2 = { "a" : ["b", "c", "d"], "b" : ["a", "c", "d"], "c" : ["a", "b", "d"], "d" : ["a", "b", "c"] } # Ivan Sulaiman print(generate_edges(graph2)) # Jainal Panchal graph3 = { "a" : ["c","b","d","e"], "b" : ["c","a","d","e"], "c" : ["b","a","d","e"], "d" : ["c","a","b","e"], "e" : ["c","a","d","b"], } print(generate_edges(graph3)) # Let us consider the worst case (from of the point of view of complexity). # One of the possible measures of complexity for the algorithm # in the generate_edges is the number of appends. # The measure of the size of the problem is the number of vertices, M. # In the worst case, the number of appends is: # (M - 1) + (M - 2) + ... + 1 = M (M - 1)/2 # Co-calculated by Milan Sachani. # In the case of directed graphs it's twice that much. # Thus, in the worst case the complexity is O(M**2). \ # By definition, a perfect numer is such a number L, that if # L % n1 = 0, L % n2 = 0, ..., L % n_k = 0 (where the set # {n_1, n_2, ..., n_k} includes 1 but does not include L ieself), # then the sum n_1 + n_2 + ... + n_k = L.
run
|
edit
|
history
|
help
0
(P2) Ciągi 2 - mapowanie
PyRegLookAhead
PyRegLookBehind
75
My world
sensi
Reading XML file
pico menu
Python. Even
Assignment-3c