Find In-and-Out Components of Graphs
This example finds the largest strongly connected component of a directed graph, along with the corresponding in-and-out components.
g = [image];bigComponent = Last@SortBy[ConnectedComponents[g], Length];name = {"Largest strongly connected component", "In-component", "Out-component", "Other components"};info = {HighlightGraph[g, Subgraph[g, #], GraphHighlightStyle -> "DehighlightFade"]}& /@ {bigComponent, VertexInComponent[g, bigComponent], VertexOutComponent[g, bigComponent], Complement[VertexList[g], VertexInComponent[g, bigComponent], VertexOutComponent[g, bigComponent]]};ShowPlotSamples[name_, info_] := Framed[Column[{Style[name, 14, Bold, FontFamily -> "Verdana"], Grid[{info}, Spacings -> {1, 0}]}, Alignment -> Center], RoundingRadius -> 9, FrameStyle -> None, Background -> GrayLevel@0.90];Column[MapThread[ShowPlotSamples, {name, info}]]