Creating DirectedGraph from Enum type

imbSCI.Graph library (0.1.0.28) is updated with few new classes, where enumToDGMLConverter is ready for use.
enumToDGMLConverter will convert specified Enum type into directed graph that shows relationships between enum values, in respect to flags values.

To use it add its namespace at top:

using imbSCI.Graph.Converters.enumToGraph;
// here we get the type to interpret
Type enumType = typeof(tkn_stream);

// here we create instace of the converter
enumToDMGLConverter converter = new enumToDMGLConverter();

// here we are converting Type into DirectedGraph, that will include type name as root node
var dg = converter.ConvertEnumType(enumType);

// here we save it to: tkn_stream.dgml
dg.Save("tkn_stream", Data.enums.getWritableFileMode.overwrite);

 

Directed Graph created from tkn_stream enum type of imbNLP

// here we create alternative version of the graph, where type is not added as root node of the graph
converter.ConvertEnumType(enumType, false).Save("tkn_stream_notype", Data.enums.getWritableFileMode.overwrite);

 

Directed Graph created from tkn_stream enum type of imbNLP – without type as root node

Spread the love