iMSTK
Interactive Medical Simulation Toolkit
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
imstk::Graph Class Reference

class to represent a graph object More...

#include <imstkGraph.h>

Public Types

enum  ColoringMethod { Greedy, WelshPowell }
 

Public Member Functions

 Graph (const size_t size)
 
void addEdge (const size_t v, const size_t w)
 Add edge to the graph.
 
void getEdges (const size_t v, edgeType &edges) const
 Get edges surrounding a node.
 
size_t size () const
 Get size of the graph.
 
void print () const
 print adjacency list representation of graph
 
void setDefaultColoringMethod (ColoringMethod method)
 Set the default colorizing method.
 
graphColorsType doColoring (ColoringMethod method=ColoringMethod::WelshPowell, bool print=false) const
 Colorize using the given method and prints the assignment of colors. More...
 

Protected Member Functions

graphColorsType doColoringGreedy (bool print=false) const
 Colorize using greedy algorithm and print the assignment of colors. More...
 
graphColorsType doColoringWelshPowell (bool print=false) const
 Colorize using Welsh-Powell algorithm and print the assignment of colors. More...
 

Protected Attributes

std::vector< edgeType > m_adjList
 A array of std::vectors to represent adjacency list.
 
ColoringMethod m_ColoringMethod = ColoringMethod::WelshPowell
 

Detailed Description

class to represent a graph object

Definition at line 18 of file imstkGraph.h.

Member Function Documentation

◆ doColoring()

Graph::graphColorsType imstk::Graph::doColoring ( ColoringMethod  method = ColoringMethod::WelshPowell,
bool  print = false 
) const

Colorize using the given method and prints the assignment of colors.

Returns
Vertex colors and number of colors

Definition at line 54 of file imstkGraph.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ doColoringGreedy()

std::pair< std::vector< unsigned short >, unsigned short > imstk::Graph::doColoringGreedy ( bool  print = false) const
protected

Colorize using greedy algorithm and print the assignment of colors.

Returns
Vertex colors and number of colors

Definition at line 152 of file imstkGraph.cpp.

Here is the caller graph for this function:

◆ doColoringWelshPowell()

Graph::graphColorsType imstk::Graph::doColoringWelshPowell ( bool  print = false) const
protected

Colorize using Welsh-Powell algorithm and print the assignment of colors.

Returns
Vertex colors and number of colors

Definition at line 62 of file imstkGraph.cpp.

Here is the caller graph for this function:

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