Question
Use C# to code 2.(35 points) Fill in the method stub below to return a List < Edge < int, bool >> containing all the
Use C# to code
2.(35 points) Fill in the method stub below to return a List<Edge<int, bool>> containing all the edges with true data in the given graph. Descriptions of the Edge structure and DirectedGraph<TNode, TEdgeData> class are given on the below. You may assume that is not null. You may not add any code outside the GetTrueEdges method.
private List
GetTrueEdges(DirectedGraph
{
}
DirectedGraph<TNode, TEdgeData>:
bool TryGetEdge(TNode source, TNode dest, out TEdge value): Tries to get the value associated with the edge from to . If this edge exists, it sets to the value associated with this edge and returns true; otherwise, it sets to the default value for TEdge and returns false.
int NodeCount: Gets the number of nodes.
int EdgeCount: Gets the number of edges.
bool ContainsNode(TNode node): Returns whether the graph contains the given node. If is null, throws an ArgumentNullException.
IEnumerable<TNode> Nodes: Gets an enumerable collection of the nodes in the graph.
IEnumerable<Edge<TNode, TEdge>> OutgoingEdges(TNode source): Returns an enumerable collection of the outgoing edges from . If is null, it throws an ArgumentNullException. If is not a node in the graph, it throws a KeyNotFoundException.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started