import momepy
import geopandas as gpd

def create_graph(linestrings):
  gdf = gpd.GeoDataFrame(geometry=linestrings)
  graph = momepy.gdf_to_nx(gdf, approach="primal")
  return graph