Set<Vertex> vertices = Sets.newHashSet();
for (Edge edge : edges) {
vertices.add(edge.getFromVertex());
vertices.add(edge.getToVertex());
if (edge instanceof TablePatternEdge) {
TablePatternEdge patternEdge = (TablePatternEdge) edge;
TripPattern pattern = patternEdge.getPattern();
patternForId.put(pattern.code, pattern);
}
}
for (Vertex vertex : vertices) {
vertexForId.put(vertex.getLabel(), vertex);