private void RegisterAggregationCallbacks() { Graph.NodeCreated += (sender, args) => { if (AggregateGraph.IsAggregationItem(args.Item)) { // add a label with the number of aggregated items to the new aggregation node Graph.AddLabel(args.Item, AggregateGraph.GetAggregatedItems(args.Item).Count.ToString()); } }; Graph.EdgeCreated += (sender, args) => { var edge = args.Item; if (!AggregateGraph.IsAggregationItem(edge)) { return; } // add a label with the number of all original aggregated edges represented by the new aggregation edge var aggregatedEdgesCount = AggregateGraph.GetAllAggregatedOriginalItems(edge).Count; if (aggregatedEdgesCount > 1) { Graph.AddLabel(edge, aggregatedEdgesCount.ToString()); } // set the thickness to the number of aggregated edges Graph.SetStyle(edge, new PolylineEdgeStyle { Pen = new Pen(Brushes.Gray, 1 + aggregatedEdgesCount) }); }; }