Skip to content
Snippets Groups Projects

Adding new methods and the consensual backbone

Merged Ali Yassin requested to merge dev into main
3 files
+ 5
8
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -7,15 +7,11 @@ from netbone.filters import fraction_filter, threshold_filter
def global_threshold(data):
if isinstance(data, DataFrame):
table = data.copy()
g = nx.from_pandas_edgelist(data, edge_attr=edge_properties(data))
elif isinstance(data, Graph):
table = nx.to_pandas_edgelist(data)
g = data.copy()
else:
print("data should be a panads dataframe or nx graph")
return
table['score'] = table['weight']
g = nx.from_pandas_edgelist(table, edge_attr=edge_properties(table))
return Backbone(g, method_name="Global Threshold Filter", property_name="score", ascending=False, compatible_filters=[fraction_filter, threshold_filter], filter_on='Edges')
\ No newline at end of file
return Backbone(g, method_name="Global Threshold Filter", property_name="weight", ascending=False, compatible_filters=[fraction_filter, threshold_filter], filter_on='Edges')
\ No newline at end of file
Loading