graph in computer sci To find the best route, an internet can be modeled as a graph. A model an internet as ence is a set of nodes and edges(ines) that connect the nodes. To a graph, we can think of each router as a node and each network between a pair of rout ers as an edge. internet is, modeled as a weighted graph, in which each edge is associated with a cost. If a weighted graph is used to represent a geographical area the nodes can be cities and the edges can be roads connecting the cities; the weights, in this case, are distances between cities. In routing, however, the cost of an edge has a different interpretation in different routing protocols, which we discuss in a later sec tion. For the moment, we assume that there is a cost associated with each edge. If there is no edge between the nodes, the cost is infinity. Figure 20.1 shows how an internet can be modeled as a graph.