mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
Improved Code and removed Warnings (#483)
This commit is contained in:
@@ -168,7 +168,7 @@ def topo(G, ind=None, Q=[1]):
|
||||
|
||||
|
||||
def adjm():
|
||||
n, a = input(), []
|
||||
n, a = raw_input(), []
|
||||
for i in xrange(n):
|
||||
a.append(map(int, raw_input().split()))
|
||||
return a, n
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from __future__ import print_function
|
||||
num_nodes, num_edges = list(map(int,input().split()))
|
||||
num_nodes, num_edges = list(map(int,raw_input().split()))
|
||||
|
||||
edges = []
|
||||
|
||||
for i in range(num_edges):
|
||||
node1, node2, cost = list(map(int,input().split()))
|
||||
node1, node2, cost = list(map(int,raw_input().split()))
|
||||
edges.append((i,node1,node2,cost))
|
||||
|
||||
edges = sorted(edges, key=lambda edge: edge[3])
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
from __future__ import print_function
|
||||
# n - no of nodes, m - no of edges
|
||||
n, m = list(map(int,input().split()))
|
||||
n, m = list(map(int,raw_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,input().split()))
|
||||
u, v = list(map(int,raw_input().split()))
|
||||
g[u].append(v)
|
||||
r[v].append(u)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user