/** * {@inheritDoc} */ @Override public boolean containsEdge(E e) { return delegate.containsEdge(e); }
/** * {@inheritDoc} */ @Override public boolean containsEdge(E e) { return g1.containsEdge(e) || g2.containsEdge(e); }
public boolean containsEdge( FlowElement sourceVertex, FlowElement targetVertex ) { return graph.containsEdge( sourceVertex, targetVertex ); }
public boolean containsEdge( Scope scope ) { return graph.containsEdge( scope ); }
/** * Reports whether a vertex has at least one nonneighbour in X * * @param g A Graph * @param v A Vertex * @param X A set of vertices * @return whether v has a nonneighbour in X */ private boolean hasANonneighbourInX(Graph<V, E> g, V v, Set<V> X) { return X.stream().anyMatch(x -> !g.containsEdge(v, x)); }
/** * Reports whether v has at least one neighbour in set * * @param g A Graph * @param set A set of vertices * @param v A vertex * @return whether v has at least one neighbour in set */ private boolean hasANeighbour(Graph<V, E> g, Set<V> set, V v) { return set.stream().anyMatch(s -> g.containsEdge(s, v)); }
/** * A vertex y is X-complete if y contained in V(g)\X is adjacent to every vertex in X. * * @param g A Graph * @param y Vertex whose X-completeness is to assess * @param X Set of vertices * @return whether y is X-complete */ boolean isYXComplete(Graph<V, E> g, V y, Set<V> X) { return X.stream().allMatch(t -> g.containsEdge(t, y)); }
/** * N(a,b) is the set of all {a,b}-complete vertices * * @param g A Graph * @param a A Vertex * @param b A Vertex * @return The set of all {a,b}-complete vertices */ private Set<V> N(Graph<V, E> g, V a, V b) { return g .vertexSet().stream().filter(t -> g.containsEdge(t, a) && g.containsEdge(t, b)) .collect(Collectors.toSet()); }
/** * A triple (a,b,c) of vertices is relevant if a,b are distinct and nonadjacent, and c is not * contained in N(a,b) (possibly c is contained in {a,b}). * * @param g A graph * @param a A vertex * @param b A vertex * @param c A vertex * @return Assessement whether a,b,c is a relevant triple */ private boolean isTripleRelevant(Graph<V, E> g, V a, V b, V c) { return a != b && !g.containsEdge(a, b) && !N(g, a, b).contains(c); }
/** * {@inheritDoc} */ @Override public V getEdgeTarget(E e) { if (g1.containsEdge(e)) { return g1.getEdgeTarget(e); } if (g2.containsEdge(e)) { return g2.getEdgeTarget(e); } return null; }
/** * {@inheritDoc} */ @Override public V getEdgeSource(E e) { if (g1.containsEdge(e)) { return g1.getEdgeSource(e); } if (g2.containsEdge(e)) { return g2.getEdgeSource(e); } return null; }
/** * {@inheritDoc} */ @Override public double getEdgeWeight(E e) { if (g1.containsEdge(e) && g2.containsEdge(e)) { return operator.combine(g1.getEdgeWeight(e), g2.getEdgeWeight(e)); } if (g1.containsEdge(e)) { return g1.getEdgeWeight(e); } if (g2.containsEdge(e)) { return g2.getEdgeWeight(e); } throw new IllegalArgumentException("no such edge in the union"); }
private void writeGraph6(Graph<V, E> g, List<V> vertices) throws IOException { writeNumberOfVertices(vertices.size()); // Write the lower triangle of the adjacency matrix of G as a bit vector x of length // n(n-1)/2, // using the ordering (0,1),(0,2),(1,2),(0,3),(1,3),(2,3),...,(n-1,n). for (int i = 0; i < vertices.size(); i++) for (int j = 0; j < i; j++) writeBit(g.containsEdge(vertices.get(i), vertices.get(j))); writeByte(); // Finish writing the last byte }
private double computeLocalClusteringCoefficient(V v) { if (scores.containsKey(v)) { return scores.get(v); } NeighborCache<V, E> neighborCache = new NeighborCache<>(graph); Set<V> neighbourhood = neighborCache.neighborsOf(v); final double k = neighbourhood.size(); double numberTriplets = 0; for (V p : neighbourhood) for (V q : neighbourhood) if (graph.containsEdge(p, q)) numberTriplets++; if (k <= 1) return 0.0; else return numberTriplets / (k * (k - 1)); }
public boolean addEdge( FlowElement sourceVertex, FlowElement targetVertex, Scope scope ) { // prevent multiple edges from head or to tail if( !allowMultipleExtentEdges() && ( sourceVertex == Extent.head || targetVertex == Extent.tail ) && graph.containsEdge( sourceVertex, targetVertex ) ) return true; return graph.addEdge( sourceVertex, targetVertex, scope ); }
private V getEdgeSource(E e) { return this.workingGraph.containsEdge(e) ? this.workingGraph.getEdgeSource(e) : this.originalGraph.getEdgeSource(e); }
private V getEdgeTarget(E e) { return this.workingGraph.containsEdge(e) ? this.workingGraph.getEdgeTarget(e) : this.originalGraph.getEdgeTarget(e); }
/** * {@inheritDoc} */ @Override public boolean addEdge(V sourceVertex, V targetVertex, E e) { if (e == null) { throw new NullPointerException(); } if (!base.containsEdge(e)) { throw new IllegalArgumentException(NO_SUCH_EDGE_IN_BASE); } assertVertexExist(sourceVertex); assertVertexExist(targetVertex); assert (base.getEdgeSource(e) == sourceVertex); assert (base.getEdgeTarget(e) == targetVertex); return edgeSet.add(e); }
public Scope addEdge( FlowElement sourceVertex, FlowElement targetVertex ) { // prevent multiple edges from head or to tail if( !allowMultipleExtentEdges() && ( sourceVertex == Extent.head || targetVertex == Extent.tail ) && graph.containsEdge( sourceVertex, targetVertex ) ) return graph.getEdge( sourceVertex, targetVertex ); return graph.addEdge( sourceVertex, targetVertex ); }
public boolean containsEdge( int lhsVertex, int rhsVertex ) { return getDelegate().containsEdge( getVertex( lhsVertex ), getVertex( rhsVertex ) ); }