public Collection getEdgeTypeLabels() { Graph graph = graphModel.getGraph(); Object[] labels = graphModel.getEdgeTypeLabels(); ArrayList<Object> col = new ArrayList<>(labels.length); for (Object l : labels) { if (graph.getEdgeCount(graphModel.getEdgeType(l)) > 0) { col.add(l); } } return col; }
@Override public int count(Object value) { return graph.getEdgeCount(model.getEdgeType(value)); }
public void setEdgeTypeLabel(Object obj) { int id = graphModel.getEdgeType(obj); if (id != -1) { getProperties()[0].setValue(id); } } }
private Edge buildEdge(Graph graph, String id, Node source, Node target, boolean directed, Object typeLabel) { int type; if(typeLabel == null){ type = graph.getModel().getEdgeType(null); } else { //Create the type if missing: type = graph.getModel().addEdgeType(typeLabel); } Edge newEdge; if (id != null) { newEdge = graph.getModel().factory().newEdge(id, source, target, type, DEFAULT_EDGE_WEIGHT, directed); } else { newEdge = graph.getModel().factory().newEdge(source, target, type, DEFAULT_EDGE_WEIGHT, directed); } return newEdge; }