March 2019
Intermediate to advanced
336 pages
9h 9m
English
The PrintLinks method of the SocialGraph class prints the links adjacent to the root and all the links, as shown in the following code snippet:
func (socialGraph *SocialGraph) PrintLinks() { var root Name root = Name("Root") fmt.Printf("Printing all links adjacent to %d\n", root) var node Name for node = range socialGraph.Links[root] { // Edge exists from u to v. fmt.Printf("Link: %d -> %d\n", root, node) } var m map[Name]struct{} fmt.Println("Printing all links.") for root, m = range socialGraph.Links { var vertex Name for vertex = range m { // Edge exists from u to v. fmt.Printf("Link: %d -> %d\n", root, vertex) } }}
Read now
Unlock full access