Skip to content

Conversation

@mdrazak2001
Copy link
Contributor

Your checklist for this pull request

Please review the guidelines for contributing to this repository.

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side). Don't request your master!
  • Make sure you are making a pull request against the dev branch (left side). Also you should start your branch off our dev.
  • Check the commit's or even all commits' message styles matches our requested structure.

Issue number(s) that this pull request fixes

  • Fixes #

List of changes to the codebase in this pull request

@mdrazak2001 mdrazak2001 changed the title Graph Role core impl Core impl [Graph Role + base identification] Aug 30, 2025
@ankurankan ankurankan self-requested a review August 30, 2025 17:57
@ankurankan ankurankan moved this to PR under progress in Mentored Projects Aug 30, 2025
@ankurankan
Copy link
Member

ankurankan commented Sep 14, 2025

@mdrazak2001 Sorry for the delay on the end-to-end example. A simple end-to-end example could be a DAG: X -> Y X <- U -> Y with exposure X and outcome Y. The identify method should assign U as the adjustment role.

We can create a similar example in the case of a PDAG by adding another node Z: Z--X -> Y X<- U -> Y. Here, as well with X as the exposure and Y as the outcome, the identify method should assign U as the adjustment role.

let mut dag = RustDAG::new();
dag.add_edges_from([("X".to_string(), "Y".to_string()),
                                        ("U".to_string(), "X".to_string()),
                                        ("U".to_string(), "Y".to_string())]);
dag = dag.with_role("exposure".to_string(), "X".to_string());
dag = dag.with_role("outcome".to_string(), "Y".to_string());

let identification = BackdoorIdentification::new();
let dag_with_roles = identification.identify(dag)

// Similarly for the PDAG case.
let pdag_with_roles = identification.identify(pdag)

dag_with_roles.get_role_dict()
// this should have U as adjustment.

@ankurankan ankurankan merged commit 45bb0a7 into pgmpy:main Sep 15, 2025
3 checks passed
@github-project-automation github-project-automation bot moved this from PR under progress to Done in Mentored Projects Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants