{"id":76175,"date":"2024-07-20T20:10:26","date_gmt":"2024-07-21T00:10:26","guid":{"rendered":"https:\/\/bangla.sitestree.com\/?p=76175"},"modified":"2024-07-28T17:02:54","modified_gmt":"2024-07-28T21:02:54","slug":"build-an-adjacency-list-graph-from-node-labels-in-a-file","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=76175","title":{"rendered":"Build an Adjacency List Graph from Node Labels in a File"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>\/\/build the graph\nvoid buildGraph(FILE* in, Graph G) {\n\tint j, k, numEdges, weight;\n\tchar name&#91;MaxWordSize], nodeID&#91;MaxWordSize], adjID&#91;MaxWordSize];\n\n\t\/\/ read the names of the vertices \n\t\/\/ and store them in the graph array\n\tfor (j = 1; j &lt;= G->numV; j++) {\n\t\tfscanf(in, \"%s\", name);\n\t\tG->vertex&#91;j] = newGVertex(name);\n\t\tstrcpy(G->vertex&#91;j].id, name);\n\t\t\n\t}\n\n\t\/\/ process edge data for each vertex\n\tfor (j = 1; j &lt;= G->numV; j++) { \n\n\t\t\/\/ information about the parent vertex\n\t\tfscanf(in, \"%s %d\", nodeID, &amp;numEdges); \n\n\t\t\/\/ information about each edge from the parent vertex\n\t\tfor (k = 1; k &lt;= numEdges; k++) { \n\t\t\tfscanf(in, \"%s %d\", adjID, &amp;weight);\n\t\t\taddEdge(nodeID, adjID, weight, G);\n\t\t}\n\t}\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1966,1883,182],"tags":[],"class_list":["post-76175","post","type-post","status-publish","format-standard","hentry","category-data-structure-and-algorithms","category---data-structure","category---blog","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":76177,"url":"http:\/\/bangla.sitestree.com\/?p=76177","url_meta":{"origin":76175,"position":0},"title":"Print an Adjacency List Graph","author":"Sayed","date":"July 20, 2024","format":false,"excerpt":"\/\/ print the graph void printGraph(Graph G) { for (int j = 1; j <= G->numV; j++) { printf(\"%s: \", G->vertex[j].id); GEdgePtr p = G->vertex[j].firstEdge; while (p != NULL) { printf(\"%s %d \", G->vertex[p->child].id, p->weight); p = p->nextEdge; } printf(\"\\n\"); } }","rel":"","context":"In &quot;Data Structure and Algorithms&quot;","block_context":{"text":"Data Structure and Algorithms","link":"http:\/\/bangla.sitestree.com\/?cat=1966"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":76199,"url":"http:\/\/bangla.sitestree.com\/?p=76199","url_meta":{"origin":76175,"position":1},"title":"Steps to Search in a Hash Table Built Using Graph: Chaining","author":"Sayed","date":"July 28, 2024","format":false,"excerpt":"\u2022Search the Hash \u2022Read a number\/word \u2022From the user \u2022Find the position for this number\/word \u2022in the graph (vertical array of nodes) \u2022By dividing with N or similar \u2022Check if any vertex node is there \u2022In that array position (array of graph vertices) \u2022If no vertex is there \u2022The word\u2026","rel":"","context":"In &quot;Data Structure and Algorithms&quot;","block_context":{"text":"Data Structure and Algorithms","link":"http:\/\/bangla.sitestree.com\/?cat=1966"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":76197,"url":"http:\/\/bangla.sitestree.com\/?p=76197","url_meta":{"origin":76175,"position":2},"title":"Steps to Build a Hash Table: Using Graph: Chaining","author":"Sayed","date":"July 28, 2024","format":false,"excerpt":"\u2022Build the Hash \u2022Read a number\/word from file \u2022Find the position for this number\/word \u2022in the graph (vertical array of nodes) \u2022By dividing with N or similar \u2022Check if any vertex node is there \u2022In that array position (array of graph vertices) \u2022If no vertex is there \u2022Create a vertex\u2026","rel":"","context":"In &quot;Data Structure and Algorithms&quot;","block_context":{"text":"Data Structure and Algorithms","link":"http:\/\/bangla.sitestree.com\/?cat=1966"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":22881,"url":"http:\/\/bangla.sitestree.com\/?p=22881","url_meta":{"origin":76175,"position":3},"title":"Graph Mining: Node Importance","author":"Sayed","date":"March 21, 2021","format":false,"excerpt":"Resources to Learn From A Book. Nagiza F. Samatova, William Hendrix, John Jenkins, Kanchana Padmanabhan, and Arpan Chakraborty. 2013. Practical Graph Mining with R. Chapman & Hall\/CRC. Read the resources above to find answers. Betweenness Based Clustering: Learn by finding answers to the following questions. Can you answer the following?\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":16305,"url":"http:\/\/bangla.sitestree.com\/?p=16305","url_meta":{"origin":76175,"position":4},"title":"Graph Mining: Betweenness Based Clustering: Learn by finding answers to the following questions. Can you answer the following?","author":"Sayed","date":"October 8, 2019","format":false,"excerpt":"Graph Mining: Betweenness Based Clustering: Learn by finding answers to the following questions. Can you answer the following? What are the types of Betweenness? What is Vertex Betweenness? i.e. the concept What is Edge Betweenness? i.e. the concept Describe Vertex Betweenness? maybe just giving an example What does Vertex Betweenness\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":76173,"url":"http:\/\/bangla.sitestree.com\/?p=76173","url_meta":{"origin":76175,"position":5},"title":"Nodes: Vertices and Edges. Nodes for them","author":"Sayed","date":"July 20, 2024","format":false,"excerpt":"define MaxWordSize 100 #define MaxWordSize 100 \/\/edge of a graph typedef struct gEdge{ \/\/ child is the location of the child vertex int child, weight; struct gEdge *nextEdge; } GEdge, *GEdgePtr; typedef struct{ char id[MaxWordSize]; int parent, cost, discover, finish, inDegree; GEdgePtr firstEdge; } GVertex; \/\/main method int main() {\u2026","rel":"","context":"In &quot;Data Structure and Algorithms&quot;","block_context":{"text":"Data Structure and Algorithms","link":"http:\/\/bangla.sitestree.com\/?cat=1966"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/76175","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=76175"}],"version-history":[{"count":1,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/76175\/revisions"}],"predecessor-version":[{"id":76176,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/76175\/revisions\/76176"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=76175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=76175"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=76175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}