Skip to content

Conversation

@tristan-f-r
Copy link
Collaborator

@tristan-f-r tristan-f-r commented Aug 28, 2025

This refactor prefers duplicating column names over using shortened variables, helping to make the distinction between local variables and variables exported to the summary dataframe.

(This was from #368 (comment))

Also pins median degree to be an integer.
@tristan-f-r tristan-f-r added the refactor Changes that don't actually improve anything except for code quality. label Aug 28, 2025
@read-the-docs-community
Copy link

read-the-docs-community bot commented Aug 28, 2025

Documentation build overview

📚 spras | 🛠️ Build #29487265 | 📁 Comparing 6320b72 against latest (fad9fbf)


🔍 Preview build

Show files changed (2 files in total): 📝 2 modified | ➕ 0 added | ➖ 0 deleted
File Status
contributing/index.html 📝 modified
fordevs/spras.analysis.html 📝 modified

Copy link
Collaborator

@agitter agitter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look good to me. I want to let @ntalluri review as well before merging because she just updated this code.

nw_info.append(current_network_info)

# Prepare column names
col_names = ['Name', 'Number of nodes', 'Number of edges', 'Number of connected components', 'Density', 'Max degree', 'Median degree', 'Max diameter', 'Average path length']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need col_names? Could we get that directly from the keys now?

Copy link
Collaborator Author

@tristan-f-r tristan-f-r Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could. Should we? It's nice to have an explicit list of all of the columns - the column duplication may help here.

Copy link
Collaborator

@ntalluri ntalluri Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was under the assumption that part of this PR was to get rid of the col_names part, otherwise I don't fully understand why this is being changed to a dict.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh - it's just to remove the cur_nw_info variable indirection in favor of directly referencing keys.

Copy link
Collaborator

@ntalluri ntalluri Sep 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't get the point of this PR. Why do we not want to use cur_nw_info? You mentioned it was bad in the other PR, but there was no reasoning as to why it's bad.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll close this PR since I don't want to push this change through if it isn't straightforward, since it's a small refactor after all 👍

My reasoning for not using cur_nw_info is that it's hard to follow the graph statistics when they are named by variables instead of their string header names,

for node_list in nodes_by_col:
num_nodes = len(set(nw).intersection(node_list))
cur_nw_info.append(num_nodes)
current_network_info.append(num_nodes)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to make this a key value pair too using nodes_by_col_labs?

# Algorithm parameters have format { algo : { hashcode : { parameter combos } } }
param_combo = algo_params[algo][hashcode]
cur_nw_info.append(param_combo)
current_network_info.append(param_combo)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with param_combo? (making it a key value pair)

@tristan-f-r tristan-f-r added the awaiting-author Author of the PR needs to fix something from a review / etc. label Sep 25, 2025
@tristan-f-r tristan-f-r removed the awaiting-author Author of the PR needs to fix something from a review / etc. label Oct 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Changes that don't actually improve anything except for code quality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants