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.Bipartition Class Reference

Decides whether the graph is bipartite and finds a bipartition into red and blue nodes. More...

Public Types

enum  Flags { None = 0, CreateRedNodes = 1 << 0, CreateBlueNodes = 1 << 1 }
 

Public Member Functions

 Bipartition (IGraph graph, Flags flags=0)
 

Properties

bool Bipartite [get, set]
 true if the graph is bipartite. More...
 
HashSet< NodeBlueNodes [get, set]
 The elements of the blue color class. More...
 
IGraph Graph [get, set]
 The input graph. More...
 
HashSet< NodeRedNodes [get, set]
 The elements of the red color class. More...
 

Detailed Description

Decides whether the graph is bipartite and finds a bipartition into red and blue nodes.

Example:

var g = new PathGraph(12, PathGraph.Topology.Cycle, Directedness.Undirected);
var bp = new Bipartition(g, Bipartition.Flags.CreateRedNodes | Bipartition.Flags.CreateBlueNodes);
Console.WriteLine("Bipartite: " + (bp.Bipartite ? "yes" : "no")); // should print 'yes'
if (bp.Bipartite)
{
Console.WriteLine("Red nodes: " + string.Join(" ", bp.RedNodes));
Console.WriteLine("Blue nodes: " + string.Join(" ", bp.BlueNodes));
}

Definition at line 103 of file Connectivity.cs.

Member Enumeration Documentation

Enumerator
None 
CreateRedNodes 

If set, RedNodes will contain the red nodes if the graph is bipartite.

CreateBlueNodes 

If set, BlueNodes will contain the blue nodes if the graph is bipartite.

Definition at line 106 of file Connectivity.cs.

Constructor & Destructor Documentation

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

Definition at line 163 of file Connectivity.cs.

Property Documentation

bool Satsuma.Bipartition.Bipartite
getset

true if the graph is bipartite.

Definition at line 118 of file Connectivity.cs.

HashSet<Node> Satsuma.Bipartition.BlueNodes
getset

The elements of the blue color class.

Null if Flags.CreateBlueNodes was not set during construction. Otherwise, empty if the graph is not bipartite.

Definition at line 126 of file Connectivity.cs.

IGraph Satsuma.Bipartition.Graph
getset

The input graph.

Definition at line 116 of file Connectivity.cs.

HashSet<Node> Satsuma.Bipartition.RedNodes
getset

The elements of the red color class.

Null if Flags.CreateRedNodes was not set during construction. Otherwise, empty if the graph is not bipartite.

Definition at line 122 of file Connectivity.cs.


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