{"id":85,"date":"2021-03-29T23:58:00","date_gmt":"2021-03-29T15:58:00","guid":{"rendered":"https:\/\/philip.twinight.co\/portfolio\/?p=85"},"modified":"2024-03-06T10:04:19","modified_gmt":"2024-03-06T02:04:19","slug":"analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression","status":"publish","type":"post","link":"https:\/\/philip.twinight.co\/portfolio\/index.php\/2021\/03\/29\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\/","title":{"rendered":"Analysis of Node Degree Distributions in Network Graphs Following Power Law Using Linear Regression"},"content":{"rendered":"\n<p>This is an individual project of SDSC2004 &#8211; Data Visualization. I did the project in my year 1 2020\/21 Semester B.<\/p>\n\n\n\n<p><strong>Project Requirement:<\/strong><\/p>\n\n\n\n<p>The Power Law degree distribution is an important finding in Network Science. Specifically, the Power Law says that in a real network, the distribution of nodes&#8217; degrees roughly satisfies that <img data-opt-id=358329008  fetchpriority=\"high\" loading=\"eager\" decoding=\"async\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/ql-cache\/quicklatex.com-b97b7ba879045fb604591627c2897ef0_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#121;&#32;&#61;&#32;&#99;&#120;&#94;&#123;&#45;&#92;&#97;&#108;&#112;&#104;&#97;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"71\" style=\"vertical-align: -4px;\"\/>, where <img data-opt-id=994320302  fetchpriority=\"high\" loading=\"eager\" decoding=\"async\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/ql-cache\/quicklatex.com-41a04eeea923a1a0c28094a8a4680525_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#99;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"8\" style=\"vertical-align: 0px;\"\/> and <img data-opt-id=24297177  loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/ql-cache\/quicklatex.com-8f0b6b1a01f8fcc2f95be0364c090397_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#97;&#108;&#112;&#104;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"11\" style=\"vertical-align: 0px;\"\/> are two parameters that may vary over different networks, <img data-opt-id=1678074735  loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/ql-cache\/quicklatex.com-ede05c264bba0eda080918aaa09c4658_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#120;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"10\" style=\"vertical-align: 0px;\"\/> indicates a given degree and <img data-opt-id=160488347  loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/ql-cache\/quicklatex.com-0af556714940c351c933bba8cf840796_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#121;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"9\" style=\"vertical-align: -4px;\"\/> denotes the percentage of nodes whose degrees are <img data-opt-id=1678074735  loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/ql-cache\/quicklatex.com-ede05c264bba0eda080918aaa09c4658_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#120;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"10\" style=\"vertical-align: 0px;\"\/>.<\/p>\n\n\n\n<p>(1) Show that if <img data-opt-id=358329008  fetchpriority=\"high\" loading=\"eager\" decoding=\"async\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/ql-cache\/quicklatex.com-b97b7ba879045fb604591627c2897ef0_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#121;&#32;&#61;&#32;&#99;&#120;&#94;&#123;&#45;&#92;&#97;&#108;&#112;&#104;&#97;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"71\" style=\"vertical-align: -4px;\"\/>, <img data-opt-id=847044508  loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/ql-cache\/quicklatex.com-31bcbe13462ad916aa9df6e0e3904429_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#108;&#111;&#103;&#32;&#121;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"35\" style=\"vertical-align: -4px;\"\/> has a linear relationship with <img data-opt-id=421386135  loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/ql-cache\/quicklatex.com-4e8ec9f61f4f63f6f1254e7186ca7ce6_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#108;&#111;&#103;&#32;&#120;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"36\" style=\"vertical-align: -4px;\"\/>. (Hint: the linear relationship is <img data-opt-id=1393821610  loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/ql-cache\/quicklatex.com-0fd4c32a7bdd4f7bb143d3c85c2f1cf0_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#108;&#111;&#103;&#32;&#121;&#32;&#61;&#32;&#99;&#95;&#49;&#32;&#92;&#108;&#111;&#103;&#32;&#120;&#32;&#43;&#32;&#99;&#95;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"150\" style=\"vertical-align: -4px;\"\/>, please find <img data-opt-id=494119701  loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/ql-cache\/quicklatex.com-e126f2c7de223e3fb320085c42dcb484_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#99;&#95;&#49;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"14\" style=\"vertical-align: -3px;\"\/> and <img data-opt-id=1138888969  loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/ql-cache\/quicklatex.com-1eef557b683044cb7abc30d531da5847_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#99;&#95;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"15\" style=\"vertical-align: -3px;\"\/>. You need to figure out how to use c and <img data-opt-id=24297177  loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/ql-cache\/quicklatex.com-8f0b6b1a01f8fcc2f95be0364c090397_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#97;&#108;&#112;&#104;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"11\" style=\"vertical-align: 0px;\"\/> to represent <img data-opt-id=494119701  loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/ql-cache\/quicklatex.com-e126f2c7de223e3fb320085c42dcb484_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#99;&#95;&#49;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"14\" style=\"vertical-align: -3px;\"\/> and <img data-opt-id=1138888969  loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/ql-cache\/quicklatex.com-1eef557b683044cb7abc30d531da5847_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#99;&#95;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"15\" style=\"vertical-align: -3px;\"\/>. The base of <img data-opt-id=421386135  loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/ql-cache\/quicklatex.com-4e8ec9f61f4f63f6f1254e7186ca7ce6_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#108;&#111;&#103;&#32;&#120;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"36\" style=\"vertical-align: -4px;\"\/> and <img data-opt-id=847044508  loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/ql-cache\/quicklatex.com-31bcbe13462ad916aa9df6e0e3904429_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#108;&#111;&#103;&#32;&#121;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"35\" style=\"vertical-align: -4px;\"\/> is e which means <img data-opt-id=529363964  loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/ql-cache\/quicklatex.com-7ba2b23184e65f30ba026c56d462a3e5_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#108;&#111;&#103;&#32;&#120;&#32;&#61;&#32;&#92;&#108;&#110;&#32;&#120;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"87\" style=\"vertical-align: -4px;\"\/>).<\/p>\n\n\n\n<p>(2) Download the com-LiveJournal (<a href=\"https:\/\/snap.stanford.edu\/data\/com-LiveJournal.html\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/snap.stanford.edu\/data\/com-LiveJournal.html<\/a>) dataset and the com-Friendster (<a href=\"https:\/\/snap.stanford.edu\/data\/com-Friendster.html\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/snap.stanford.edu\/data\/com-Friendster.html<\/a>) dataset. Please download &#8220;Undirected XXXXXX network&#8221;. To verify if these two networks&#8217; node degrees follow the Power Law, apply linear regression to fit the model <img data-opt-id=1393821610  loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/ql-cache\/quicklatex.com-0fd4c32a7bdd4f7bb143d3c85c2f1cf0_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#108;&#111;&#103;&#32;&#121;&#32;&#61;&#32;&#99;&#95;&#49;&#32;&#92;&#108;&#111;&#103;&#32;&#120;&#32;&#43;&#32;&#99;&#95;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"150\" style=\"vertical-align: -4px;\"\/>. Report <img data-opt-id=494119701  loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/ql-cache\/quicklatex.com-e126f2c7de223e3fb320085c42dcb484_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#99;&#95;&#49;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"14\" style=\"vertical-align: -3px;\"\/>, <img data-opt-id=1138888969  loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/ql-cache\/quicklatex.com-1eef557b683044cb7abc30d531da5847_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#99;&#95;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"15\" style=\"vertical-align: -3px;\"\/>, and the R-Squared value for the two datasets.<br><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-opt-id=1754145760  loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"871\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:1024\/h:871\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/uploads\/2024\/03\/image.png\" alt=\"\" class=\"wp-image-117\" srcset=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:1024\/h:871\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/uploads\/2024\/03\/image.png 1024w, https:\/\/mlcznkdztmb6.i.optimole.com\/w:300\/h:255\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/uploads\/2024\/03\/image.png 300w, https:\/\/mlcznkdztmb6.i.optimole.com\/w:768\/h:653\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/uploads\/2024\/03\/image.png 768w, https:\/\/mlcznkdztmb6.i.optimole.com\/w:1249\/h:1062\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/uploads\/2024\/03\/image.png 1249w\" sizes=\"auto, (max-width: 792px) 100vw, 792px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-opt-id=1058939461  loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"911\" src=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:1024\/h:911\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/uploads\/2024\/03\/image-1.png\" alt=\"\" class=\"wp-image-118\" srcset=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:1024\/h:911\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/uploads\/2024\/03\/image-1.png 1024w, https:\/\/mlcznkdztmb6.i.optimole.com\/w:300\/h:267\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/uploads\/2024\/03\/image-1.png 300w, https:\/\/mlcznkdztmb6.i.optimole.com\/w:768\/h:683\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/uploads\/2024\/03\/image-1.png 768w, https:\/\/mlcznkdztmb6.i.optimole.com\/w:1214\/h:1080\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/uploads\/2024\/03\/image-1.png 1250w\" sizes=\"auto, (max-width: 792px) 100vw, 792px\" \/><\/figure>\n\n\n\n<p><br><strong>Below is my code (not perfect answer for sure):<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport math\nfrom scipy import stats\n\n# Function to load data from a file\ndef load_data(filename):\n    # Open the file in read mode\n    file = open(filename, \"r\")\n    return file\n\n# Function to map each node ID to its degree\ndef get_node_id_to_degree(file):\n    node_id_to_degree = {}\n    # Read the file lines, skipping the header if present\n    lines = file.readlines()&#x5B;4:]  # Adjust the number based on file header lines\n    for line in lines:\n        # Process lines with two integers representing nodes\n        if len(line.split()) == 2:\n            node1 = int(line.split()&#x5B;0])\n            node2 = int(line.split()&#x5B;1])\n            # Update the degree count for both nodes\n            add_to_dict(node1, node_id_to_degree)\n            add_to_dict(node2, node_id_to_degree)\n    return node_id_to_degree\n\n# Helper function to update degree count in a dictionary\ndef add_to_dict(key, dictionary):\n    # Increment the node's degree count or add it if not present\n    if key in dictionary:\n        dictionary&#x5B;key] += 1\n    else:\n        dictionary&#x5B;key] = 1\n\n# Function to map each degree to its frequency count\ndef get_degree_to_count(node_id_to_degree):\n    degree_to_count = {}\n    for node_id, degree in node_id_to_degree.items():\n        add_to_dict(degree, degree_to_count)\n    return degree_to_count\n\n# Function to generate the x and y values for linear regression\ndef generate_xy(degree_to_count):\n    x = &#x5B;]\n    y = &#x5B;]\n    # Calculate the total number of nodes\n    number_of_nodes = sum(degree_to_count.values())\n    for degree, count in degree_to_count.items():\n        # Apply logarithmic transformation for the Power Law distribution\n        x.append(math.log(degree))\n        y.append(math.log(count \/ number_of_nodes))\n    return x, y\n\n# Function to perform linear regression and return model parameters\ndef get_c1_c2_rsquared(x, y):\n    # Perform linear regression on log-log transformed data\n    slope, intercept, r_value, p_value, std_err = stats.linregress(x, y)\n    return slope, intercept, r_value ** 2\n\n# Main block to execute the functions\nif __name__ == '__main__':\n    # Replace 'FileName.txt' with the actual file name\n    file = load_data(\"FileName.txt\")\n    node_id_to_degree = get_node_id_to_degree(file)\n    degree_to_count = get_degree_to_count(node_id_to_degree)\n    x_list, y_list = generate_xy(degree_to_count)\n    c1, c2, rsquared = get_c1_c2_rsquared(x_list, y_list)\n    \n    # Output the results\n    print(f\"c1 (slope): {c1}\")\n    print(f\"c2 (intercept): {c2}\")\n    print(f\"R-squared value: {rsquared}\")\n<\/pre><\/div>\n\n\n<p><strong>Result: (cor. to 7 d.p.)<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td>c1<\/td><td>c2<\/td><td>R-Squared value<\/td><\/tr><tr><td>com-LiveJournal<\/td><td>-2.3955318<\/td><td>2.5449043<\/td><td>0.9232843<\/td><\/tr><tr><td>com-Friendster<\/td><td>-2.6347939<\/td><td>21.0607001<\/td><td>0.9194954<\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>This is an individual project of SDSC2004 &#8211; Data Visualization. I did the project in my year 1 2020\/21 Semester B. Project Requirement: The Power Law degree distribution is an &hellip; <a href=\"https:\/\/philip.twinight.co\/portfolio\/index.php\/2021\/03\/29\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\/\" class=\"more-link\"><span>Continue reading<span class=\"screen-reader-text\">Analysis of Node Degree Distributions in Network Graphs Following Power Law Using Linear Regression<\/span><\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":330,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[74,3],"tags":[11,13,15,14,12],"class_list":["post-85","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-network-science","category-proj","tag-2020-21-semester-b","tag-data-science","tag-data-visualization","tag-sdsc2004","tag-year-1"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Analysis of Node Degree Distributions in Network Graphs Following Power Law Using Linear Regression - Philip\u2019s Data Science Diary<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/philip.twinight.co\/portfolio\/index.php\/2021\/03\/29\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Analysis of Node Degree Distributions in Network Graphs Following Power Law Using Linear Regression - Philip\u2019s Data Science Diary\" \/>\n<meta property=\"og:description\" content=\"This is an individual project of SDSC2004 &#8211; Data Visualization. I did the project in my year 1 2020\/21 Semester B. Project Requirement: The Power Law degree distribution is an &hellip; Continue readingAnalysis of Node Degree Distributions in Network Graphs Following Power Law Using Linear Regression\" \/>\n<meta property=\"og:url\" content=\"https:\/\/philip.twinight.co\/portfolio\/index.php\/2021\/03\/29\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\/\" \/>\n<meta property=\"og:site_name\" content=\"Philip\u2019s Data Science Diary\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-29T15:58:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-06T02:04:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/uploads\/2021\/03\/Analyzing-Power-Law-in-Network-Graphs-with-Linear-Regression.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Philip\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Philip\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/index.php\\\/2021\\\/03\\\/29\\\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/index.php\\\/2021\\\/03\\\/29\\\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\\\/\"},\"author\":{\"name\":\"Philip\",\"@id\":\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/#\\\/schema\\\/person\\\/ef4f7cedd9b3bde11e126c4dbe1f8414\"},\"headline\":\"Analysis of Node Degree Distributions in Network Graphs Following Power Law Using Linear Regression\",\"datePublished\":\"2021-03-29T15:58:00+00:00\",\"dateModified\":\"2024-03-06T02:04:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/index.php\\\/2021\\\/03\\\/29\\\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\\\/\"},\"wordCount\":289,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/#\\\/schema\\\/person\\\/ef4f7cedd9b3bde11e126c4dbe1f8414\"},\"image\":{\"@id\":\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/index.php\\\/2021\\\/03\\\/29\\\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\/\\/philip.twinight.co\\/portfolio\\/wp-content\\/uploads\\/2021\\/03\\/Analyzing-Power-Law-in-Network-Graphs-with-Linear-Regression.png\",\"keywords\":[\"2020\\\/21 Semester B\",\"Data Science\",\"Data Visualization\",\"SDSC2004\",\"Year 1\"],\"articleSection\":[\"Network Science\",\"Projects\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/index.php\\\/2021\\\/03\\\/29\\\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/index.php\\\/2021\\\/03\\\/29\\\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\\\/\",\"url\":\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/index.php\\\/2021\\\/03\\\/29\\\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\\\/\",\"name\":\"Analysis of Node Degree Distributions in Network Graphs Following Power Law Using Linear Regression - Philip\u2019s Data Science Diary\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/index.php\\\/2021\\\/03\\\/29\\\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/index.php\\\/2021\\\/03\\\/29\\\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\/\\/philip.twinight.co\\/portfolio\\/wp-content\\/uploads\\/2021\\/03\\/Analyzing-Power-Law-in-Network-Graphs-with-Linear-Regression.png\",\"datePublished\":\"2021-03-29T15:58:00+00:00\",\"dateModified\":\"2024-03-06T02:04:19+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/index.php\\\/2021\\\/03\\\/29\\\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/index.php\\\/2021\\\/03\\\/29\\\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/index.php\\\/2021\\\/03\\\/29\\\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\\\/#primaryimage\",\"url\":\"https:\\/\\/philip.twinight.co\\/portfolio\\/wp-content\\/uploads\\/2021\\/03\\/Analyzing-Power-Law-in-Network-Graphs-with-Linear-Regression.png\",\"contentUrl\":\"https:\\/\\/philip.twinight.co\\/portfolio\\/wp-content\\/uploads\\/2021\\/03\\/Analyzing-Power-Law-in-Network-Graphs-with-Linear-Regression.png\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/index.php\\\/2021\\\/03\\\/29\\\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9801\",\"item\":\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Analysis of Node Degree Distributions in Network Graphs Following Power Law Using Linear Regression\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/#website\",\"url\":\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/\",\"name\":\"Philip\u2019s University Data Science Journey\",\"description\":\"Navigating Data Science: From Classroom to Career\",\"publisher\":{\"@id\":\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/#\\\/schema\\\/person\\\/ef4f7cedd9b3bde11e126c4dbe1f8414\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/#\\\/schema\\\/person\\\/ef4f7cedd9b3bde11e126c4dbe1f8414\",\"name\":\"Philip\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\/\\/philip.twinight.co\\/portfolio\\/wp-content\\/uploads\\/2024\\/03\\/favicon.png\",\"url\":\"https:\\/\\/philip.twinight.co\\/portfolio\\/wp-content\\/uploads\\/2024\\/03\\/favicon.png\",\"contentUrl\":\"https:\\/\\/philip.twinight.co\\/portfolio\\/wp-content\\/uploads\\/2024\\/03\\/favicon.png\",\"width\":16,\"height\":16,\"caption\":\"Philip\"},\"logo\":{\"@id\":\"https:\\/\\/philip.twinight.co\\/portfolio\\/wp-content\\/uploads\\/2024\\/03\\/favicon.png\"},\"description\":\"Data Scientist &amp; Systems Engineer. Graduated from City University of Hong Kong. Previously founded Twinight Limited as CTO, developing AI investment analytics and automated trading solutions. Currently working as a Test and Integration Engineer on a Vessel Traffic Service (VTS) system in the maritime industry since December 2024.\",\"sameAs\":[\"https:\\\/\\\/philip.twinight.co\\\/portfolio\"],\"url\":\"https:\\\/\\\/philip.twinight.co\\\/portfolio\\\/index.php\\\/author\\\/philip\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Analysis of Node Degree Distributions in Network Graphs Following Power Law Using Linear Regression - Philip\u2019s Data Science Diary","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/philip.twinight.co\/portfolio\/index.php\/2021\/03\/29\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\/","og_locale":"en_GB","og_type":"article","og_title":"Analysis of Node Degree Distributions in Network Graphs Following Power Law Using Linear Regression - Philip\u2019s Data Science Diary","og_description":"This is an individual project of SDSC2004 &#8211; Data Visualization. I did the project in my year 1 2020\/21 Semester B. Project Requirement: The Power Law degree distribution is an &hellip; Continue readingAnalysis of Node Degree Distributions in Network Graphs Following Power Law Using Linear Regression","og_url":"https:\/\/philip.twinight.co\/portfolio\/index.php\/2021\/03\/29\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\/","og_site_name":"Philip\u2019s Data Science Diary","article_published_time":"2021-03-29T15:58:00+00:00","article_modified_time":"2024-03-06T02:04:19+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/uploads\/2021\/03\/Analyzing-Power-Law-in-Network-Graphs-with-Linear-Regression.png","type":"image\/png"}],"author":"Philip","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Philip","Estimated reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/philip.twinight.co\/portfolio\/index.php\/2021\/03\/29\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\/#article","isPartOf":{"@id":"https:\/\/philip.twinight.co\/portfolio\/index.php\/2021\/03\/29\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\/"},"author":{"name":"Philip","@id":"https:\/\/philip.twinight.co\/portfolio\/#\/schema\/person\/ef4f7cedd9b3bde11e126c4dbe1f8414"},"headline":"Analysis of Node Degree Distributions in Network Graphs Following Power Law Using Linear Regression","datePublished":"2021-03-29T15:58:00+00:00","dateModified":"2024-03-06T02:04:19+00:00","mainEntityOfPage":{"@id":"https:\/\/philip.twinight.co\/portfolio\/index.php\/2021\/03\/29\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\/"},"wordCount":289,"commentCount":0,"publisher":{"@id":"https:\/\/philip.twinight.co\/portfolio\/#\/schema\/person\/ef4f7cedd9b3bde11e126c4dbe1f8414"},"image":{"@id":"https:\/\/philip.twinight.co\/portfolio\/index.php\/2021\/03\/29\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\/#primaryimage"},"thumbnailUrl":"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/uploads\/2021\/03\/Analyzing-Power-Law-in-Network-Graphs-with-Linear-Regression.png","keywords":["2020\/21 Semester B","Data Science","Data Visualization","SDSC2004","Year 1"],"articleSection":["Network Science","Projects"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/philip.twinight.co\/portfolio\/index.php\/2021\/03\/29\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/philip.twinight.co\/portfolio\/index.php\/2021\/03\/29\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\/","url":"https:\/\/philip.twinight.co\/portfolio\/index.php\/2021\/03\/29\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\/","name":"Analysis of Node Degree Distributions in Network Graphs Following Power Law Using Linear Regression - Philip\u2019s Data Science Diary","isPartOf":{"@id":"https:\/\/philip.twinight.co\/portfolio\/#website"},"primaryImageOfPage":{"@id":"https:\/\/philip.twinight.co\/portfolio\/index.php\/2021\/03\/29\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\/#primaryimage"},"image":{"@id":"https:\/\/philip.twinight.co\/portfolio\/index.php\/2021\/03\/29\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\/#primaryimage"},"thumbnailUrl":"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/uploads\/2021\/03\/Analyzing-Power-Law-in-Network-Graphs-with-Linear-Regression.png","datePublished":"2021-03-29T15:58:00+00:00","dateModified":"2024-03-06T02:04:19+00:00","breadcrumb":{"@id":"https:\/\/philip.twinight.co\/portfolio\/index.php\/2021\/03\/29\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/philip.twinight.co\/portfolio\/index.php\/2021\/03\/29\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/philip.twinight.co\/portfolio\/index.php\/2021\/03\/29\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\/#primaryimage","url":"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/uploads\/2021\/03\/Analyzing-Power-Law-in-Network-Graphs-with-Linear-Regression.png","contentUrl":"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/uploads\/2021\/03\/Analyzing-Power-Law-in-Network-Graphs-with-Linear-Regression.png","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/philip.twinight.co\/portfolio\/index.php\/2021\/03\/29\/analysis-of-node-degree-distributions-in-network-graphs-following-power-law-using-linear-regression\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9801","item":"https:\/\/philip.twinight.co\/portfolio\/"},{"@type":"ListItem","position":2,"name":"Analysis of Node Degree Distributions in Network Graphs Following Power Law Using Linear Regression"}]},{"@type":"WebSite","@id":"https:\/\/philip.twinight.co\/portfolio\/#website","url":"https:\/\/philip.twinight.co\/portfolio\/","name":"Philip\u2019s University Data Science Journey","description":"Navigating Data Science: From Classroom to Career","publisher":{"@id":"https:\/\/philip.twinight.co\/portfolio\/#\/schema\/person\/ef4f7cedd9b3bde11e126c4dbe1f8414"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/philip.twinight.co\/portfolio\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":["Person","Organization"],"@id":"https:\/\/philip.twinight.co\/portfolio\/#\/schema\/person\/ef4f7cedd9b3bde11e126c4dbe1f8414","name":"Philip","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/uploads\/2024\/03\/favicon.png","url":"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/uploads\/2024\/03\/favicon.png","contentUrl":"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/uploads\/2024\/03\/favicon.png","width":16,"height":16,"caption":"Philip"},"logo":{"@id":"https:\/\/mlcznkdztmb6.i.optimole.com\/w:auto\/h:auto\/q:mauto\/f:best\/ig:avif\/https:\/\/philip.twinight.co\/portfolio\/wp-content\/uploads\/2024\/03\/favicon.png"},"description":"Data Scientist &amp; Systems Engineer. Graduated from City University of Hong Kong. Previously founded Twinight Limited as CTO, developing AI investment analytics and automated trading solutions. Currently working as a Test and Integration Engineer on a Vessel Traffic Service (VTS) system in the maritime industry since December 2024.","sameAs":["https:\/\/philip.twinight.co\/portfolio"],"url":"https:\/\/philip.twinight.co\/portfolio\/index.php\/author\/philip\/"}]}},"_links":{"self":[{"href":"https:\/\/philip.twinight.co\/portfolio\/index.php\/wp-json\/wp\/v2\/posts\/85","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/philip.twinight.co\/portfolio\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/philip.twinight.co\/portfolio\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/philip.twinight.co\/portfolio\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/philip.twinight.co\/portfolio\/index.php\/wp-json\/wp\/v2\/comments?post=85"}],"version-history":[{"count":12,"href":"https:\/\/philip.twinight.co\/portfolio\/index.php\/wp-json\/wp\/v2\/posts\/85\/revisions"}],"predecessor-version":[{"id":348,"href":"https:\/\/philip.twinight.co\/portfolio\/index.php\/wp-json\/wp\/v2\/posts\/85\/revisions\/348"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/philip.twinight.co\/portfolio\/index.php\/wp-json\/wp\/v2\/media\/330"}],"wp:attachment":[{"href":"https:\/\/philip.twinight.co\/portfolio\/index.php\/wp-json\/wp\/v2\/media?parent=85"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/philip.twinight.co\/portfolio\/index.php\/wp-json\/wp\/v2\/categories?post=85"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/philip.twinight.co\/portfolio\/index.php\/wp-json\/wp\/v2\/tags?post=85"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}