public IEnumerable <Commit> GetAllFromTip(string branchName) { var commits = _repository.Branches[branchName].Commits .Select(d => new Commit() { Date = d.Committer.When.DateTime, Name = d.Message, Parents = d.Parents.Select(p => p.Sha).ToList(), Sha = d.Sha, Message = d.MessageShort }).Take(30).ToList(); foreach (var branch in _repository.Branches) { var tipSha = branch.Tip.Sha; var reachableCommitFromBranchTip = commits.Where(d => d.Sha == tipSha); foreach (var item in reachableCommitFromBranchTip) { item.AddReachableBranch(branch.FriendlyName); } } GraphBuilder.GraphBuilder builder = new GraphBuilder.GraphBuilder(); builder.Build(commits.ToArray()); return(commits); }
public void GreedyIndependentSetsTest() { string filePath = "/home/paul/coding/algorithms-data-structures/NPheuristics/GraphColoring/graph1Data.txt"; GraphBuilder.GraphBuilder builder = new GraphBuilder.GraphBuilder(); Graph graph = builder.BuildGraphFromFile(filePath); GIS gis = new GIS(graph); gis.ColorGraph(); Console.WriteLine(gis.GetGisOutput()); }
public void DSaturAlgorithm_Image1() { string filePath = "/home/paul/coding/algorithms-data-structures/NPheuristics/GraphColoring/graph1Data.txt"; GraphBuilder.GraphBuilder builder = new GraphBuilder.GraphBuilder(); Graph graph = builder.BuildGraphFromFile(filePath); DSaturAlgorithm dsa = new DSaturAlgorithm(graph); dsa.ColorGraph(); // int colorsUsed = dsa.GetColorCount(); // Console.WriteLine($"Algorithm used {colorsUsed} colors for graph:\n" + $"{graph}"); Console.WriteLine(dsa.GetDSaturOutput()); }