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

Expose and rename properties for accessing underlying graphs and indices #172

Merged
merged 3 commits into from
Jun 25, 2024

Conversation

SimonHeybrock
Copy link
Member

This will be required for a variety of functionality that we plan to add in Sciline or elsewhere. A simple example is #83:

import networkx as nx
import pandas as pd

g = workflow.networkx_graph
nodes = [node for node in g.nodes() if len(g.in_edges(node)) == 0]
nodes = [node for node in nodes if 'provider' not in g.nodes[node]]

not_set = '(not set)'
df = pd.DataFrame(
    {'node': nodes, 'value': [g.nodes[node].get('value', not_set) for node in nodes]}
)
df

I don't know if this (without the Pandas bit) is something that should be added as a helper function in Sciline, or more specifically in our applications, e.g., in ESSreduce?

This will be required for a variety of functionality that we plan to add
in Sciline or elsewhere. A simple example is #83.
@SimonHeybrock SimonHeybrock requested a review from jl-wynen June 25, 2024 05:08
return self._cbgraph.indices

@property
def cyclebane_graph(self) -> cb.Graph:
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this property? I don't see where it is used. And it adds one more concept to the interface. Users need to know what is the difference between all the different graphs.

@SimonHeybrock SimonHeybrock merged commit 7f6b68e into main Jun 25, 2024
5 checks passed
@SimonHeybrock SimonHeybrock deleted the add-graph-property branch June 25, 2024 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants