I am new to the package Networkx. I have the following vertices in V and created edges in N. Then, I randomly assigned some numbers to represent the edge distances and created dict E to store edge and distance info. I want to find the shortest path for each pair of nodes by using Floyd-Warshall algorithm. I searched to find some examples but couldn't end up seeing one that I can implement easily. So, I started by learning how to create a graph using "networkx" package.
import networkx as nx
import numpy as np
np.random.seed(0)
V = [333092, 467979, 177073, 164786, 178581]
N = [(i,j) for i in V for j in V if i!=j]
E = {}
Elist = list(np.random.randint(low=10, high = 50, size = len(N)))
for i in range(len(N)):
E[N[i]] = Elist[i] # (i,j) does not have to be equal to (j,i)
Here is the code for the graph and a missing application attempt to find the shortest path. I know I have never used the dictionary E, so I should not expect a correct solution. But, I just couldn't understand how to input for nx.floyd_warshall().
G=nx.Graph()
G.add_nodes_from(V)
for i in range(len(N)):
G.add_edge(N[i][0], N[i][1])
nx.floyd_warshall(G)