/** * Adds {@code edge} to this graph with the specified {@code endpoints}, * with the default edge type. * * @param edge the edge to be added * @param endpoints the endpoints to be connected to this edge * @return {@code true} iff the graph was modified as a result of this call */ public boolean addEdge(E edge, Pair<? extends V> endpoints) { return addEdge(edge, endpoints, this.getDefaultEdgeType()); }
public boolean addEdge(E edge, Collection<? extends V> vertices) { return addEdge(edge, vertices, this.getDefaultEdgeType()); }
/** * Adds {@code edge} to this graph with the specified {@code endpoints}, * with the default edge type. * * @return {@code} true iff the graph was modified as a result of this call */ public boolean addEdge(E edge, Pair<? extends V> endpoints) { return addEdge(edge, endpoints, this.getDefaultEdgeType()); }
public boolean addEdge(E e, V v1, V v2) { return addEdge(e, v1, v2, this.getDefaultEdgeType()); }
public boolean addEdge(E e, V v1, V v2, EdgeType edge_type) { return addEdge(e, new Pair<V>(v1, v2), edge_type); }
@Override public boolean addEdge(E edge, Collection<? extends V> vertices) { return addEdge(edge, vertices, this.getDefaultEdgeType()); }
@Override public boolean addEdge(E e, V v1, V v2) { return addEdge(e, v1, v2, this.getDefaultEdgeType()); }
@Override public boolean addEdge(E e, V v1, V v2, EdgeType edge_type) { return addEdge(e, new Pair<V>(v1, v2), edge_type); }
@SuppressWarnings("unchecked") public boolean addEdge(E edge, Collection<? extends V> vertices, EdgeType edgeType) { if (vertices == null) throw new IllegalArgumentException("'vertices' parameter must not be null"); if (vertices.size() == 2) return addEdge(edge, vertices instanceof Pair ? (Pair<V>)vertices : new Pair<V>(vertices), edgeType); else if (vertices.size() == 1) { V vertex = vertices.iterator().next(); return addEdge(edge, new Pair<V>(vertex, vertex), edgeType); } else throw new IllegalArgumentException("Graph objects connect 1 or 2 vertices; vertices arg has " + vertices.size()); }
@Override @SuppressWarnings("unchecked") public boolean addEdge(E edge, Collection<? extends V> vertices, EdgeType edgeType) { if (vertices == null) { throw new IllegalArgumentException( "'vertices' parameter must not be null"); } if (vertices.size() == 2) { return addEdge(edge, vertices instanceof Pair ? (Pair<V>) vertices : new Pair<V>(vertices), edgeType); } else if (vertices.size() == 1) { V vertex = vertices.iterator().next(); return addEdge(edge, new Pair<V>(vertex, vertex), edgeType); } else { throw new IllegalArgumentException( "Graph objects connect 1 or 2 vertices; vertices arg has " + vertices.size()); } }