Interface Subgraph
-
- All Superinterfaces:
Graph
- All Known Subinterfaces:
DirectedSubgraph,UndirectedSubgraph
public interface Subgraph extends Graph
A subgraph is a subset of a graph based on a graph view.A subgraph has the same or less elements compared to the graph it's based on. This interface inherits from Graph and all read operations behave in a similar fashion. For instance, calling getNodes will return only nodes in this subgraph. However, write operations such as addNode or removeNode are used to control which elements are part of the view.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanaddAllEdges(Collection<? extends Edge> edges)Adds a collection of edges to this subgraph.booleanaddAllNodes(Collection<? extends Node> nodes)Adds a collection of nodes to this subgraph.booleanaddEdge(Edge edge)Adds an edge to this subgraph.booleanaddNode(Node node)Adds a node to this subgraph.voidfill()Fills the subgraph so all elements in the graph are in the subgraph.GraphgetRootGraph()Return the root graph this subgraph is based on.GraphViewgetView()Gets the view associated with this subgraph.voidintersection(Subgraph subGraph)Intersects the given subgraph with this sugbgraph.voidnot()Inverse this subgraph so all elements in the graph are removed and all elements not in the graph are added.booleanremoveAllEdges(Collection<? extends Edge> edges)Removes a collection of edges from this subgraph.booleanremoveAllNodes(Collection<? extends Node> nodes)Removes a collection of nodes from this subgraph.booleanremoveEdge(Edge edge)Removes an edge from this subgraph.booleanremoveNode(Node node)Removes a node from this subgraph.booleanretainEdges(Collection<? extends Edge> edges)Retains only edges in this subgraph that are contained in the specified collection.booleanretainNodes(Collection<? extends Node> nodes)Retains only nodes in this subgraph that are contained in the specified collection.voidunion(Subgraph subGraph)Unions the given subgraph with this sugbgraph.-
Methods inherited from interface org.gephi.graph.api.Graph
clear, clearEdges, clearEdges, clearEdges, contains, contains, getAttribute, getAttribute, getAttribute, getAttributeKeys, getDegree, getEdge, getEdge, getEdge, getEdgeCount, getEdgeCount, getEdges, getEdges, getEdges, getEdges, getEdges, getEdges, getLock, getModel, getNeighbors, getNeighbors, getNode, getNodeCount, getNodes, getOpposite, getSelfLoops, getVersion, hasEdge, hasNode, isAdjacent, isAdjacent, isDirected, isDirected, isIncident, isIncident, isMixed, isSelfLoop, isUndirected, readLock, readUnlock, readUnlockAll, removeAttribute, removeAttribute, removeAttribute, setAttribute, setAttribute, setAttribute, writeLock, writeUnlock
-
-
-
-
Method Detail
-
getView
GraphView getView()
Gets the view associated with this subgraph.
-
getRootGraph
Graph getRootGraph()
Return the root graph this subgraph is based on.- Returns:
- the root graph
-
addNode
boolean addNode(Node node)
Adds a node to this subgraph.The node should be part of the root graph.
-
addAllNodes
boolean addAllNodes(Collection<? extends Node> nodes)
Adds a collection of nodes to this subgraph.The nodes should be part of the root graph.
- Specified by:
addAllNodesin interfaceGraph- Parameters:
nodes- the nodes to add- Returns:
- true if at least a node has been added, false otherwise
-
addEdge
boolean addEdge(Edge edge)
Adds an edge to this subgraph.The edge should be part of the root graph.
-
addAllEdges
boolean addAllEdges(Collection<? extends Edge> edges)
Adds a collection of edges to this subgraph.The edges should be part of the root graph.
- Specified by:
addAllEdgesin interfaceGraph- Parameters:
edges- the edges to add- Returns:
- true if at least an edge has been added, false otherwise
-
removeNode
boolean removeNode(Node node)
Removes a node from this subgraph.The node should be part of the root graph.
- Specified by:
removeNodein interfaceGraph- Parameters:
node- the node to remove- Returns:
- true if removed, false otherwise
-
removeAllNodes
boolean removeAllNodes(Collection<? extends Node> nodes)
Removes a collection of nodes from this subgraph.The nodes should be part of the root graph.
- Specified by:
removeAllNodesin interfaceGraph- Parameters:
nodes- the nodes to remove- Returns:
- true if at least a node is removed, false otherwise
-
retainNodes
boolean retainNodes(Collection<? extends Node> nodes)
Retains only nodes in this subgraph that are contained in the specified collection.The nodes should be part of the root graph.
- Specified by:
retainNodesin interfaceGraph- Parameters:
nodes- the node collection- Returns:
- true if at least one node has been removed, false otherwise
-
removeEdge
boolean removeEdge(Edge edge)
Removes an edge from this subgraph.The edge should be part of the root graph.
- Specified by:
removeEdgein interfaceGraph- Parameters:
edge- the edge to remove- Returns:
- true if removed, false otherwise
-
removeAllEdges
boolean removeAllEdges(Collection<? extends Edge> edges)
Removes a collection of edges from this subgraph.The edges should be part of the root graph.
- Specified by:
removeAllEdgesin interfaceGraph- Parameters:
edges- the edges to remove- Returns:
- true if at least an edge has been removed, false otherwise
-
retainEdges
boolean retainEdges(Collection<? extends Edge> edges)
Retains only edges in this subgraph that are contained in the specified collection.The edges should be part of the root graph.
- Specified by:
retainEdgesin interfaceGraph- Parameters:
edges- the edge collection- Returns:
- true if at least one edge has been removed, false otherwise
-
fill
void fill()
Fills the subgraph so all elements in the graph are in the subgraph.
-
union
void union(Subgraph subGraph)
Unions the given subgraph with this sugbgraph.The given subgraph remains unchanged.
- Parameters:
subGraph- the subgraph to do the union with
-
intersection
void intersection(Subgraph subGraph)
Intersects the given subgraph with this sugbgraph.The given subgraph remains unchanged.
- Parameters:
subGraph- the subgraph to do the intersection with
-
not
void not()
Inverse this subgraph so all elements in the graph are removed and all elements not in the graph are added.
-
-