Satsuma
a delicious .NET graph library
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Pages
Classes | Public Types | Public Member Functions | Properties | List of all members
Satsuma.ConnectedComponents Class Reference

Finds the connected components of a graph. More...

Public Types

enum  Flags { None = 0, CreateComponents = 1 << 0 }
 

Public Member Functions

 ConnectedComponents (IGraph graph, Flags flags=0)
 

Properties

List< HashSet< Node > > Components [get, set]
 The connected components of the graph. More...
 
int Count [get, set]
 The number of connected components in the graph. More...
 
IGraph Graph [get, set]
 The input graph. More...
 

Detailed Description

Finds the connected components of a graph.

Example:

var g = new CustomGraph();
for (int i = 0; i < 5; i++) g.AddNode();
var components = new ConnectedComponents(g, ConnectedComponents.Flags.CreateComponents);
Console.WriteLine("Number of components: " + components.Count); // should print 5
Console.WriteLine("Components:");
foreach (var component in components.Components)
Console.WriteLine(string.Join(" ", component));

Definition at line 42 of file Connectivity.cs.

Member Enumeration Documentation

Enumerator
None 
CreateComponents 

If set, Components will contain the connected components.

Definition at line 45 of file Connectivity.cs.

Constructor & Destructor Documentation

Satsuma.ConnectedComponents.ConnectedComponents ( IGraph  graph,
Flags  flags = 0 
)

Definition at line 82 of file Connectivity.cs.

Property Documentation

List<HashSet<Node> > Satsuma.ConnectedComponents.Components
getset

The connected components of the graph.

Null if Flags.CreateComponents was not set during construction.

Definition at line 58 of file Connectivity.cs.

int Satsuma.ConnectedComponents.Count
getset

The number of connected components in the graph.

Definition at line 55 of file Connectivity.cs.

IGraph Satsuma.ConnectedComponents.Graph
getset

The input graph.

Definition at line 53 of file Connectivity.cs.


The documentation for this class was generated from the following file: