summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/graph
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/openslx/graph')
-rw-r--r--src/main/java/org/openslx/graph/Edge.java5
-rw-r--r--src/main/java/org/openslx/graph/Graph.java2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/org/openslx/graph/Edge.java b/src/main/java/org/openslx/graph/Edge.java
index 9d03aeb..c896651 100644
--- a/src/main/java/org/openslx/graph/Edge.java
+++ b/src/main/java/org/openslx/graph/Edge.java
@@ -51,6 +51,7 @@ public class Edge implements java.io.Serializable
_health--;
}
_age++;
+ _weight = 0;
}
public boolean isAlive()
@@ -58,9 +59,9 @@ public class Edge implements java.io.Serializable
return _health > 0;
}
- public void setWeight( double weight )
+ public void addWeight( double weight )
{
- _weight = weight;
+ _weight += weight;
_health = _maxHealth;
}
diff --git a/src/main/java/org/openslx/graph/Graph.java b/src/main/java/org/openslx/graph/Graph.java
index 65110f6..7f7ca64 100644
--- a/src/main/java/org/openslx/graph/Graph.java
+++ b/src/main/java/org/openslx/graph/Graph.java
@@ -99,7 +99,7 @@ public class Graph implements java.io.Serializable
_edges.put( edge, edge );
}
// Set the edge weight.
- edge.setWeight( weight );
+ edge.addWeight( weight );
}
// Remove a Node from the Graph, along with all of its emanating Edges.