79
Console.WriteLine($"Primary Data Recipient for Node {nodeWithHighestOutgoingData.NodeID}: NodeID {primaryRecipient.DestinationID}, Data Volume: {primaryRecipient.DataVolume}");
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
5
public class Program
6
{
7
public static void Main()
8
{
9
List<Activity> activities = new List<Activity>
10
{
11
new Activity { SourceID = 1, DestinationID = 2, DataVolume = 100 },
12
new Activity { SourceID = 1, DestinationID = 3, DataVolume = 150 },
13
new Activity { SourceID = 2, DestinationID = 1, DataVolume = 200 },
14
new Activity { SourceID = 3, DestinationID = 1, DataVolume = 50 }
15
// Add more sample activities as needed
16
};
17
18
var outgoingData = activities
19
.GroupBy(a => a.SourceID)
20
.Select(g => new NodeData
21
{
22
NodeID = g.Key,
23
TotalOutgoingData = g.Sum(a => a.DataVolume),
24
TotalIncomingData = 0M // Initialize with 0 for incoming data
Cached Result