Commit 658ee795 authored by Thibaut Démare's avatar Thibaut Démare

Add clean methods to delete attributes used by the algorithm

parent d4670a46
......@@ -791,6 +791,45 @@ public class BetweennessCentrality implements Algorithm {
}
}
/**
* Delete attributes used by this algorithm in nodes and edges of the graph
*/
public void cleanGraph(){
cleanElement(graph.getEachEdge());
cleanElement(graph.getEachNode());
}
/**
* Delete attributes used by this algorithm in nodes of the graph
*/
public void cleanNodes(){
cleanElement(graph.getEachNode());
}
/**
* Delete attributes used by this algorithm in edges of the graph
*/
public void cleanEdges(){
cleanElement(graph.getEachEdge());
}
/**
* Delete attributes used by this algorithm in elements of a graph
* @param it the list of elements
*/
private void cleanElement(Iterable<? extends Element> it){
for(Element e : it){
if(e.hasAttribute(predAttributeName))
e.removeAttribute(predAttributeName);
if(e.hasAttribute(sigmaAttributeName))
e.removeAttribute(sigmaAttributeName);
if(e.hasAttribute(distAttributeName))
e.removeAttribute(distAttributeName);
if(e.hasAttribute(deltaAttributeName))
e.removeAttribute(deltaAttributeName);
}
}
/**
* Increasing comparator used for priority queues.
*/
......@@ -841,4 +880,4 @@ public class BetweennessCentrality implements Algorithm {
*/
void progress(float percent);
}
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment