Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edge table not found in weakly_connected_component function #148

Closed
2 tasks done
pkoppstein opened this issue Sep 7, 2024 · 1 comment · Fixed by #150
Closed
2 tasks done

Edge table not found in weakly_connected_component function #148

pkoppstein opened this issue Sep 7, 2024 · 1 comment · Fixed by #150

Comments

@pkoppstein
Copy link

pkoppstein commented Sep 7, 2024

What happens?

Invalid Error: Table edges not found in property graph my_graph

Note: the documentation indicates the "<edge table>" should be used:

weakly_connected_component(<pg>, <vertex table>, <edge table>)

To Reproduce

LOAD duckpgq;

CREATE or replace TABLE edges (
    source INTEGER,
    target INTEGER
);

-- Insert some sample data (directed edges)
INSERT INTO edges VALUES (1, 2), (2, 3), (4, 5), (2, 4), (10,11);

CREATE OR REPLACE TABLE nodes AS
   (SELECT DISTINCT id FROM
    (SELECT DISTINCT source AS id FROM edges
    UNION
    SELECT DISTINCT target AS id FROM edges
    ) );

CREATE OR REPLACE PROPERTY GRAPH my_graph
  VERTEX TABLES (
   nodes LABEL nodes
 )
  EDGE TABLES (
    edges SOURCE KEY (source) REFERENCES nodes (id)
          DESTINATION KEY (target) REFERENCES nodes (id)
          LABEL knows
  );

SELECT * FROM weakly_connected_component(my_graph, nodes, edges);

OS:

macOS

DuckDB Version:

v1.0.0

DuckDB Client:

CLI

Full Name:

Peter Koppstein

Affiliation:

Princeton University

How did you load the extension?

Latest version

Did you include all relevant data sets for reproducing the issue?

Not applicable - the reproduction does not require a data set

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have
@Dtenwolde
Copy link
Contributor

You gave the edge table edges the label knows. The weakly_connected_components table function now won't work with edges, but instead expects knows. This is a bit confusing, especially as the error message is not helpful.

SELECT * FROM weakly_connected_components(my_graph, nodes, knows); 

This should work 🙂

I'll rework the error message

@Dtenwolde Dtenwolde changed the title weakly_connected_component Edge table not found in weakly_connected_component function Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants