{"id":79125,"date":"2026-11-18T03:31:42","date_gmt":"2026-11-18T03:31:42","guid":{"rendered":"http:\/\/bangla.sitestree.com\/?p=79125"},"modified":"2026-11-18T03:31:42","modified_gmt":"2026-11-18T03:31:42","slug":"graph-mining-1-13-project-prompts-part-2","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=79125","title":{"rendered":"Graph Mining &#8211; 1 | 13. Assignments and Project Prompts \u2014 Part 2 (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.04\u201313.06.<\/p>\n<h3 class=\"wp-block-heading\">Q13.04. Run graph-property queries on small and large datasets. Find isolated vertices, count bidirectional edges and cliques, find the 10 highest in-degrees and 100 highest out-degrees, and count disconnected subgraphs.<\/h3>\n<p class=\"wp-block-paragraph\"><strong>Answer.<\/strong> <strong>Worked solution.<\/strong> For a directed graph, use in\/out degrees, reciprocal (mutual) edge pairs, weakly and strongly connected components. Isolated nodes have zero incident edges. Enumerating all cliques can be exponential, so report exact counts only for small graphs or explicitly bounded clique sizes on large graphs. The Python example below runs the requested property queries.<\/p>\n<h3 class=\"wp-block-heading\">Q13.05. Implement vertex betweenness, edge betweenness, and closeness centrality on a graph dataset such as political blogs.<\/h3>\n<p class=\"wp-block-paragraph\"><strong>Answer.<\/strong> <strong>Worked solution.<\/strong> Select a lawful, research-appropriate graph dataset (for a small built-in example, use Zachary\u2019s Karate Club); compute betweenness centrality for vertices and edges, plus closeness centrality. State whether the graph is directed and how to interpret disconnected vertices. Compare the top-ranked nodes and bridges; the scores are structural measures, not moral judgments.<\/p>\n<h3 class=\"wp-block-heading\">Q13.06. Implement page-ranking methods such as HITS and analyze hubs and authorities.<\/h3>\n<p class=\"wp-block-paragraph\"><strong>Answer.<\/strong> <strong>Worked solution.<\/strong> Create a directed hyperlink graph and calculate HITS hub\/authority vectors and PageRank ranks. Check that the PageRank vector sums to one, HITS vectors have unit norm if L2-normalized, and results match a trusted library within numerical tolerance. The <a href=\"http:\/\/bangla.sitestree.com\/?p=79112\">full HITS\/PageRank from-scratch lesson<\/a> provides complete Python functions.<\/p>\n<h2 class=\"wp-block-heading\">Graph property queries (directed graph)<\/h2>\n<pre class=\"wp-block-preformatted\">import networkx as nx\nD=nx.DiGraph()\nD.add_nodes_from(range(9))\nD.add_edges_from([(0,1),(1,0),(0,2),(1,2),(2,3),\n                  (3,4),(4,3),(4,5),(5,6),(6,5)])\n\nisolated=list(nx.isolates(D))\nreciprocal={frozenset((u,v)) for u,v in D.edges()\n            if u!=v and D.has_edge(v,u)}\ntop_in=sorted(D.in_degree(),key=lambda x:x[1],reverse=True)[:10]\ntop_out=sorted(D.out_degree(),key=lambda x:x[1],reverse=True)[:100]\nweak=list(nx.weakly_connected_components(D))\nstrong=list(nx.strongly_connected_components(D))\n# Cliques are defined on the undirected projection.\nU=D.to_undirected()\nmaximal_cliques=list(nx.find_cliques(U))\nprint(\"Isolated:\",isolated)\nprint(\"Reciprocal pairs:\",len(reciprocal))\nprint(\"Maximal cliques:\",len(maximal_cliques))\nprint(\"Top in degree:\",top_in)\nprint(\"Top out degree:\",top_out[:10])\nprint(\"Weak\/strong components:\",len(weak),len(strong))\n# All-clique enumeration is exponential; avoid on huge graphs.<\/pre>\n<h2 class=\"wp-block-heading\">Centrality comparison on a real small graph<\/h2>\n<pre class=\"wp-block-preformatted\">import networkx as nx\nG = nx.karate_club_graph()\nnode_bc = nx.betweenness_centrality(G)\nedge_bc = nx.edge_betweenness_centrality(G)\ncloseness = nx.closeness_centrality(G)\nprint(\"Top 5 vertex betweenness:\",\n      sorted(node_bc.items(),key=lambda x:-x[1])[:5])\nprint(\"Top 5 edge betweenness:\",\n      sorted(edge_bc.items(),key=lambda x:-x[1])[:5])\nprint(\"Top 5 closeness:\",\n      sorted(closeness.items(),key=lambda x:-x[1])[:5])\n# Compare different centrality notions; high score is not a label.<\/pre>\n<p class=\"wp-block-paragraph\">For a large graph, stream or partition queries where feasible, and limit clique enumeration. Report whether counts refer to strongly versus weakly connected components and to maximal versus all cliques.<\/p>","protected":false},"excerpt":{"rendered":"<p>Graph Mining course assignments part 2: worked answers for source prompts 13.04\u201313.06 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-79125","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":79125,"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":79126,"url":"http:\/\/bangla.sitestree.com\/?p=79126","url_meta":{"origin":79125,"position":1},"title":"Graph Mining &#8211; 1 | 13. Assignments and Project Prompts \u2014 Part 3 (Worked Answers)","author":"Sayed","date":"November 18, 2026","format":false,"excerpt":"Graph Mining course assignments part 3: worked answers for source prompts 13.07\u201313.09 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":79125,"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":22891,"url":"http:\/\/bangla.sitestree.com\/?p=22891","url_meta":{"origin":79125,"position":3},"title":"Graph Mining: Misc. Topics to Learn: Misc. Resources to Learn From","author":"Sayed","date":"March 21, 2021","format":false,"excerpt":"Graph Mining: Misc. Topics to Learn: Misc. Resources to Learn From Influence\/Virus\/Label Propagation Resources to learn fromPage A presentation on Influence\/Virus PropagationURL Big Data Graph Databases Resources to Learn FromPage Graph DatabaseURL Neo4jPage Big Data Graph Processing Resources to Learn FromPage ToolURL Techniques, Tools and Applications of Graph AnalyticURL Graph\u2026","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":16311,"url":"http:\/\/bangla.sitestree.com\/?p=16311","url_meta":{"origin":79125,"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":79108,"url":"http:\/\/bangla.sitestree.com\/?p=79108","url_meta":{"origin":79125,"position":5},"title":"Graph Mining &#8211; 1 | 03. Small World Networks and Random Graphs \u2014 Part 1 (Q&#038;A)","author":"Sayed","date":"November 18, 2026","format":false,"excerpt":"Graph Mining course 03, part 1: 19 questions with AI-generated answers about small-world networks, ER, Watts-Strogatz and preferential attachment.","rel":"","context":"In &quot;Graph Mining&quot;","block_context":{"text":"Graph Mining","link":"http:\/\/bangla.sitestree.com\/?cat=1905"},"img":{"alt_text":"Animated graph with local community connections and later bridge edges.","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":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/79125","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=79125"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/79125\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=79125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=79125"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=79125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}