public interface GraphElementsController
This interface defines part of the Data Laboratory API basic actions.
It contains methods for manipulating the nodes and edges of the graph.
All the provided methods take care to check first that the nodes and edges to manipulate are in the graph.
Modifier and Type  Method and Description 

boolean 
areEdgesInGraph(Edge[] edges)
Checks if an array of edges are contained in the main view graph.

boolean 
areNodesInGraph(Node[] nodes)
Checks if an array of nodes are contained in the main view graph.

Edge 
createEdge(Node source,
Node target,
boolean directed)
Creates and edge between source and target node (if it does not already exist), directed or undirected, in the current graph.

Edge 
createEdge(Node source,
Node target,
boolean directed,
Graph graph)
Creates and edge between source and target node (if it does not already exist), directed or undirected.

Edge 
createEdge(Node source,
Node target,
boolean directed,
Object typeLabel)
Creates and edge between source and target node (if it does not already exist), directed or undirected, in the current graph.

Edge 
createEdge(Node source,
Node target,
boolean directed,
Object typeLabel,
Graph graph)
Creates and edge between source and target node (if it does not already exist), directed or undirected.

Edge 
createEdge(String id,
Node source,
Node target,
boolean directed)
Creates and edge between source and target node (if it does not already exist), directed or undirected.

Edge 
createEdge(String id,
Node source,
Node target,
boolean directed,
Graph graph)
Creates and edge between source and target node (if it does not already exist), directed or undirected, in the current graph.

Edge 
createEdge(String id,
Node source,
Node target,
boolean directed,
Object typeLabel)
Creates and edge between source and target node (if it does not already exist), directed or undirected.

Edge 
createEdge(String id,
Node source,
Node target,
boolean directed,
Object typeLabel,
Graph graph)
Creates and edge between source and target node (if it does not already exist), directed or undirected, in the current graph.

void 
createEdges(Node source,
Node[] allNodes,
boolean directed)
Tries to create edges between the source node and all other edges, directed or undirected.

Node 
createNode(String label)
Creates a node with default id and the given label in the current graph.

Node 
createNode(String label,
Graph graph)
Creates a node with default id and the given label.

Node 
createNode(String label,
String id)
Creates a node with the given id and label in the current graph.

Node 
createNode(String label,
String id,
Graph graph)
Creates a node with the given id and label.

void 
deleteEdge(Edge edge)
Tries to delete an edge checking first if it is on the graph.

void 
deleteEdges(Edge[] edges)
Tries to delete an array of edges checking first if they are on the graph.

void 
deleteEdgesWithNodes(Edge[] edges,
boolean deleteSource,
boolean deleteTarget)
Tries to delete an array of edges checking first if they are on the graph
and also deletes their source and target node if it is indicated.

void 
deleteEdgeWithNodes(Edge edge,
boolean deleteSource,
boolean deleteTarget)
Tries to delete an edge checking first if it is on the graph
and also deletes its source and target node if it is indicated.

void 
deleteNode(Node node)
Tries to delete a node checking first if it is on the graph.

void 
deleteNodes(Node[] nodes)
Tries to delete an array of nodes checking first if they are on the graph.

Node 
duplicateNode(Node node)
Duplicates a node if it is in the graph, and returns the new node.

void 
duplicateNodes(Node[] nodes)
Tries to duplicate an array of nodes with the same behaviour as
duplicateNode method. 
int 
getEdgesCount()
Returns the number of edges in the graph.

Edge[] 
getNodeEdges(Node node)
Prepares and returns an array with the edges incident to the specified node.

Node[] 
getNodeNeighbours(Node node)
Prepares and returns an array with the neighbour nodes of the specified node.

int 
getNodesCount()
Returns the number of nodes in the graph.

boolean 
isEdgeInGraph(Edge edge)
Checks if an edge is contained in the main view graph.

boolean 
isNodeFixed(Node node)
Checks the fixed state of a node.

boolean 
isNodeInGraph(Node node)
Checks if a node is contained in the main view graph.

Node 
mergeNodes(Graph graph,
Node[] nodes,
Node selectedNode,
Column[] columns,
AttributeRowsMergeStrategy[] mergeStrategies,
boolean deleteMergedNodes)
Merges 2 or more nodes into a new one node that has all the edges of the merged nodes.

void 
setNodeFixed(Node node,
boolean fixed)
Sets the fixed state of a node to the indicated.

void 
setNodesFixed(Node[] nodes,
boolean fixed)
Sets the fixed state of an array of nodes to the indicated.

Node createNode(String label)
label
 Label for the nodeNode createNode(String label, Graph graph)
label
 Label for the nodegraph
 Graph to insert the node intoNode createNode(String label, String id)
Creates a node with the given id and label in the current graph.
If a node with that id already exists, no node will be created
label
 Label for the nodeid
 Id for the nodeNode createNode(String label, String id, Graph graph)
Creates a node with the given id and label.
If a node with that id already exists, no node will be created
label
 Label for the nodeid
 Id for the nodegraph
 Graph to insert the node intoNode duplicateNode(Node node)
Duplicates a node if it is in the graph, and returns the new node.
If the node has children, they are also copied as children of the new node.
Sets the same properties and attributes for the node as the original node: id, label and AttributeColumns
with DATA
AttributeOrigin
.
Does not copy AttributeColumns
with COMPUTED
AttributeOrigin
.
node
 Node to copyvoid duplicateNodes(Node[] nodes)
