Created
November 1, 2009 00:56
-
-
Save matarillo/223344 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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