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

Loads and saves graphs stored in the Lemon Graph Format. More...

Public Member Functions

 LemonGraphFormat ()
 
void Load (TextReader reader, Directedness?directedness)
 Loads from a reader. More...
 
void Load (string filename, Directedness?directedness)
 Loads from a file. More...
 
void Save (TextWriter writer, IEnumerable< string > comment=null)
 Saves to a writer. All node and arc maps and attributes are saved as well, except NodeMaps["label"] (if present). More...
 
void Save (string filename, IEnumerable< string > comment=null)
 Saves to a file. More...
 

Properties

Dictionary< string, Dictionary
< Arc, string > > 
ArcMaps [get, set]
 The arc maps, as contained in the @arcs and @edges sections of the input. More...
 
Dictionary< string, string > Attributes [get, set]
 The attributes, as contained in the @attributes section of the input. More...
 
IGraph Graph [get, set]
 The graph itself. More...
 
Dictionary< string, Dictionary
< Node, string > > 
NodeMaps [get, set]
 The node maps, as contained in the @nodes section of the input. More...
 

Detailed Description

Loads and saves graphs stored in the Lemon Graph Format.

See this documentation page for a specification of the LGF.

Definition at line 177 of file IO.cs.

Constructor & Destructor Documentation

Satsuma.IO.LemonGraphFormat.LemonGraphFormat ( )

Definition at line 194 of file IO.cs.

Member Function Documentation

void Satsuma.IO.LemonGraphFormat.Load ( TextReader  reader,
Directedness directedness 
)

Loads from a reader.

Parameters
readerA reader on the input file, e.g. a StreamReader.
directednessSpecifies the directedness of the graph to be loaded. Possible values:
  • Directedness.Directed: each created arc will be directed.
  • Directedness.Undirected: each created arc will be undirected.
  • null (default): arcs defined in @arcs sections will be directed, while those defined in @edges sections will be undirected.

Definition at line 252 of file IO.cs.

void Satsuma.IO.LemonGraphFormat.Load ( string  filename,
Directedness directedness 
)

Loads from a file.

Definition at line 353 of file IO.cs.

void Satsuma.IO.LemonGraphFormat.Save ( TextWriter  writer,
IEnumerable< string >  comment = null 
)

Saves to a writer. All node and arc maps and attributes are saved as well, except NodeMaps["label"] (if present).

Parameters
writerA writer on the output file, e.g. a StreamWriter.
commentComment lines to write at the beginning of the file.

Definition at line 363 of file IO.cs.

void Satsuma.IO.LemonGraphFormat.Save ( string  filename,
IEnumerable< string >  comment = null 
)

Saves to a file.

Definition at line 421 of file IO.cs.

Property Documentation

Dictionary<string, Dictionary<Arc, string> > Satsuma.IO.LemonGraphFormat.ArcMaps
getset

The arc maps, as contained in the @arcs and @edges sections of the input.

Definition at line 190 of file IO.cs.

Dictionary<string, string> Satsuma.IO.LemonGraphFormat.Attributes
getset

The attributes, as contained in the @attributes section of the input.

Definition at line 192 of file IO.cs.

IGraph Satsuma.IO.LemonGraphFormat.Graph
getset

The graph itself.

  • When loading: Must be an IBuildableGraph to accomodate the loaded graph, or null. If null, will be replaced with a new CustomGraph instance.
  • When saving: Can be an arbitrary graph (not null).

Definition at line 183 of file IO.cs.

Dictionary<string, Dictionary<Node, string> > Satsuma.IO.LemonGraphFormat.NodeMaps
getset

The node maps, as contained in the @nodes section of the input.

Note
NodeMaps["label"] is never taken into account when saving, as label is a special word in LGF, and node labels are always generated automatically to ensure uniqueness.

Definition at line 188 of file IO.cs.


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