condensation
Graph condensation
Syntax
Description
Examples
Condense Strongly Connected Components into Single Nodes
Create and plot a graph that contains several strongly connected components. Highlight the strongly connected components.
s = [1 1 2 3 3 4 4 4 4 5 5 6 6 6 7 8 8 9 9 10 10 10 11 11 12 13 13 14 15]; t = [1 3 1 2 5 1 2 12 13 6 8 7 8 10 10 9 10 5 11 9 11 14 12 14 13 11 15 13 14]; G = digraph(s,t); p = plot(G);
bins = conncomp(G); p.MarkerSize = 7; p.NodeCData = bins; colormap(hsv(4))
Use condensation
to represent each component as a single node. Color the nodes based on the components they represent.
C = condensation(G); p2 = plot(C); p2.MarkerSize = 7; p2.NodeCData = 1:4; colormap(hsv(4))
Input Arguments
G
— Input graph
digraph
object
Input graph, specified as a digraph
object. Use digraph
to create a directed graph object.
Example: G = digraph([1 2],[2 3])
Output Arguments
C
— Condensation graph
digraph
object
Condensation graph, returned as a digraph
object.
C
is a directed acyclic graph (DAG), and is
topologically sorted. The node numbers in C
correspond to
the bin numbers returned by conncomp
.
condensation
determines the nodes and edges in
C
by the components and connectivity in
G
:
C
contains a node for each strongly connected component inG
.C
contains an edge between nodeI
and nodeJ
if there is an edge from any node in componentI
to any node in componentJ
ofG
.
Version History
Introduced in R2016b
Apri esempio
Si dispone di una versione modificata di questo esempio. Desideri aprire questo esempio con le tue modifiche?
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)