MCPcopy Index your code
hub / github.com/antlr/codebuff / parallelEdges

Method parallelEdges

output/java_guava/1.4.17/Graphs.java:85–97  ·  view source on GitHub ↗

Returns an unmodifiable view of edges that are parallel to edge, i.e. the set of edges that connect the same nodes in the same direction (if any). An edge is not parallel to itself. @throws UnsupportedOperationException if graph is a Hypergraph @throws IllegalArgumentExcepti

(Network<N, E> graph, Object edge)

Source from the content-addressed store, hash-verified

83
84
85 public static <N, E> Set<E> parallelEdges(Network<N, E> graph, Object edge) {
86 if (graph instanceof Hypergraph) {
87 throw new UnsupportedOperationException();
88 }
89 Set<N> incidentNodes = graph.incidentNodes(edge); // Verifies that edge is in graph
90 if (!graph.allowsParallelEdges()) {
91 return ImmutableSet.of();
92 }
93 Iterator<N> incidentNodesIterator = incidentNodes.iterator();
94 N node1 = incidentNodesIterator.next();
95 N node2 = incidentNodesIterator.hasNext() ? incidentNodesIterator.next() : node1;
96 return Sets.difference(graph.edgesConnecting(node1, node2), ImmutableSet.of(edge));
97 }
98
99 /**
100 * Adds {@code edge} to {@code graph} with the specified incident {@code nodes}, in the order

Callers

nothing calls this directly

Calls 8

ofMethod · 0.95
differenceMethod · 0.95
incidentNodesMethod · 0.65
allowsParallelEdgesMethod · 0.65
iteratorMethod · 0.65
nextMethod · 0.65
edgesConnectingMethod · 0.65
hasNextMethod · 0.45

Tested by

no test coverage detected