Skip to content

Latest commit

 

History

History
49 lines (37 loc) · 829 Bytes

Ex_4_2_02.md

File metadata and controls

49 lines (37 loc) · 829 Bytes
title date draft tags categories
Algorithm4 Java Solution 4.2.02
2020-02-21 06:16:20 +0800
false
JAVA
TECH
archives

4.2.02

Problem:

Draw, in the style of the figure in the text (page 524), the adjacency lists built by Digraph’s input stream constructor for the file tinyDGex2.txt depicted at left.

2020-02-18_019.jpg

Solution:

code:

Ex_4_2_02.java

    String filePath = "algdata/tinyGex2.txt";
    _AdjListDigraph G = new _AdjListDigraph(new In(filePath));
    StdOut.println(G);
//    12 vertices, 16 edges
//    0->6
//    1->11
//    2->0->3
//    3->6
//    4->1
//    5->0->10->2
//    6->2
//    7->8->11
//    8->1->4
//    9
//    10->3
//    11->8
  }

Reference: