Class StronglyConnectedComponents<U>
java.lang.Object
es.uam.eps.ir.relison.sna.community.detection.connectedness.StronglyConnectedComponents<U>
- Type Parameters:
U
- Type of the users.
- All Implemented Interfaces:
CommunityDetectionAlgorithm<U>
public class StronglyConnectedComponents<U> extends java.lang.Object implements CommunityDetectionAlgorithm<U>
Computes communities via the Strongly Connected Components.
-
Field Summary
Fields Modifier and Type Field Description private int
time
-
Constructor Summary
Constructors Constructor Description StronglyConnectedComponents()
-
Method Summary
Modifier and Type Method Description Communities<U>
detectCommunities(Graph<U> graph)
Computes the communities for a certain graph.private java.util.Collection<java.util.Collection<U>>
findSCC(Graph<U> g)
Finds the strongly connected components of the graph.private void
transposedVisit(U u, Graph<U> g, java.util.Set<U> discovered, java.util.Collection<U> component)
Visits a node by using the inlinksprivate void
visit(U u, Graph<U> g, java.util.Set<U> discovered, java.util.Map<U,java.lang.Integer> processed)
Visits a node by using the outlinks
-
Field Details
-
time
private int time
-
-
Constructor Details
-
StronglyConnectedComponents
public StronglyConnectedComponents()
-
-
Method Details
-
detectCommunities
Description copied from interface:CommunityDetectionAlgorithm
Computes the communities for a certain graph.- Specified by:
detectCommunities
in interfaceCommunityDetectionAlgorithm<U>
- Parameters:
graph
- The full graph.- Returns:
- The communities if everything went OK, null if not.
-
findSCC
Finds the strongly connected components of the graph.- Parameters:
g
- The graph.- Returns:
- The strongly connected clusters of the graph.
-
visit
private void visit(U u, Graph<U> g, java.util.Set<U> discovered, java.util.Map<U,java.lang.Integer> processed)Visits a node by using the outlinks- Parameters:
u
- The starting node.g
- The graph.discovered
- The discovered items.processed
- The processed items.
-
transposedVisit
private void transposedVisit(U u, Graph<U> g, java.util.Set<U> discovered, java.util.Collection<U> component)Visits a node by using the inlinks- Parameters:
u
- The starting node.g
- The graph.discovered
- The dsiscovered items.component
- The component.
-