@@ -266,80 +266,38 @@ needs it, i.e. has a dependency key of that constructor's class.
266266
267267## Resolution: Construction of the Graph
268268
269- Dagger constructs a bipartite graph for each component.
269+ Dagger constructs a directed graph for each component.
270270
271- The * nodes * of the graph are :
271+ The graph consists of :
272272
273- - bindings and entry points of the component
274- - binding keys and dependency keys of those bindings, and all entry point
275- keys.
273+ - ** bindings** and ** entry points** of the component;
274+ - ** keys** : binding keys, dependency keys, and entry point keys.
275+
276+ The ** resolution of keys** is modeled by grouping each binding within the key
277+ that it satisfies.
276278
277279The * edges* of the graph are directed edges consisting of:
278280
279- - for each binding, an edge from its dependency keys to the binding ; this
281+ - for each binding, an edge from the binding to its dependency keys ; this
280282 models ** dependencies of bindings** ;
281- - for each entry point, an edge from the entry point's key to the entry point;
282- this models ** dependencies of entry points** ;
283- - for each key, an edge from any binding that has this key as its binding key,
284- to the key itself; this models ** resolution of keys** .
283+ - for each entry point, an edge from the entry point to its key; this models
284+ ** dependencies of entry points** .
285285
286286The graph is ** well-formed** if:
287287
288- - every key node has exactly one inbound edge ;
288+ - every key contains exactly one binding ;
289289- there are no cycles, with the following exception: if a cycle contains an
290290 edge representing a dependency key whose type was wrapped in ` Provider ` or
291291 ` Lazy ` , then it is permitted.
292292
293- If a key node has zero inbound edges, it is a ** missing binding** ; if it has
294- more than one inbound edge, it is a ** duplicate binding** .
295-
296- The above example component generates the following graph. The key nodes are
297- light red, the binding nodes are light blue, and the entry point nodes are light
298- green.
299-
300- ``` dot
301- digraph d_front_back {
302- rankdir="LR";
303- graph [size="9;9", style=invis, ranksep=2]
304- node [ style=filled, nodesep=0.2 ]
305- edge [ weight=1.2 ]
306-
307- subgraph cluster_bindings {
308- rank=same;
309- "M\#v()" [ color="lightblue" ];
310- "M\#foo()" [ color="lightblue" ];
311- "M\#bar()" [ color="lightblue" ];
312- "N\#y()" [ color="lightblue" ];
313- "BarImpl()" [ color="lightblue" ];
314- "X()" [ color="lightblue" ];
315- "C#foo" [ color="lightgreen" ];
316- "C#bar" [ color="lightgreen" ];
317- }
318- subgraph cluster_keys {
319- rank=same;
320- X [ color="mistyrose" ];
321- "@Blue Y" [ color="mistyrose" ];
322- int [ color="mistyrose" ];
323- Foo [ color="mistyrose" ];
324- Bar [ color="mistyrose" ];
325- BarImpl [ color="mistyrose" ];
326- }
327- X -> "M\#foo()"
328- int -> "M\#foo()"
329- BarImpl -> "M\#bar()"
330- X -> "N\#y()"
331- "@Blue Y" -> "BarImpl()"
332- int -> "BarImpl()"
333- Foo -> "C#foo"
334- Bar -> "C#bar"
335- "X()" -> X
336- "N\#y()" -> "@Blue Y"
337- "M\#v()" -> int
338- "M\#foo()" -> Foo
339- "M\#bar()" -> Bar
340- "BarImpl()" -> BarImpl
341- }
342- ```
293+ If a key contains zero bindings, it is a ** missing binding** ; if it contains
294+ more than one binding, it is a ** duplicate binding** .
295+
296+ The above example component generates the following graph. The keys are
297+ represented as light red boxes, the bindings are light blue nodes within them,
298+ and the entry points are light green nodes.
299+
300+ ![ Construction graph] ( construction-graph.png )
343301
344302## Code Generation and Runtime
345303
0 commit comments