グラフの入成分と出成分を求める
この例では,有向グラフの最も強連結の成分を,対応する入成分と出成分とともに求める.
g = [image];bigComponent = Last@SortBy[ConnectedComponents[g], Length];name = {"最も強連結の成分", "入成分", "出成分", "その他の成分"};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}]]