Package org.graphstream.algorithm
Class ConnectedComponents.ConnectedComponent
java.lang.Object
org.graphstream.algorithm.ConnectedComponents.ConnectedComponent
- All Implemented Interfaces:
org.graphstream.graph.Structure
- Enclosing class:
- ConnectedComponents
public class ConnectedComponents.ConnectedComponent extends Object implements org.graphstream.graph.Structure
A representation of a connected component. These objects are used to
store informations about components and to allow to iterate over all
nodes of a same component.
You can retrieve these objects using the
ConnectedComponents.getConnectedComponentOf(Node)
methods of the
algorithm.-
Field Summary
Fields Modifier and Type Field Description int
id
The unique id of this component. -
Method Summary
Modifier and Type Method Description boolean
contains(org.graphstream.graph.Node n)
Test if this component contains a given node.Stream<org.graphstream.graph.Edge>
edges()
Return an stream over the edge of this component.int
getEdgeCount()
int
getNodeCount()
Set<org.graphstream.graph.Node>
getNodeSet()
Get a set containing all the nodes of this component.Stream<org.graphstream.graph.Node>
nodes()
Return an stream over the nodes of this component.String
toString()
-
Field Details
-
id
public final int idThe unique id of this component. The uniqueness of the id is local to an instance of theConnectedComponents
algorithm.
-
-
Method Details
-
nodes
Return an stream over the nodes of this component.- Specified by:
nodes
in interfaceorg.graphstream.graph.Structure
- Returns:
- an stream over the nodes of this component
-
getNodeSet
Get a set containing all the nodes of this component. A new set is built for each call to this method, so handle with care.- Returns:
- a new set of nodes belonging to this component
-
edges
Return an stream over the edge of this component. An edge is in the component if the two ends of this edges are in the component and the edge does not have the cut attribute. Note that, using cut attribute, some edges can be in none of the components.- Specified by:
edges
in interfaceorg.graphstream.graph.Structure
- Returns:
- an stream over the edges of this component
-
contains
public boolean contains(org.graphstream.graph.Node n)Test if this component contains a given node.- Parameters:
n
- a node- Returns:
- true if the node is in this component
-
toString
-
getNodeCount
public int getNodeCount()- Specified by:
getNodeCount
in interfaceorg.graphstream.graph.Structure
-
getEdgeCount
public int getEdgeCount()- Specified by:
getEdgeCount
in interfaceorg.graphstream.graph.Structure
-