Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0d78bec

Browse files
committed
Merge branch 'master' into beta
2 parents7185d3c +c9468b3 commit0d78bec

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

‎src/Advanced.Algorithms/Graph/Coloring/MColorer.cs‎

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,26 @@ public class MColorer<T, C>
1414
/// </summary>
1515
publicMColorResult<T,C>Color(IGraph<T>graph,C[]colors)
1616
{
17-
vartotalProgress=newDictionary<IGraphVertex<T>,C>();
17+
varprogress=newDictionary<IGraphVertex<T>,C>();
1818

1919
foreach(varvertexingraph.VerticesAsEnumberable)
2020
{
21-
varprogress=canColor(vertex,colors,
22-
newDictionary<IGraphVertex<T>,C>(),
23-
newHashSet<IGraphVertex<T>>());
24-
25-
foreach(variteminprogress)
21+
if(!progress.ContainsKey(vertex))
2622
{
27-
if(!totalProgress.ContainsKey(item.Key))
28-
{
29-
totalProgress.Add(item.Key,item.Value);
30-
}
23+
canColor(vertex,colors,
24+
progress,
25+
newHashSet<IGraphVertex<T>>());
3126
}
32-
3327
}
3428

35-
if(totalProgress.Count!=graph.VerticesCount)
29+
if(progress.Count!=graph.VerticesCount)
3630
{
3731
returnnewMColorResult<T,C>(false,null);
3832
}
3933

4034
varresult=newDictionary<C,List<T>>();
4135

42-
foreach(varvertexintotalProgress)
36+
foreach(varvertexinprogress)
4337
{
4438
if(!result.ContainsKey(vertex.Value))
4539
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp