Search this API

y.algo
Class ParallelEdges

java.lang.Object
  extended by y.algo.ParallelEdges

public class ParallelEdges
extends java.lang.Object

This class provides methods for finding the parallel edges in a graph, also called multiple edges or multi-edges.

Parallel edges are edges which are incident to the same two nodes. In the undirected case, the direction does not matter. In the directed case, two parallel edges require to both have the same source and target node.

The graph example below shows several sets of parallel edges. There are four parallel edges connecting the left and the middle node. There are two parallel edges connecting the middle and the right node, however, they are only parallel in the undirected case. Finally, there are two parallel self-loops at the right node.


This graph contains three (two) sets of undirected (directed) parallel edges

 
Your browser does not support SVG content.

Method Summary
static EdgeList[] findParallelEdges(Graph graph, boolean directed)
          Finds and returns all parallel edges in the given graph.
static EdgeList[] findParallelEdges(Graph graph, boolean directed, Node node)
          Finds and returns the parallel edges in the given graph, or, optionally, incident to the given node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

findParallelEdges

public static EdgeList[] findParallelEdges(Graph graph,
                                           boolean directed)
Finds and returns all parallel edges in the given graph.

Parallel edges are edges which are incident to the same two nodes. In the directed case, it is required that two parallel edges have the same source and target node.

Parameters:
graph - the input graph
directed - true, if parallel edges need to have same source and same target, false, if it suffices that parallel edges are incident to the same two nodes
Returns:
the array of all parallel edges contained in the given graph, where each list represents a set of parallel edges

findParallelEdges

public static EdgeList[] findParallelEdges(Graph graph,
                                           boolean directed,
                                           Node node)
Finds and returns the parallel edges in the given graph, or, optionally, incident to the given node.

Parallel edges are edges which are incident to the same two nodes. In the directed case, it is required that two parallel edges have the same source and target node.

Parameters:
graph - the input graph
directed - true, if parallel edges need to have same source and same target, false, if it suffices that parallel edges are incident to the same two nodes
node - the node to which the parallel edges must be incident to or null if all parallel edges in the graph should be returned
Returns:
the array of all parallel edges incident to the given node or contained in the given graph, where each list represents a set of parallel edges

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.