@@ -7,10 +7,10 @@ namespace Bearded.Utilities.Graphs;
77
88public sealed class DirectedGraphBuilder < T > where T : IEquatable < T >
99{
10- private readonly HashSet < T > elements = new HashSet < T > ( ) ;
11- private readonly HashSet < T > sources = new HashSet < T > ( ) ;
12- private readonly Dictionary < T , HashSet < T > > directSuccessors = new Dictionary < T , HashSet < T > > ( ) ;
13- private readonly Dictionary < T , HashSet < T > > directPredecessors = new Dictionary < T , HashSet < T > > ( ) ;
10+ private readonly HashSet < T > elements = new ( ) ;
11+ private readonly HashSet < T > sources = new ( ) ;
12+ private readonly Dictionary < T , HashSet < T > > directSuccessors = new ( ) ;
13+ private readonly Dictionary < T , HashSet < T > > directPredecessors = new ( ) ;
1414
1515 public static DirectedGraphBuilder < T > NewBuilder ( )
1616 {
@@ -81,13 +81,13 @@ public DirectedGraphBuilder<T> AddArrow(T from, T to)
8181 public IDirectedGraph < T > CreateGraph ( )
8282 {
8383 return new AdjacencyListDirectedGraph < T > (
84- ImmutableList . CreateRange ( elements ) ,
84+ ImmutableArray . CreateRange ( elements ) ,
8585 directSuccessors . ToImmutableDictionary (
8686 pair => pair . Key ,
87- pair => ImmutableList . CreateRange ( pair . Value ) ) ,
87+ pair => ImmutableArray . CreateRange ( pair . Value ) ) ,
8888 directPredecessors . ToImmutableDictionary (
8989 pair => pair . Key ,
90- pair => ImmutableList . CreateRange ( pair . Value ) ) ) ;
90+ pair => ImmutableArray . CreateRange ( pair . Value ) ) ) ;
9191 }
9292
9393 /// <summary>
@@ -139,12 +139,12 @@ bool leadsBackToCurrentPath(T element)
139139 public IDirectedAcyclicGraph < T > CreateAcyclicGraphUnsafe ( )
140140 {
141141 return new AdjacencyListDirectedAcyclicGraph < T > (
142- ImmutableList . CreateRange ( elements ) ,
142+ ImmutableArray . CreateRange ( elements ) ,
143143 directSuccessors . ToImmutableDictionary (
144144 pair => pair . Key ,
145- pair => ImmutableList . CreateRange ( pair . Value ) ) ,
145+ pair => ImmutableArray . CreateRange ( pair . Value ) ) ,
146146 directPredecessors . ToImmutableDictionary (
147147 pair => pair . Key ,
148- pair => ImmutableList . CreateRange ( pair . Value ) ) ) ;
148+ pair => ImmutableArray . CreateRange ( pair . Value ) ) ) ;
149149 }
150150}
0 commit comments