Skip to content
Snippets Groups Projects
Commit e0b28076 authored by Yassin's avatar Yassin
Browse files

Adding new methods and the consensual backbone extraction

parent c6721735
No related branches found
No related tags found
1 merge request!1Adding new methods and the consensual backbone
...@@ -26,6 +26,7 @@ from netbone.structural.mlam import mlam ...@@ -26,6 +26,7 @@ from netbone.structural.mlam import mlam
from netbone.structural.gspar import gspar from netbone.structural.gspar import gspar
from netbone.structural.degree import degree from netbone.structural.degree import degree
from netbone.structural.betweenness import betweenness from netbone.structural.betweenness import betweenness
from netbone.structural.mad import mad
# from netbone.statistical.correlation_and_statistic import correlation_and_statistic # from netbone.statistical.correlation_and_statistic import correlation_and_statistic
from netbone.filters import threshold_filter, fraction_filter from netbone.filters import threshold_filter, fraction_filter
......
...@@ -97,7 +97,7 @@ class Compare: ...@@ -97,7 +97,7 @@ class Compare:
raise Exception('Please enter the filter values.') raise Exception('Please enter the filter values.')
cons = [] cons = []
if consent == False: if consent == False:
for backbon in self.backbones: for backbone in self.backbones:
cons.append(False) cons.append(False)
consent = cons consent = cons
......
...@@ -7,15 +7,11 @@ from netbone.filters import fraction_filter, threshold_filter ...@@ -7,15 +7,11 @@ from netbone.filters import fraction_filter, threshold_filter
def global_threshold(data): def global_threshold(data):
if isinstance(data, DataFrame): if isinstance(data, DataFrame):
table = data.copy() g = nx.from_pandas_edgelist(data, edge_attr=edge_properties(data))
elif isinstance(data, Graph): elif isinstance(data, Graph):
table = nx.to_pandas_edgelist(data) g = data.copy()
else: else:
print("data should be a panads dataframe or nx graph") print("data should be a panads dataframe or nx graph")
return return
table['score'] = table['weight'] 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
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment