Vertexnum?

8 views
Skip to first unread message

Han Gao

unread,
Apr 30, 2011, 9:58:36 PM4/30/11
to cs2110-sp11
Hi I'm just wondering in the addVertex() method, how exactly is the
parameter vertexnum? If I'm using the adjacency matrix implementation
of size n, will this vertexnum always be n (counting from 0) since all
the vertices are numbered as 0,1,2,3... ? Thanks.

Keith Newman

unread,
May 1, 2011, 12:15:05 AM5/1/11
to cs2110-sp11
My understanding is that the vertexnum will be an arbitrary integer
representing a user. For example, in the Twitter Small data set, the
first line reads:

45914942 25871621 5

Which means an edge is made from user 45914942 to user 25871621 with a
weight as 5. To balance things out, I used the vertexnums as keys for
a hashmap and then made the values an increasing integer, so you can
still organize your Adjacency Matrix in terms of simple integers while
maintaining the user vertex numbers.

Steve Spagnola

unread,
May 7, 2011, 11:23:17 AM5/7/11
to cs2110-sp11
Yes, the input will be an arbitrary (and large) integer corresponding
to Twitter. As discussed before, its a good idea to map to a lower
and continuous range, but also make sure that you have a way to map
back for the makeRecommendation method.
Reply all
Reply to author
Forward
0 new messages