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 g)

{

}

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!