cwida / duckpgq-extension

DuckDB extension that adds support for SQL/PGQ
https://duckpgq.notion.site/b8ac652667964f958bfada1c3e53f1bb?v=3b47a8d44bdf4e0c8b503bf23f1b76f2
MIT License
50 stars 6 forks source link

Graph creation functions #57

Open tomkom opened 10 months ago

tomkom commented 10 months ago

-- Preamble: Just stumbled upon the extension, very excited, thank you!

Functionality suggestion ( maybe already in pipeline):

Explicit graph data are not that common and often have to be created by recomputing the topology. This is common in the spatial context ( street lanes), where graphs are computed by analyzing topological relationships between member geometries.

The result is a data structure -- the edge table. See for example the behaviour of [pg_routing] (https://docs.pgrouting.org/latest/en/pgr_createTopology.html), potentially with an additional vertices table.

It would be awesome if it was possible to create the input structures in DUCK/PGQ, instead of having to craft them separately.

Dtenwolde commented 10 months ago

Hi Tom,

Thank you :) I'll start working more on the extension again in the near future (wrapping up an internship right now)

I am new to pg_routing, so just for my understanding, what would be the input to pgr_createTopology? Would that be an already existing edge_table (or a csv file with a source and target column?) through which the edge_table gets updated/created according to the rows_where parameter and the creation of a vertex_table?

If so, that sounds like a feature I would definitely like to add to the list, seems quite useful and improves usability :) Please let me know!

tomkom commented 10 months ago

Yes, an edge table that contains a geom column. Think of it as generating a graph def from a vector drawing. These are typically linestring edges (note, we distinguish vertices of a linestring, an graph nodes, where 2+ linestrings intersect). Duckdb implements spatial geometries as here https://duckdb.org/docs/extensions/spatial.html

Tolerance is for "snapping" linestrings if there is a small gap between end vertices.

Dtenwolde commented 10 months ago

I see, I believe there are opportunities to combine the spatial and duckpgq extension, so I'll keep this in mind. Thank you :)

tomkom commented 6 months ago

JUst catching up on this, did anyone manage to experiment with graph creation based on the DuckDB geometry support? This is now beautifully mainstream, and supporting graph based analytics ( shortest path) requires the ability to create a network from the geometries from a table that contains "lines". Is this something that is now tackled in the duckpg extension development?

github-actions[bot] commented 2 days ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.