Commit 33cd728a authored by Roland Kluge's avatar Roland Kluge
Browse files

Add shortcut in BasicGraph#getEdge

parent fb050fbf
...@@ -381,7 +381,9 @@ public class BasicGraph implements Graph { ...@@ -381,7 +381,9 @@ public class BasicGraph implements Graph {
if (!this.containsNode(to)) if (!this.containsNode(to))
return null; return null;
// TODO@rkluge: May be a performance issue. if (!this.containsEdge(from, to))
return null;
final Set<IEdge> outgoingEdgesOfFrom = this.outgoingAdjacencyList.get(from); final Set<IEdge> outgoingEdgesOfFrom = this.outgoingAdjacencyList.get(from);
for (final IEdge outgoingEdgeOfFrom : outgoingEdgesOfFrom) { for (final IEdge outgoingEdgeOfFrom : outgoingEdgesOfFrom) {
if (outgoingEdgeOfFrom.toId().equals(to)) { if (outgoingEdgeOfFrom.toId().equals(to)) {
...@@ -402,6 +404,9 @@ public class BasicGraph implements Graph { ...@@ -402,6 +404,9 @@ public class BasicGraph implements Graph {
if (!this.containsNode(to)) if (!this.containsNode(to))
return resultSet; return resultSet;
if (!this.containsEdge(from, to))
return resultSet;
final Set<IEdge> outgoingEdgesOfFrom = this.outgoingAdjacencyList.get(from); final Set<IEdge> outgoingEdgesOfFrom = this.outgoingAdjacencyList.get(from);
for (final IEdge outgoingEdgeOfFrom : outgoingEdgesOfFrom) { for (final IEdge outgoingEdgeOfFrom : outgoingEdgesOfFrom) {
if (outgoingEdgeOfFrom.toId().equals(to)) { if (outgoingEdgeOfFrom.toId().equals(to)) {
......
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