Skip to content

fix: preserve labels when loading CSV adjacency matrices - #69

Open
Shubham-Padkonde wants to merge 1 commit into
salesforce:mainfrom
Shubham-Padkonde:fix/csv-adjacency-labels
Open

Shubham-Padkonde wants to merge 1 commit into
salesforce:mainfrom
Shubham-Padkonde:fix/csv-adjacency-labels

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown

Passing a CSV saved with graph.to_csv(path) to BayesianNetwork, HT, or RandomWalk currently treats the row-label column as adjacency data. BayesianNetwork then compares string labels with zero, while the NetworkX-based analyzers cannot match the generated integer index to the metric columns.

Share a CSV loader that restores the first column as row labels when present. Square CSV files written with index=False remain supported, with rows following the metric-column order. The configuration docstrings now explain both formats.

Validation: all 12 analyzer tests pass, with two existing tests skipped. Six indexed-CSV regressions fail before the fix; three additional cases cover index-free CSV compatibility. Tests verify the loaded matrices, node names, and directed edges for all three analyzers. Required Black and license-header hooks pass. Tested on Python 3.10 with NumPy 1.23.5, pandas 1.5.3, and scikit-learn 1.1.3.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant