예제 #1
0
        public void LinqWcc2()
        {
            var items =
                Enumerable.Range(1, 8)
                .ToDictionary(k => (long)k, v => new Item {
                id = v, component_id = v
            });

            var links = new List <Link>
            {
                new Link {
                    first = 4, second = 5
                },
                new Link {
                    first = 5, second = 6
                },
                new Link {
                    first = 1, second = 2
                },
                new Link {
                    first = 2, second = 4
                },
                new Link {
                    first = 3, second = 4
                },
            };


            LinqAlgorithms.scc(items, links);
        }
예제 #2
0
        public void LinqWcc()
        {
            var items =
                Enumerable.Range(1, 16)
                .ToDictionary(k => (long)k, v => new Item {
                id = v, component_id = v
            });
            var links =
                Enumerable.Range(1, 7)
                .Select(n => new Link {
                first = n, second = n + 1
            })
                .Concat(
                    Enumerable.Range(9, 7)
                    .Select(n => new Link {
                first = n, second = n + 1
            }));

            LinqAlgorithms.scc(items, links);
        }