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 boolean
addAllEdges(Collection<? extends Edge> edges)
Adds a collection of edges to this subgraph.boolean
addAllNodes(Collection<? extends Node> nodes)
Adds a collection of nodes to this subgraph.boolean
addEdge(Edge edge)
Adds an edge to this subgraph.boolean
addNode(Node node)
Adds a node to this subgraph.void
fill()
Fills the subgraph so all elements in the graph are in the subgraph.Graph
getRootGraph()
Return the root graph this subgraph is based on.GraphView
getView()
Gets the view associated with this subgraph.void
intersection(Subgraph subGraph)
Intersects the given subgraph with this sugbgraph.void
not()
Inverse this subgraph so all elements in the graph are removed and all elements not in the graph are added.boolean
removeAllEdges(Collection<? extends Edge> edges)
Removes a collection of edges from this subgraph.boolean
removeAllNodes(Collection<? extends Node> nodes)
Removes a collection of nodes from this subgraph.boolean
removeEdge(Edge edge)
Removes an edge from this subgraph.boolean
removeNode(Node node)
Removes a node from this subgraph.void
union(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:
addAllNodes
in 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:
addAllEdges
in 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:
removeNode
in 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:
removeAllNodes
in interfaceGraph
- Parameters:
nodes
- the nodes to remove- Returns:
- true if at least a node is 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:
removeEdge
in 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:
removeAllEdges
in interfaceGraph
- Parameters:
edges
- the edges to remove- Returns:
- true if at least an 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.
-
-