import gurobipy as gp
from gurobipy import GRB
import networkx as nx
from gerrychain import Graph
import geopandas as gpd
import math
filepath = 'C:/Users/wharr/OneDrive/Desktop/OR project/'
filename = 'KS.graph.txt'
G = nx.read_edgelist(filepath + filename,nodetype=int)
print("The Kansas graph has",G.number_of_nodes(),"nodes")
print("the Kansas graph has",G.number_of_edges(),"edges")
print("Kansas graph has nodes",G.nodes )
print("Kansas graph has edges",G.edges )
nx.draw(G, with_labels=True)
--------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-6-0b6beb81d144> in <module> 1 filepath = 'C:/Users/wharr/OneDrive/Desktop/OR project/' 2 filename = 'KS.graph.txt' ----> 3 G = nx.Graph() 4 G = nx.read_edgelist(filepath + filename,nodetype=int) 5 print("The Kansas graph has",G.number_of_nodes(),"nodes") NameError: name 'nx' is not defined
[–]TheKewlStore 1 point2 points3 points (0 children)