{"id":79126,"date":"2026-11-18T03:31:45","date_gmt":"2026-11-18T03:31:45","guid":{"rendered":"http:\/\/bangla.sitestree.com\/?p=79126"},"modified":"2026-11-18T03:31:45","modified_gmt":"2026-11-18T03:31:45","slug":"graph-mining-1-13-project-prompts-part-3","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=79126","title":{"rendered":"Graph Mining &#8211; 1 | 13. Assignments and Project Prompts \u2014 Part 3 (Worked Answers)"},"content":{"rendered":"<p class=\"wp-block-paragraph\"><strong>AI Generated Answers.<\/strong> Original assignment\/project questions on this blog are attributed to <strong>Sayed Ahmed<\/strong>. The new AI-generated worked solutions and examples are offered for reuse without copyright restrictions asserted by the blog; external datasets and linked resources retain their own rights. These are instructional examples; test code before classroom use.<\/p>\n<p class=\"wp-block-paragraph\"><a href=\"http:\/\/bangla.sitestree.com\/?p=79103\">Graph Mining &#8211; 1 course index<\/a> \u00b7 Original prompt source: <a href=\"http:\/\/bangla.sitestree.com\/?p=22891\">Graph Mining: Misc. Topics to Learn<\/a> \u00b7 This part covers prompts 13.07\u201313.09.<\/p>\n<h3 class=\"wp-block-heading\">Q13.07. Choose a real graph-mining case study and identify a dataset suitable for reproducing the analysis. The post lists communication patterns, fraud detection, changes in communication networks, web projections, and connection subgraphs.<\/h3>\n<p class=\"wp-block-paragraph\"><strong>Answer.<\/strong> <strong>Reproducible case study.<\/strong> Use <code>nx.karate_club_graph()<\/code> (the Zachary Karate Club social network) as a small real-network dataset to study community structure. Task: compute edge betweenness; run Girvan\u2013Newman or Louvain; compare detected communities with the graph\u2019s recorded club factions using agreement metrics. Then scale to a larger openly licensed research network, documenting source rights and missing data. This is a reproducible historical social-network case, not personal data.<\/p>\n<h3 class=\"wp-block-heading\">Q13.08. Can you represent dengue case or contact observations as a graph and study possible patterns of spread?<\/h3>\n<p class=\"wp-block-paragraph\"><strong>Answer.<\/strong> <strong>Ethical synthetic study.<\/strong> Dengue cases may be summarized as <em>regions over time<\/em>, not unconsented person-level contacts. Construct vertices for geographic regions and edges for adjacency or measured travel, then annotate each region with week-specific case counts. Graph structure can help identify potentially connected areas for further public-health review; it cannot establish which person infected whom or provide a diagnosis.<\/p>\n<h3 class=\"wp-block-heading\">Q13.09. Select a large-scale graph-mining function, apply it to a large graph, and investigate how an algorithm could be improved. Examples in the post include graph partitioning, clustering, connected components, similarity and link models, streaming graphs, centrality, and graph construction.<\/h3>\n<p class=\"wp-block-paragraph\"><strong>Answer.<\/strong> <strong>Scalable challenge.<\/strong> Take connected-components detection on a large undirected edge stream. Compare a NetworkX batch baseline with a union\u2013find (disjoint-set union) streaming implementation. Report correctness on the same graph, edge-processing time, memory usage, and complexity. Define graph-size ranges and hardware limits; do not claim a speedup without measured results.<\/p>\n<h2 class=\"wp-block-heading\">Mini case study: Karate Club network<\/h2>\n<pre class=\"wp-block-preformatted\">import networkx as nx\nfrom networkx.algorithms.community import greedy_modularity_communities\nG=nx.karate_club_graph()\ncommunities=list(greedy_modularity_communities(G))\nprint(\"Vertices:\",len(G), \"edges:\",G.number_of_edges())\nprint(\"Community sizes:\",sorted(map(len,communities), reverse=True))\nprint(\"Modularity:\",nx.community.modularity(G,communities))\n# Compare against node attribute G.nodes[v][\"club\"].\n# The number and size of algorithmic groups can vary by method.<\/pre>\n<h2 class=\"wp-block-heading\">Synthetic dengue-area graph (not patient-level data)<\/h2>\n<pre class=\"wp-block-preformatted\">import networkx as nx\nG=nx.Graph()\nG.add_edges_from([(\"North\",\"Central\"),\n                  (\"Central\",\"South\"),\n                  (\"Central\",\"East\")])\nweekly_cases={\"North\":6,\"Central\":10,\"South\":3,\"East\":2}\n# Toy descriptive neighborhood aggregate, not infection prediction:\nneighbor_total={v:sum(weekly_cases[u] for u in G.neighbors(v))\n                for v in G.nodes}\nprint(\"Synthetic neighboring case totals:\",neighbor_total)\n# Validate rates using population denominators, time and reporting bias.<\/pre>\n<h2 class=\"wp-block-heading\">Streaming connected components with union\u2013find<\/h2>\n<pre class=\"wp-block-preformatted\">import random, time, networkx as nx\n\nclass DSU:\n    def __init__(self,n):\n        self.parent=list(range(n)); self.rank=[0]*n\n    def find(self,x):\n        while self.parent[x]!=x:\n            self.parent[x]=self.parent[self.parent[x]]\n            x=self.parent[x]\n        return x\n    def union(self,a,b):\n        a,b=self.find(a),self.find(b)\n        if a==b:return\n        if self.rank[a]<self.rank[b]:a,b=b,a\n        self.parent[b]=a\n        if self.rank[a]==self.rank[b]:self.rank[a]+=1\n\nn=20000; rng=random.Random(123)\nE=[(rng.randrange(n),rng.randrange(n)) for _ in range(40000)]\nstart=time.perf_counter()\ndsu=DSU(n)\nfor u,v in E: dsu.union(u,v)\ncount=len({dsu.find(i) for i in range(n)})\nprint(\"DSU components:\",count,\"seconds:\",time.perf_counter()-start)\n\nstart=time.perf_counter()\nG=nx.Graph();G.add_nodes_from(range(n));G.add_edges_from(E)\nbaseline=nx.number_connected_components(G)\nprint(\"NetworkX components:\",baseline,\"seconds:\",time.perf_counter()-start)\nassert count==baseline\n# Runtime\/memory depend on hardware and input; measure rather than assume.<\/pre>\n<p class=\"wp-block-paragraph\"><strong>Evaluation:<\/strong> Benchmark input construction separately from algorithm execution, compare output correctness, use consistent graph sizes and repeated runs, and measure peak memory. For streamed contacts and public-health examples, follow data-governance and ethics requirements.<\/p>","protected":false},"excerpt":{"rendered":"<p>Graph Mining course assignments part 3: worked answers for source prompts 13.07\u201313.09 with reproducible Python examples and project evaluation guidance.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1905,1994],"tags":[],"class_list":["post-79126","post","type-post","status-publish","format-standard","hentry","category-graph-mining","category-graph-mining-1","item-wrap"],"jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":79124,"url":"http:\/\/bangla.sitestree.com\/?p=79124","url_meta":{"origin":79126,"position":0},"title":"Graph Mining &#8211; 1 | 13. Assignments and Project Prompts \u2014 Part 1 (Worked Answers)","author":"Sayed","date":"November 18, 2026","format":false,"excerpt":"Graph Mining course assignments part 1: worked answers for source prompts 13.01\u201313.03 with reproducible Python examples and project evaluation guidance.","rel":"","context":"In &quot;Graph Mining&quot;","block_context":{"text":"Graph Mining","link":"http:\/\/bangla.sitestree.com\/?cat=1905"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79125,"url":"http:\/\/bangla.sitestree.com\/?p=79125","url_meta":{"origin":79126,"position":1},"title":"Graph Mining &#8211; 1 | 13. Assignments and Project Prompts \u2014 Part 2 (Worked Answers)","author":"Sayed","date":"November 18, 2026","format":false,"excerpt":"Graph Mining course assignments part 2: worked answers for source prompts 13.04\u201313.06 with reproducible Python examples and project evaluation guidance.","rel":"","context":"In &quot;Graph Mining&quot;","block_context":{"text":"Graph Mining","link":"http:\/\/bangla.sitestree.com\/?cat=1905"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79103,"url":"http:\/\/bangla.sitestree.com\/?p=79103","url_meta":{"origin":79126,"position":2},"title":"Graph Mining &#8211; 1 | Course Index, Source Archive and 415-Question Bank","author":"Sayed","date":"November 18, 2026","format":false,"excerpt":"Complete graph mining blog archive: 33 source posts, 13 distinct question sets, 415 numbered prompts, source links, and selected previously published answer notes.","rel":"","context":"In &quot;Graph Mining&quot;","block_context":{"text":"Graph Mining","link":"http:\/\/bangla.sitestree.com\/?cat=1905"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79105,"url":"http:\/\/bangla.sitestree.com\/?p=79105","url_meta":{"origin":79126,"position":3},"title":"Graph Mining &#8211; 1 | 01. Graph Mining Foundations \u2014 Questions and Answers","author":"Sayed","date":"November 18, 2026","format":false,"excerpt":"Twenty original Graph Mining Foundations questions, each answered with examples, history, applications, an animated graph and NetworkX exercise.","rel":"","context":"In &quot;Graph Mining&quot;","block_context":{"text":"Graph Mining","link":"http:\/\/bangla.sitestree.com\/?cat=1905"},"img":{"alt_text":"Animated network: vertices A\u2013G form two communities, acquire a connecting bridge, and show a candidate new link.","src":"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2026\/11\/graph-mining-1-network-growth-original-animation.gif?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":16311,"url":"http:\/\/bangla.sitestree.com\/?p=16311","url_meta":{"origin":79126,"position":4},"title":"Graph Mining: What is Graph Mining? Learn by finding answers to the following questions. Can you answer the following questions?","author":"Sayed","date":"October 9, 2019","format":false,"excerpt":"Graph Mining: What is Graph Mining? Learn by finding answers to the following questions. Can you answer the following questions? What is Graph Mining? What is a Graph anyway? Is Graph mining just a kind of Machine Learning? i.e. is Machine Learning the only primary component of Graph Mining? Does\u2026","rel":"","context":"In &quot;AI ML DS RL DL NN NLP Data Mining Optimization&quot;","block_context":{"text":"AI ML DS RL DL NN NLP Data Mining Optimization","link":"http:\/\/bangla.sitestree.com\/?cat=1910"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":16333,"url":"http:\/\/bangla.sitestree.com\/?p=16333","url_meta":{"origin":79126,"position":5},"title":"Join a Graph Mining Course","author":"Sayed","date":"October 23, 2019","format":false,"excerpt":"If you are interested to get access to a course (under development) on Graph Mining (Part of AI\/Data Science\/Analytics\/ML), please request using the following Google Form (or just inform us your email in a way so that we can give you access): https:\/\/docs.google.com\/forms\/d\/e\/1FAIpQLSerGzkN9WlWW6SyDwaV-zdcYuSpXXODk9JIBTp7--EA_WTUCg\/viewform?usp=sf_link Or use the event to show your\u2026","rel":"","context":"In &quot;AI ML DS RL DL NN NLP Data Mining Optimization&quot;","block_context":{"text":"AI ML DS RL DL NN NLP Data Mining Optimization","link":"http:\/\/bangla.sitestree.com\/?cat=1910"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/79126","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=79126"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/79126\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=79126"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=79126"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=79126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}