wfgeo
wfgeo

Reputation: 3118

pgr_kruskalDFS returning all edges even when cost or reverse_cost is -1

I have a graph represented in my database. I am sure that it is topologically correct, here is a small section of it, visualized in QGIS:

enter image description here

I want to et all the edges that are upstream from node 2132557864.

So I specify the query like this:

    SELECT * FROM pgr_kruskalDFS(
      'SELECT id, source_node_id as source, target_node_id as target,
      -1 AS cost, st_length(geom) AS reverse_cost
      from osm_edges',
      3577226615)

According to the docs:

  • It’s implementation is only on undirected graph.
  • Process is done only on edges with positive costs.

So I guess this means that you can simulate a directed graph by passing -1 to cost or reverse_cost. I did this, but it still ends up returning the whole graph (at least, the parts that are not totally isolated):

enter image description here

What am I doing wrong here? It seems like this should be the correct way to get upstream edges from a node.

Upvotes: 0

Views: 8

Answers (0)

Related Questions