Commit 6753a951 authored by Roland Kluge's avatar Roland Kluge
Browse files

Add docu

parent a4cf1e38
......@@ -49,16 +49,24 @@ public class EdgeID extends GraphElementID {
return id;
}
private static int determineHashCode(String str) {
if (str.matches("\\d+->\\d+"))
{
final String[] segments = str.split("->");
/**
* This method calculates the hash code for the given edge ID.
*
* If the ID has the specific format for directed edges (e.g., 12->541),
* then the hash code is calculated in a way that avoids hash collisions (at
* least for node counts up to 1e5).
*
* @param edgeId
* @return the hash code to be used
*/
private static int determineHashCode(String edgeId) {
if (edgeId.matches("\\d+->\\d+")) {
final String[] segments = edgeId.split("->");
final int sourceId = Integer.parseInt(segments[0]);
final int targetId = Integer.parseInt(segments[1]);
return sourceId * 100000 + targetId;
}
else {
return str.hashCode();
} else {
return edgeId.hashCode();
}
}
......
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