Cytoscape 2.8.0 API

## cytoscape.util Class GraphSetUtils

```java.lang.Object
cytoscape.util.GraphSetUtils
```

`public class GraphSetUtilsextends Object`

Class contains various static methods to perform set-like operations on graph.

Author:
Ryan Kelley

Field Summary
`protected static int` `DIFFERENCE`

`protected static int` `DIFFERENCE2`

`protected static int` `INTERSECTION`

`protected static int` `UNION`
The different types of network graph operations

Constructor Summary
`GraphSetUtils()`

Method Summary
`static CyNetwork` ```createDifferenceGraph(List networkList, boolean copyView, String title)```
Create a new graph which is the difference of multiple graphs.
`static CyNetwork` ```createDifferenceGraph2(List networkList, boolean copyView, String title)```
The way this works is that the 2nd and optional additional networks will be subtracted from the 1st network.
`static CyNetwork` ```createIntersectionGraph(List networkList, boolean copyView, String title)```
Create a new graph which is the intersection of multiple graphs.
`static CyNetwork` ```createUnionGraph(List networkList, boolean copyView, String title)```
Create a new graph which is the union of multiple graphs.
`protected static int[]` `differenceEdges(List networkList)`
Determine the set of difference edges.
`protected static int[]` ```differenceEdges2(List networkList, int[] nodes)```
Determine the set of difference edges.
`protected static int[]` ```differenceNodes(List networkList, int[] edges)```
Determine the set of difference nodes.
`protected static int[]` `differenceNodes2(List networkList)`
Returns the nodes of the 1st network that are not contained in any of the other networks.
`protected static int[]` `intersectEdges(List networkList)`
Apply a simple intersection operation to the edge sets
`protected static int[]` `intersectNodes(List networkList)`
Apply a simple intersection operation to the node sets
`protected static CyNetwork` ```performNetworkOperation(List networkList, int operation, boolean copyView, String title)```
Protected helper function that actually does the heavy lifting to perform the set operations.
`protected static int[]` `unionizeEdges(List networkList)`
Perform a simple set union on the sets of nodes
`protected static int[]` `unionizeNodes(List networkList)`
Makes nodes request overtime pay.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### UNION

`protected static final int UNION`
The different types of network graph operations

Constant Field Values

### INTERSECTION

`protected static final int INTERSECTION`
Constant Field Values

### DIFFERENCE

`protected static final int DIFFERENCE`
Constant Field Values

### DIFFERENCE2

`protected static final int DIFFERENCE2`
Constant Field Values
Constructor Detail

### GraphSetUtils

`public GraphSetUtils()`
Method Detail

### createUnionGraph

```public static CyNetwork createUnionGraph(List networkList,
boolean copyView,
String title)```
Create a new graph which is the union of multiple graphs. The union graph is created by applying the set union on both the edges and the nodes.

Parameters:
`networkList` - A list containing all of the networks.
`copyView` - This argument is ignored.
`title` - The title of the new network
Returns:
A cyNetwork which is the union of the input graphs

### createIntersectionGraph

```public static CyNetwork createIntersectionGraph(List networkList,
boolean copyView,
String title)```
Create a new graph which is the intersection of multiple graphs. The intersection graph is created by applying the set intersection on both the edges and the nodes.

Parameters:
`networkList` - A list containing all of the networks.
`copyView` - This argument is ignored.
`title` - The title of the new network
Returns:
A cyNetwork which is the intersection of the input graphs

### createDifferenceGraph

```public static CyNetwork createDifferenceGraph(List networkList,
boolean copyView,
String title)```
Create a new graph which is the difference of multiple graphs. Note that this is not the symmetric difference. The second graph in the list (and the third and the fourth ... ) are subtracted from the first graph. Here, we can not directly apply the set difference on the nodes and edge sets and get a valid graph. Therefore, we apply the difference operation on the edge sets firsts and add those nodes in the node difference set which are required for those edges to exist.

Parameters:
`networkList` - A list containing all of the networks.
`copyView` - This argument is ignored.
`title` - The title of the new network
Returns:
A cyNetwork which is the difference of the input graphs

### createDifferenceGraph2

```public static CyNetwork createDifferenceGraph2(List networkList,
boolean copyView,
String title)```
The way this works is that the 2nd and optional additional networks will be subtracted from the 1st network. The way this works is that all the nodes and edges in the 2nd and consecutive networks will be removed from the 1st network.

Parameters:
`networkList` - A list containing all of the networks.
`copyView` - This argument is ignored.
`title` - The title of the resulting, new network
Returns:
A cyNetwork which is the difference of the input graphs

### performNetworkOperation

```protected static CyNetwork performNetworkOperation(List networkList,
int operation,
boolean copyView,
String title)```
Protected helper function that actually does the heavy lifting to perform the set operations. For explantion of the input parameters, see any of the public methods.

Returns:
cyNetwork created from applying this set operation

### differenceEdges

`protected static int[] differenceEdges(List networkList)`
Determine the set of difference edges. This apply a straight set difference operation to the edge sets.

Parameters:
`networkList` - A lists containing cyNetworks
Returns:
an integer array containing the set of edges in the difference

### differenceNodes2

`protected static int[] differenceNodes2(List networkList)`
Returns the nodes of the 1st network that are not contained in any of the other networks.

Parameters:
`networkList` - A lists containing cyNetworks
Returns:
an integer array containing the set of nodes in the difference

### differenceNodes

```protected static int[] differenceNodes(List networkList,
int[] edges)```
Determine the set of difference nodes. In order to perform this operation we also have to know the set of edges in the edge difference, so that we can make sure that any nodes are present that are required by those edges

Parameters:
`networkList` - A lists containing cyNetworks
`edges` - The difference set of edges
Returns:
an integer array containing the set of edges in the difference

### differenceEdges2

```protected static int[] differenceEdges2(List networkList,
int[] nodes)```
Determine the set of difference edges. In order to perform this operation we also have to know the set of nodes in the node difference, so that we can make sure that any edges are present that are required by those nodes

Parameters:
`networkList` - A lists containing cyNetworks
`nodes` - The difference set of nodes
Returns:
an integer array containing the set of nodes in the difference

### intersectNodes

`protected static int[] intersectNodes(List networkList)`
Apply a simple intersection operation to the node sets

Parameters:
`networkList` - A list of cyNetworks
Returns:
an integer array which contains the indices of nodes in the intersection

### intersectEdges

`protected static int[] intersectEdges(List networkList)`
Apply a simple intersection operation to the edge sets

Parameters:
`networkList` - A list of cyNetworks
Returns:
an integer array which contains the indices of edges in the intersection

### unionizeNodes

`protected static int[] unionizeNodes(List networkList)`
Makes nodes request overtime pay.

Parameters:
`networkList` - a list of cyNetworks
Returns:
an integer array containing the indices of nodes in the union

### unionizeEdges

`protected static int[] unionizeEdges(List networkList)`
Perform a simple set union on the sets of nodes

Parameters:
`networkList` - a list of cyNetworks
Returns:
an integer array containing the indices of edges in the union

Cytoscape 2.8.0 API