mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
all valid python 3
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
from __future__ import print_function
|
||||
num_nodes, num_edges = list(map(int,raw_input().split()))
|
||||
num_nodes, num_edges = list(map(int,input().split()))
|
||||
|
||||
edges = []
|
||||
|
||||
for i in range(num_edges):
|
||||
node1, node2, cost = list(map(int,raw_input().split()))
|
||||
node1, node2, cost = list(map(int,input().split()))
|
||||
edges.append((i,node1,node2,cost))
|
||||
|
||||
edges = sorted(edges, key=lambda edge: edge[3])
|
||||
|
||||
@@ -101,8 +101,8 @@ def PrimsAlgorithm(l):
|
||||
return TreeEdges
|
||||
|
||||
# < --------- Prims Algorithm --------- >
|
||||
n = int(raw_input("Enter number of vertices: "))
|
||||
e = int(raw_input("Enter number of edges: "))
|
||||
n = int(input("Enter number of vertices: "))
|
||||
e = int(input("Enter number of edges: "))
|
||||
adjlist = defaultdict(list)
|
||||
for x in range(e):
|
||||
l = [int(x) for x in input().split()]
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
from __future__ import print_function
|
||||
# n - no of nodes, m - no of edges
|
||||
n, m = list(map(int,raw_input().split()))
|
||||
n, m = list(map(int,input().split()))
|
||||
|
||||
g = [[] for i in range(n)] #graph
|
||||
r = [[] for i in range(n)] #reversed graph
|
||||
# input graph data (edges)
|
||||
for i in range(m):
|
||||
u, v = list(map(int,raw_input().split()))
|
||||
u, v = list(map(int,input().split()))
|
||||
g[u].append(v)
|
||||
r[v].append(u)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user