duplicateNode
method.nodes
 Array of nodes to duplicateEdge createEdge(Node source, Node target, boolean directed)
Creates and edge between source and target node (if it does not already exist), directed or undirected, in the current graph.
source
 Source nodetarget
 Target nodedirected
 Indicates if the edge has to be directedEdge createEdge(Node source, Node target, boolean directed, Object typeLabel)
Creates and edge between source and target node (if it does not already exist), directed or undirected, in the current graph.
source
 Source nodetarget
 Target nodedirected
 Indicates if the edge has to be directedtypeLabel
 Edge type label or nullEdge createEdge(Node source, Node target, boolean directed, Graph graph)
Creates and edge between source and target node (if it does not already exist), directed or undirected.
source
 Source nodetarget
 Target nodedirected
 Indicates if the edge has to be directedgraph
 Graph to insert the node intoEdge createEdge(Node source, Node target, boolean directed, Object typeLabel, Graph graph)
Creates and edge between source and target node (if it does not already exist), directed or undirected.
source
 Source nodetarget
 Target nodedirected
 Indicates if the edge has to be directedtypeLabel
 Edge type label or nullgraph
 Graph to insert the node intoEdge createEdge(String id, Node source, Node target, boolean directed)
Creates and edge between source and target node (if it does not already exist), directed or undirected.
If a edge with the given id already exists, no edge will be created.
id
 Id for the new edgesource
 Source nodetarget
 Target nodedirected
 Indicates if the edge has to be directedEdge createEdge(String id, Node source, Node target, boolean directed, Object typeLabel)
Creates and edge between source and target node (if it does not already exist), directed or undirected.
If a edge with the given id already exists, no edge will be created.
id
 Id for the new edgesource
 Source nodetarget
 Target nodedirected
 Indicates if the edge has to be directedtypeLabel
 Edge type label or nullEdge createEdge(String id, Node source, Node target, boolean directed, Graph graph)
Creates and edge between source and target node (if it does not already exist), directed or undirected, in the current graph.
If a edge with the given id already exists, no edge will be created.
id
 Id for the new edgesource
 Source nodetarget
 Target nodedirected
 Indicates if the edge has to be directedgraph
 Graph to insert the node intoEdge createEdge(String id, Node source, Node target, boolean directed, Object typeLabel, Graph graph)
Creates and edge between source and target node (if it does not already exist), directed or undirected, in the current graph.
If a edge with the given id already exists, no edge will be created.
id
 Id for the new edgesource
 Source nodetarget
 Target nodedirected
 Indicates if the edge has to be directedtypeLabel
 Edge type label or nullgraph
 Graph to insert the node intovoid createEdges(Node source, Node[] allNodes, boolean directed)
Tries to create edges between the source node and all other edges, directed or undirected.
An edge won't be created if it already exists or is a selfloop.
source
 Source nodeallNodes
 All edgesdirected
 Indicates if the edges have to be directedvoid deleteNode(Node node)
node
 Node to deletevoid deleteNodes(Node[] nodes)
nodes
 Array of nodes to deletevoid deleteEdge(Edge edge)
edge
 Edge to deletevoid deleteEdges(Edge[] edges)
edges
 Array of edges to deletevoid deleteEdgeWithNodes(Edge edge, boolean deleteSource, boolean deleteTarget)
edge
 Edge to deletedeleteSource
 Indicates if the source node has to be deleteddeleteTarget
 Indicates if the target node has to be deletedvoid deleteEdgesWithNodes(Edge[] edges, boolean deleteSource, boolean deleteTarget)
edges
 Array of edges to deletedeleteSource
 Indicates if the source nodes have to be deleteddeleteTarget
 Indicates if the target nodes have to be deletedNode mergeNodes(Graph graph, Node[] nodes, Node selectedNode, Column[] columns, AttributeRowsMergeStrategy[] mergeStrategies, boolean deleteMergedNodes)
graph
 Graph that contains the nodesnodes
 Nodes to merge (at least 1)selectedNode
 Main selected node of the nodes to merge (or null to use first node)columns
 Columns to apply a merge strategy in each rowmergeStrategies
 Strategies to merge rows of each column in columns
deleteMergedNodes
 Indicates if merged nodes should be deletedvoid setNodeFixed(Node node, boolean fixed)
node
 Node to set fixed statefixed
 Fixed state for the nodevoid setNodesFixed(Node[] nodes, boolean fixed)
nodes
 Array of nodes to set fixed statefixed
 Fixed state for the nodesboolean isNodeFixed(Node node)
node
 Node to checkNode[] getNodeNeighbours(Node node)
node
 Node to get neighboursEdge[] getNodeEdges(Node node)
node
 Node to get edgesint getNodesCount()
int getEdgesCount()
boolean isNodeInGraph(Node node)
node
 Node to checkboolean areNodesInGraph(Node[] nodes)
nodes
 Array of nodes to checkboolean isEdgeInGraph(Edge edge)
edge
 Edge to checkboolean areEdgesInGraph(Edge[] edges)
edges
 Edges to checkCopyright © 2007–2015 Gephi Consortium. All rights reserved.