Skip to content

Instantly share code, notes, and snippets.

@matarillo
Created November 1, 2009 00:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matarillo/223344 to your computer and use it in GitHub Desktop.
Save matarillo/223344 to your computer and use it in GitHub Desktop.
public class NodeCollection : Dictionary<string, Node>
{
public NodeCollection Add(params string[] names)
{
foreach (string name in names)
{
this[name] = new Node(name);
}
return this;
}
public NodeCollection Link(params string[] links)
{
foreach (string link in links)
{
string[] n = link.Split(',');
this[n[0]].Neighbors.Add(this[n[1]]);
this[n[1]].Neighbors.Add(this[n[0]]);
}
return this;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment