Close Menu
  • AI
  • Content Creation
  • Tech
  • Robotics
AI-trends.todayAI-trends.today
  • AI
  • Content Creation
  • Tech
  • Robotics
Trending
  • Appeals Court docket Lets the Pentagon Designate Anthropic a Provide-Chain Threat
  • Aikido Safety Releases Altar-1: An Open-Weight Safety Mannequin Pruned From GLM-5.3 to 328 GB
  • Black Forest Labs Releases FLUX 3 Motion: A 7B Open-Weights World Motion Mannequin That Tops RoboLab-120
  • Fastino Releases GLiNER2.5-Resolve: A 340M Open-Weight Determination Mannequin That Runs on CPU
  • BottleCap AI Releases ThinkingCap-Qwen3.8-27B: 37.2% Fewer Considering Tokens at a 0.86pp Accuracy Price
  • What if I find an AI agent that is worth the risk?
  • Google’s Gemini Can Now Make Requires You on Pixel Telephones
  • An OpenAI Agent Hacked Australia’s Well being Service. Their Authorities Discovered Out Months Later
AI-trends.todayAI-trends.today
Home»Tech»Use of city2graph, OSMnx and PyTorch Geometric to implement spatial Graph Neural networks for the inference of urban functions

Use of city2graph, OSMnx and PyTorch Geometric to implement spatial Graph Neural networks for the inference of urban functions

Tech By Gavin Wallace13/06/20262 Mins Read
Facebook Twitter LinkedIn Email
NVIDIA Releases Llama Nemotron Nano 4B: An Efficient Open Reasoning
NVIDIA Releases Llama Nemotron Nano 4B: An Efficient Open Reasoning
Share
Facebook Twitter LinkedIn Email
poi_gdf["cx"] = poi_gdf.geometry.x
poi_gdf["cy"] = poi_gdf.geometry.y
Coords = Poi_gdf[["cx", "cy"]].to_numpy()
nn = NearestNeighbors(radius=150.0).fit(coords)
poi_gdf["local_density"] = [len(idx) - 1 for idx in nn.radius_neighbors(coords, return_distance=False)]
If segments_gdf does not equal None, and len (segments_gdf), then:
   try:
       joined = gpd.sjoin_nearest(poi_gdf[["geometry"]], segments_gdf[["geometry"]],
                                  distance_col="dist_street")
       poi_gdf["dist_street"] = joined.groupby(level=0)["dist_street"].min().reindex(poi_gdf.index).fillna(0.0)
 Except Exception
       poi_gdf["dist_street"] = 0.0
else:
   poi_gdf["dist_street"] = 0.0
poi_gdf["category"] = poi_gdf["category"].astype("category")
poi_gdf["label"] = poi_gdf["category"].cat.codes.astype(int)
CLASS_NAMES = list(poi_gdf["category"].cat.categories)
print("Classes:", CLASS_NAMES)
def graph_stats (name, builder:
   try:
 Builder = nodes + edges()
       deg = pd.Series(np.r_[edges.index.get_level_values(0),
                             edges.index.get_level_values(1)]).value_counts()
       return name, len(edges), round(deg.mean(), 2), (nodes, edges)
 Except Exception As e.
 The return number is fBuilders ="ERR: {e}", None, None
builders = {
   "KNN (k=8)":  lambda: c2g.knn_graph(poi_gdf, distance_metric="euclidean", k=8, as_nx=False),
   "Delaunay":   lambda: c2g.delaunay_graph(poi_gdf, as_nx=False),
   "Gabriel":    lambda: c2g.gabriel_graph(poi_gdf, as_nx=False),
   "RNG":        lambda: c2g.relative_neighborhood_graph(poi_gdf, as_nx=False),
   "EMST":       lambda: c2g.euclidean_minimum_spanning_tree(poi_gdf, as_nx=False),
   "Waxman":     lambda: c2g.waxman_graph(poi_gdf, distance_metric="euclidean", r0=150, beta=0.6),
}
print("n--- Proximity graph comparison ---")
print(f"{'graph':10}{'avg_degree':>12}")
built = {}
Builders.items for nm and b():
   name, ne, avgdeg, payload = graph_stats(nm, b)
   print(f"{name:10}{str(avgdeg):>12}")
 If payload is built[nm] The payload
Axes = plt.subplots (1, 3, figsize=(16, 5 )
for ax, key in zip(axes, ["KNN (k=8)", "Delaunay", "EMST"]):
 If key is built in:
 Built = n_, E_[key]
       e_.plot(ax=ax, linewidth=0.4, color="#3b7dd8", alpha=0.6)
       poi_gdf.plot(ax=ax, markersize=4, color="#d83b5c")
       ax.set_title(key); ax.set_axis_off()
plt.suptitle("Spatial graph topologies on the same POI set", y=1.02)
plt.tight_layout(); plt.show()
met Net work x
Share. Facebook Twitter LinkedIn Email
Avatar
Gavin Wallace

Related Posts

Aikido Safety Releases Altar-1: An Open-Weight Safety Mannequin Pruned From GLM-5.3 to 328 GB

25/09/2026

Black Forest Labs Releases FLUX 3 Motion: A 7B Open-Weights World Motion Mannequin That Tops RoboLab-120

25/09/2026

Fastino Releases GLiNER2.5-Resolve: A 340M Open-Weight Determination Mannequin That Runs on CPU

25/09/2026

BottleCap AI Releases ThinkingCap-Qwen3.8-27B: 37.2% Fewer Considering Tokens at a 0.86pp Accuracy Price

24/09/2026
Top News

Elon Musk Boosts New Yorker’s Sam Altman Exposé on X as Trial Begins

Electricians Believe Building Data Centres is for the Rich

Nvidia’s Deal With Meta signals a new era in computing power

Vibe Coding Is the New Open Source—in the Worst Way Possible

Code Metal raises $125M to Rewrite Defense Industry Code With AI

Load More
AI-Trends.Today

Your daily source of AI news and trends. Stay up to date with everything AI and automation!

X (Twitter) Instagram
Top Insights

Create a reinforcement learning powered agent that learns to retrieve relevant long-term memories for accurate LLM question answering

27/04/2026

NVIDIA releases DreamDojo, an open-source robot world model trained on 44 711 hours of real-time human video data

21/02/2026
Latest News

Appeals Court docket Lets the Pentagon Designate Anthropic a Provide-Chain Threat

25/09/2026

Aikido Safety Releases Altar-1: An Open-Weight Safety Mannequin Pruned From GLM-5.3 to 328 GB

25/09/2026
X (Twitter) Instagram
  • Privacy Policy
  • Contact Us
  • Terms and Conditions
© 2026 AI-Trends.Today

Type above and press Enter to search. Press Esc to cancel.