Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

More Books

Students also viewed these Databases questions