'ox.graph_from_bbox() function of OSMNX library in python gives incomplete graph

I have a piece of code which provides the route from a source point to destination point. In the below code, origin_lat and origin_long are the source coordinates and dest_lat and dest_long are the destination coordinates

G = ox.graph_from_bbox(origin_lat,dest_lat,origin_long,dest_long, network_type='drive')
origin_point = (origin_lat, origin_long) 
destination_point = (dest_lat, dest_long)
origin_node = ox.get_nearest_node(G, origin_point,method='euclidean')
destination_node = ox.get_nearest_node(G, destination_point,method='euclidean')
route = nx.shortest_path(G, origin_node, destination_node, weight='travel_time')

But for some coordinates, I am not getting a complete route from source to destination. I have attached the screenshot of the output where I have plotted the route on ScatterMapbox image The black route is not reaching the source and destination, means the graph itself is incomplete. Can anyone help me out with this.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source