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

167 largest cycle in statistics not being computed correctly #176

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 31 additions & 12 deletions Backend/postgres_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,27 @@ def get_statistics(self, where_text):
periodic_cardinalities = [row[0] for row in cur.fetchall()]
avg_num_periodic = sum(periodic_cardinalities) / len(
periodic_cardinalities)
most_periodic = max(
set(periodic_cardinalities),
key=periodic_cardinalities.count
most_periodic = max(periodic_cardinalities)
sql = (
'SELECT periodic_cycles'
' FROM graphs_dim_1_nf'
' JOIN rational_preperiodic_dim_1_nf'
' ON graphs_dim_1_nf.graph_id = '
'rational_preperiodic_dim_1_nf.graph_id'
' JOIN functions_dim_1_nf'
' ON functions_dim_1_nf.function_id = '
'rational_preperiodic_dim_1_nf.function_id'
+ where_text
)
largest_cycle = max(periodic_cardinalities)
cur.execute(sql)
periodic_cycles = [row[0] for row in cur.fetchall()]
longest_cycles = [max(val) for val in periodic_cycles if val]
if len(longest_cycles) > 0:
largest_cycle = max(longest_cycles)
else:
largest_cycle = 0

print (largest_cycle)
sql = (
'SELECT preperiodic_components'
' FROM graphs_dim_1_nf'
Expand All @@ -338,15 +354,18 @@ def get_statistics(self, where_text):
)
cur.execute(sql)
preperiodic_components = [row[0] for row in cur.fetchall()]
cardinalities = [sum(comp) for comp in preperiodic_components]
avg_num_preperiodic = sum(
len(comp) for comp in preperiodic_components
) / len(preperiodic_components)
component_sizes = [len(comp) for comp in preperiodic_components]
most_preperiodic = max(
set(component_sizes),
key=component_sizes.count
)
largest_comp = max(component_sizes)
cardinalities
) / len(preperiodic_components)
most_preperiodic = max(cardinalities)
component_sizes = [
max(comp) for comp in preperiodic_components if comp
]
if len(component_sizes) > 0:
largest_comp = max(component_sizes)
else:
largest_comp = 0


except Exception:
Expand Down
Loading