March 2019
Intermediate to advanced
336 pages
9h 9m
English
The AddLink method adds the link between two vertices. The AddLink method of a social graph takes vertex1, vertex2, and weight as parameters. The method adds the link from vertex1 to vertex2, as shown in the following code:
// AddLink methodfunc (socialGraph *SocialGraph) AddLink(vertex1 int, vertex2 int, weight int) { socialGraph.Links[vertex1] = append(socialGraph.Links[vertex1], Link{Vertex1: vertex1, Vertex2: vertex2, LinkWeight: weight})}
Read now
Unlock full access