{"id":5496,"date":"2024-06-20T12:14:30","date_gmt":"2024-06-20T10:14:30","guid":{"rendered":"https:\/\/oopm.org\/?page_id=5496"},"modified":"2024-10-13T22:13:22","modified_gmt":"2024-10-13T20:13:22","slug":"11-3-2-graph-representing-a-computer-network","status":"publish","type":"page","link":"https:\/\/oopm.org\/?page_id=5496","title":{"rendered":"11.3.2 Graph representing a computer network"},"content":{"rendered":"<div class=\"pdfprnt-buttons pdfprnt-buttons-page pdfprnt-top-right\"><a href=\"https:\/\/oopm.org\/index.php?rest_route=wpv2pages5496&print=pdf\" class=\"pdfprnt-button pdfprnt-button-pdf\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/oopm.org\/wp-content\/plugins\/pdf-print\/images\/pdf.png\" alt=\"image_pdf\" title=\"View PDF\" \/><\/a><a href=\"https:\/\/oopm.org\/index.php?rest_route=wpv2pages5496&print=print\" class=\"pdfprnt-button pdfprnt-button-print\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/oopm.org\/wp-content\/plugins\/pdf-print\/images\/print.png\" alt=\"image_print\" title=\"Print Content\" \/><\/a><\/div>\n<p class=\"wp-block-paragraph\">Here we sketch a very simple example representing the structure of a computer network using class <code>Graph<\/code>. A <code>Node<\/code> in the graph represent a computer (server) and an <code>Edge<\/code> represents a cable.<\/p>\n\n\n\n<pre class=\"wp-block-code has-custom-color-1-background-color has-background\"><code>   <strong>class<\/strong> Network: Graph\n      <strong>class<\/strong> Node::&lt; \n         send(receiver: <strong>ref<\/strong> Node,P: <strong>ref<\/strong> Packet):\n            :::\n         receive(send: <strong>ref<\/strong> Node,P: <strong>ref<\/strong> Packet): \n            ...\n         :::\n         ...\n      <strong>class<\/strong> Edge::&lt;\n         bandWidth: <strong>var<\/strong> integer\n         send(receiver: <strong>ref<\/strong> Node,P: <strong>ref<\/strong> Packet):\n            ...\n         ...\n      class Packet(S: var String):\n          ...<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Class <code>Network<\/code> is a subclass of <code>Graph<\/code>.<\/li>\n\n\n\n<li>It has further bindings of <code>Node<\/code> and <code>Edge<\/code> from <code>Graph<\/code>.<\/li>\n\n\n\n<li>It adds a class <code>Packet<\/code> representing the packets being communicated in the network.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Class <code>Node<\/code> is extended with:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A method <code>send<\/code> that send the <code>Packet<\/code> <code>P<\/code> to the node represents by <code>receiver<\/code>.<\/li>\n\n\n\n<li>A method <code>receive<\/code> that receives a a <code>Packet<\/code> <code>P<\/code> from the <code>Node<\/code> represented by receiver. <\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Class <code>Edge<\/code> is extended with:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>An <code>integer<\/code> <code>bandWidth<\/code> representing the bandwidth of the cable represented by the <code>Edge<\/code>.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Th details of send in <code>Node<\/code> may be sketched as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code has-custom-color-1-background-color has-background\"><code>send(receiver: <strong>ref<\/strong> Node,P: <strong>ref<\/strong> Packet):\n   map(receiver).send(receiver,P)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Send<\/code> uses an ancillary method <code>map<\/code> to find the <code>edge<\/code> representing the cable that has the fastest connection to the <code>receiver<\/code>, and the invokes <code>send<\/code> on this <code>Edge<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We do not add further details of this examples. It is major task to implement a computer network. It also involves using parallel programming for listening on input\/output ports for packages being transmitted \/ received. Parallel programming is described in chapter <script>mkRef(\"Active objects and parallel programming\")<\/script><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n<div style=\"display:flex; gap:10px;justify-content:center\" class=\"wps-pgfw-pdf-generate-icon__wrapper-frontend\">\n\t\t<a  href=\"https:\/\/oopm.org?action=genpdf&amp;id=5496\" class=\"pgfw-single-pdf-download-button\" ><img src=\"https:\/\/oopm.org\/wp-content\/plugins\/pdf-generator-for-wp\/admin\/src\/images\/PDF_Tray.svg\" title=\"Generate PDF\" style=\"width:auto; height:45px;\"><\/a>\n\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>Here we sketch a very simple example representing the structure of a computer network using class Graph. A Node in the graph represent a computer (server) and an Edge represents a cable. Class Node is extended with: Class Edge is extended with: Th details of send in Node may be sketched as follows: Send uses [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":5429,"menu_order":2,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-5496","page","type-page","status-publish","hentry"],"mb":[],"mfb_rest_fields":["title","gutenberg_elementor_mode"],"_links":{"self":[{"href":"https:\/\/oopm.org\/index.php?rest_route=\/wp\/v2\/pages\/5496","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oopm.org\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/oopm.org\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/oopm.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oopm.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5496"}],"version-history":[{"count":5,"href":"https:\/\/oopm.org\/index.php?rest_route=\/wp\/v2\/pages\/5496\/revisions"}],"predecessor-version":[{"id":8488,"href":"https:\/\/oopm.org\/index.php?rest_route=\/wp\/v2\/pages\/5496\/revisions\/8488"}],"up":[{"embeddable":true,"href":"https:\/\/oopm.org\/index.php?rest_route=\/wp\/v2\/pages\/5429"}],"wp:attachment":[{"href":"https:\/\/oopm.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5496"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}