Skip to content

Commit 8fd7982

Browse files
committed
update_depth is now a method parameter
1 parent c03c895 commit 8fd7982

1 file changed

Lines changed: 8 additions & 13 deletions

File tree

src/main/java/info/debatty/java/graphs/Graph.java

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,10 @@ public class Graph<T> implements Serializable {
8181

8282
private static final String NODE_SEQUENCE_KEY = "ONLINE_GRAPH_SEQUENCE";
8383

84+
8485
private final HashMap<Node<T>, NeighborList> map;
8586
private SimilarityInterface<T> similarity;
8687
private int k = DEFAULT_K;
87-
88-
private int update_depth = DEFAULT_UPDATE_DEPTH;
8988
private int window_size = 0;
9089
private int current_sequence = 0;
9190

@@ -877,15 +876,6 @@ public final void writeGEXF(final String filename)
877876

878877

879878

880-
881-
/**
882-
* Modify the depth for updating existing edges (default is 2).
883-
* @param update_depth
884-
*/
885-
public final void setDepth(final int update_depth) {
886-
this.update_depth = update_depth;
887-
}
888-
889879
/**
890880
* Set the size of the window (number of nodes to keep in the graph).
891881
* Default = 0 = unlimited size
@@ -974,6 +964,7 @@ public final void fastAdd(
974964
speedup,
975965
DEFAULT_SEARCH_RANDOM_JUMPS,
976966
DEFAULT_SEARCH_EXPANSION,
967+
DEFAULT_UPDATE_DEPTH,
977968
new StatisticsContainer());
978969
}
979970

@@ -986,13 +977,15 @@ public final void fastAdd(
986977
* @param speedup compared to exhaustive search
987978
* @param long_jumps
988979
* @param expansion
980+
* @param update_depth
989981
* @param stats
990982
*/
991983
public final void fastAdd(
992984
final Node<T> new_node,
993985
final double speedup,
994986
final int long_jumps,
995987
final double expansion,
988+
final int update_depth,
996989
final StatisticsContainer stats) {
997990

998991
if (containsKey(new_node)) {
@@ -1011,7 +1004,7 @@ public final void fastAdd(
10111004
for (Node<T> node : getNodes()) {
10121005
if (node.getAttribute(NODE_SEQUENCE_KEY)
10131006
.equals(node_to_delete)) {
1014-
fastRemove(node, stats);
1007+
fastRemove(node, update_depth, stats);
10151008
break;
10161009
}
10171010
}
@@ -1072,17 +1065,19 @@ public final void fastAdd(
10721065
* @param node_to_remove
10731066
*/
10741067
public final void fastRemove(final Node<T> node_to_remove) {
1075-
fastRemove(node_to_remove, new StatisticsContainer());
1068+
fastRemove(node_to_remove, DEFAULT_UPDATE_DEPTH, new StatisticsContainer());
10761069
}
10771070

10781071
/**
10791072
* Remove a node from the graph (and update the graph) using fast
10801073
* approximate algorithm.
10811074
* @param node_to_remove
1075+
* @param update_depth
10821076
* @param stats
10831077
*/
10841078
public final void fastRemove(
10851079
final Node<T> node_to_remove,
1080+
final int update_depth,
10861081
final StatisticsContainer stats) {
10871082

10881083
// Build the list of nodes to update

0 commit comments

Comments
 (0)