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

Refactorings Code and Adding Node Filter

parent db4adcf0
No related branches found
No related tags found
1 merge request!1Adding new methods and the consensual backbone
...@@ -60,16 +60,9 @@ def fraction_filter(backbone, value, narrate=True, secondary_property='weight', ...@@ -60,16 +60,9 @@ def fraction_filter(backbone, value, narrate=True, secondary_property='weight',
value = math.ceil(value * len(data)) value = math.ceil(value * len(data))
return nx.from_pandas_edgelist(data[:value], edge_attr=edge_properties(data)) return nx.from_pandas_edgelist(data[:value], edge_attr=edge_properties(data))
else: else:
print('hereeeeeeee')
b = backbone.graph.copy() b = backbone.graph.copy()
value = math.ceil(value * len(backbone.graph)) value = math.ceil(value * len(backbone.graph))
return b.subgraph(list(data[:value].index))
print(value)
print(list(data[:value].index))
b.remove_nodes_from(list(data[:value].index))
return b
print("The accepted filters for " + backbone.method_name + " are: " + ', '.join( print("The accepted filters for " + backbone.method_name + " are: " + ', '.join(
[fun.__name__ for fun in backbone.compatible_filters()])) [fun.__name__ for fun in backbone.compatible_filters()]))
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