COMP25216、Network Analysis、Graph ADT、C++Haskell|

COMP2521: Assignment 2Social Network AnalysisA notice on the class web page will be posted after each major revision. Please check the class noticeboard and this assignment page frequently (for Change Log). The specification may change.FAQ:You should check Ass2 FAQ, it may offer answers to your queries!Change log:No entries as yet!Objectivesto implement graph based data analysis functions (ADTs) to mine a given social network.to give you further practice with C and data structures (Graph ADT)AdminMarks 20 marks (scaled to 14 marks towards total course mark)IndividualAssignmentThis assignment is an individual assignment.Due 08:00pm Friday 22 November 2019LatePenalty2 marks per day off the ceiling.Last day to submit this assignment is 8pm Monday 25 November 2019, of coursewith late penalty.Submit TBAAimIn this assignment, your task is to implement graph based data analysis functions (ADTs) to mine a givensocial network. For example, detect say influenciers, followers, communities, etc. in a given socialnetwork. You should start by reading the Wikipedia entries on these topics. Later I will also discuss thesetopics in the lecture.Social network analysisCentralityThe main focus of this assignment is to calculate measures that could identify say influenciers,followers, etc., and also discover possible communities in a given social network.Dos and Donts !Please note that,For this assignmet you can use source code that is available as part of the course material (lectures,exercises, tutes and labs). However, you must properly acknowledge it in your solution.All the required code for each part must be in the respective *.c file.You may implement additional helper functions in your files, please declare them as staticfunctions.After implementing Dijkstra.h, you can use this ADT for other tasks in the assignment. However,please note that for our testing, we will use/supply our implementation of Dijkstra.h. So yourprograms MUST NOT use any implementation related information that is not available in therespective header files (*.h files). In other words, you can only use information available in thecorresponding *.h files.Your program must not have any main function in any of the submitted files.Do not submit any other files. For example, you do not need to submit your modified test files or*.h files.If you have not implemented any part, must still submit an empty file with the corresponding filename..Provided FilesWe are providing implementations of Graph.h and PQ.h . You can use them to implement all three parts.However, your programs MUST NOT use any implementation related information that is not available inthe respective header files (*.h files). In other words, you can only use information available in thecorresponding *.h files.Also note:all edge weights will be greater than zero.we will not be testing reflexive and/or self-loop edges.we will not be testing the case where the same edge is inserted twice.Download files:Ass2_files.zipAss2_Testing.zipPart-1: Dijkstras algorithmIn order to discover say influencers, we need to repeatedly find shortest paths between all pairs ofnodes. In this section, you need to implement Dijkstras algorithm to discover shortest paths from a givensource to all other nodes in the graph. The function offers one important additional feature, the functionkeeps track of multiple predecessors for a node on shortest paths from the source, if they exist. In thefollowing example, while discovering shortest paths from source node 0, we discovered that there aretwo possible shortests paths from node 0 to node 1 (0->1 OR 0->2->1), so node 1 has two possiblepredecessors (node 0 or node 2) on possible shortest paths, as shown below.We will discuss this point in detail in a lecture. The basic idea is, the array of lists (pred) keeps onelinked list per node, and stores multiple predecessors (if they exist) for that node on shortest paths from agiven source. In other words, for a given source, each linked list in pred offers possible predecessors forthe corresponding node. Node 0 Distance 0 : X 1 : 2 2 : 1 Preds 0 : NULL1 : [0]->[2]->NULL 2 : [0]->NULL Node 1 Distance 0 : 2 1 : X 2 : 3 Preds 0 : [1]->NULL 1 : NULL 2 : [0]->NULL Node 2 Distance 0 : 3 1 : 1 2 : X Preds 0 : [1]->NULL 1 : [2]->NULL 2 : NULLThe function returns ShortestPaths structure with the required information (i.e. distance array,predecessor arrays, source and no_of_nodes in the graph)Your task: In this section, you need to implement the following file:Dijkstra.c that implements all the functions defined in Dijkstra.h.Part-2: Centrality Measures for Social Network AnalysisCentrality measures play very important role in analysing a social network. For example, nodes withhigher betweenness measure often correspond to influencers in the given social network. In this partyou will implement two well known centrality measures for a given directed weighted graph.Descriptions of some of the following items are from Wikipedia at Centrality, adapted for this assignment.Closeness CentralityCloseness centrality (or closeness) of a node is calculated as the sum of the length of the shortest pathsbetween the node () and all other nodes () in the graph. Generally closeness is defined as below,where is the shortest distance between vertices and .However, considering most likely we will have isolated nodes, for this assignment you need to useWasserman and Faust formula to calculate closeness of a node in a directed graph as described below:where is the shortest-path distance in a directed graph from vertex to , is the number of nodes that canreach, and denote the number of nodes in the graph.For further explanations, please read the following document, it may answer many of your questions!Explanations for Part-2Based on the above, the more central a node is, the closer it is to all other nodes. For for information, seeWikipedia entry on Closeness centrality.Betweenness CentralityThe betweenness centrality of a node is given by the expression:where is the total number of shortest paths from node to node and is the number of those paths that passthrough .For this assignment, use the following approach to calculate normalised betweenness centrality. It iseasier! and also avoids zero as denominator (for n>2).where, represents the number of nodes in the graph.For further explanations, please read the following document, it may answer many of your questions!Explanations for Part-2Your task: In this section, you need to implement the following file:CentralityMeasures.c that implements all the functions defined in CentralityMeasures.h.For more information, see Wikipedia entry on Betweenness centralityPart-3: Discovering CommunityIn this part you need to implement the Hierarchical Agglomerative Clustering (HAC) algorithm todiscover communities in a given graph. In particular, you need to implement Lance-Williams algorithm,as described below. In the lecture we will discuss how this algorithm works, and what you need to do toimplement it. You may find the following document/video useful for this part:Hierarchical Clustering (Wikipedia), for this assignment we are interested in only agglomerativeapproach.Brief overview of algorithms for hierarchical clustering, including Lance-Williams approach (pdffile).Three videos by Victor Lavrenko, watch in sequence!Agglomerative Clustering: how it worksHierarchical Clustering 3: single-link vs. complete-linkHierarchical Clustering 4: the Lance-Williams algorithmDistance measure: For this assignment, we calculate distance between a pair of vertices as follow: Let represents maximum edge weight of all available weighted edges between a pair of vertices and .Distance between vertices and is defined as . If and are not connected, is infinite.For example, if there is one directed link between and with weight , the distance between them is . Ifthere are two links, between and w, we take maximum of the two weights and the distance between themis . Please note that, one can also consider alternative approaches, like take average, min, etc. However,we need to pick one approach for this assignment and we will use the above distance measure.You need to use the following (adapted) Lance-Williams HAC Algorithm to derive a dendrogram:Calculate distances between each pair of vertices as described above.Create clusters for every vertex , say .Let represents the distance between cluster and , initially it represents distance between vertex and .For k = 1 to N-1Find two closest clusters, say and . If there are multiple alternatives, you can select any oneof the pairs of closest clusters.Remove clusters and from the collection of clusters and add a new cluster (with all verticesin and ) to the collection of clusters.Update dendrogram.Update distances, say , between the newly added cluster and the rest of the clusters () in thecollection using Lance-Williams formula using the selected method (Single linkage orComplete linkage - see below).End ForReturn dendrogramLance-Williams formula:where , , , and define the agglomerative criterion.For the Single link method, these values are: , , , and . Using these values, the formula for Single linkmethod is:We can simplify the above and re-write the formula for Single link method as below For the Complete link method, the values are: , , , and . Using these values, the formula for Complete linkmethod is:We can simplify the above and re-write the formula for Complete link method as below Please see the following simple example, it may answer many of your questions!Part-3 Simple Example (MS Excel file)Your task: In this section, you need to implement the following file:LanceWilliamsHAC.c that implements all the functions defined in LanceWilliamsHAC.h.Assessment CriteriaPart-1: Dijkstras algorithm (20% marks)Part-2:Closeness Centrality (22% marks),Betweenness Centrality (23% marks)Part-3: Discovering Community (15% marks)Style, Comments and Complexity: 20%TestingPlease note that testing an API implementation is very important and crucial part of designing andimplementing an API. We offer the following testing interfaces (for all the APIs you need to implement)for you to get started, however note that they only test basic cases. Importantly,you need to add more advanced test cases and properly test your API implementations,the auto-marking program will use more advanced test cases that are not included in the test casesprovided to you.Instructions on how to test your API implementations are available on the following page:Testing your API ImplementationsSubmissionYou need to submit the following five files:Dijkstra.cCentralityMeasures.cLanceWilliamsHAC.cSubmission instructions on how to submit the above five files will be available later.PlagiarismThis is an individual assignment. Each student will have to develop their own solution without help fromother people. You are not permitted to exchange code or pseudocode. If you have questions about theassignment, ask your tutor. All work submitted for assessment must be entirely your own work. We regardunacknowledged copying of material, in whole or part, as an extremely serious offence. For furtherinformation, read the Course Outline.转自:http://www.3daixie.com/contents/11/3444.html

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 214,029评论 6 493
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 91,238评论 3 388
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 159,576评论 0 349
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 57,214评论 1 287
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 66,324评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 50,392评论 1 292
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,416评论 3 412
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,196评论 0 269
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,631评论 1 306
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,919评论 2 328
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,090评论 1 342
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,767评论 4 337
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,410评论 3 322
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,090评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,328评论 1 267
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,952评论 2 365
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,979评论 2 351

推荐阅读更多精彩内容