public void glueComponent(RelatedComponent component2) { foreach (Vertex v in component2.Component) { addToComponent(v); } }
//Returns sorted list void initCandidates(Graph graph) { foreach (Vertex v in graph.Vertices) { //Related Components RelatedComponent rc = new RelatedComponent(); rc.addToComponent(v); relatedComponents.Add(rc); //Candidates foreach (Edge e in v.Edges) { if (!isCandidate(candidates, e)) { var index = candidates.BinarySearch(e); if (index < 0) //Not found weight { index = ~index; //Bitwise Complement Operator } candidates.Insert(index, e); } } } }