<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>nodes Archives - NeuralLantern.com</title>
	<atom:link href="https://www.NeuralLantern.com/tag/nodes/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.NeuralLantern.com/tag/nodes/</link>
	<description></description>
	<lastBuildDate>Mon, 06 Jul 2026 10:05:09 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://www.NeuralLantern.com/wp-content/uploads/2025/04/cropped-2025-04-04-Lantern-03-32x32.png</url>
	<title>nodes Archives - NeuralLantern.com</title>
	<link>https://www.NeuralLantern.com/tag/nodes/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>4 Graph Types: Undirected vs Directed, Weighted vs Unweighted</title>
		<link>https://www.NeuralLantern.com/4-graph-types-undirected-vs-directed-weighted-vs-unweighted/</link>
					<comments>https://www.NeuralLantern.com/4-graph-types-undirected-vs-directed-weighted-vs-unweighted/#respond</comments>
		
		<dc:creator><![CDATA[mike]]></dc:creator>
		<pubDate>Mon, 06 Jul 2026 10:05:07 +0000</pubDate>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Data Structures]]></category>
		<category><![CDATA[Graphs]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[binary search tree]]></category>
		<category><![CDATA[coding tutorial]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[data structures]]></category>
		<category><![CDATA[directed graph]]></category>
		<category><![CDATA[edges]]></category>
		<category><![CDATA[graph theory]]></category>
		<category><![CDATA[graph types]]></category>
		<category><![CDATA[graphs]]></category>
		<category><![CDATA[network topology]]></category>
		<category><![CDATA[nodes]]></category>
		<category><![CDATA[pathfinding]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[undirected graph]]></category>
		<category><![CDATA[unweighted graph]]></category>
		<category><![CDATA[vertices]]></category>
		<category><![CDATA[weighted graph]]></category>
		<guid isPermaLink="false">https://www.NeuralLantern.com/?p=407</guid>

					<description><![CDATA[<p>A graph is basically a collection of nodes, also known as vertices, and edges, which are the lines that connect nodes to each other. The four types of graphs are undirected unweighted, undirected weighted, directed unweighted, and directed weighted. Graphs help represent relationships between things like computers in a network or cities and airports.</p>
<p>The post <a href="https://www.NeuralLantern.com/4-graph-types-undirected-vs-directed-weighted-vs-unweighted/">4 Graph Types: Undirected vs Directed, Weighted vs Unweighted</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe title="4 Graph Types: Undirected vs Directed, Weighted vs Unweighted" width="1380" height="776" src="https://www.youtube.com/embed/8Ml20VhpdrI?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<p class="wp-block-paragraph">In this video we break down the four main types of graphs used in computer science: undirected unweighted, undirected weighted, directed unweighted, and directed weighted.</p>



<p class="wp-block-paragraph">We start with the basic idea of graphs &#8211; collections of nodes (vertices) and edges &#8211; and then explore each type with clear examples. Learn how these graphs represent real-world relationships like computer networks, airport routes, road maps, and game maps.</p>



<p class="wp-block-paragraph">Perfect for anyone learning data structures, algorithms, or preparing for coding interviews.</p>



<p class="wp-block-paragraph">00:00 Introduction to Graphs<br>00:19 Basic Graph Definition<br>00:48 Nodes and Vertices<br>01:01 Empty Graph Example<br>01:17 Graph Implementation Concepts<br>02:02 Node Data and Templates<br>03:22 Adding Nodes<br>04:00 Adding Edges<br>04:44 What Graphs Represent<br>05:36 Graph Use Cases<br>06:56 Real-World Examples<br>08:35 Four Types of Graphs<br>08:52 Undirected Unweighted Graph<br>10:40 Unweighted as Unit Weights<br>11:40 Undirected Weighted Graph<br>13:32 Weighted Graph Benefits<br>15:52 Directed Weighted Graph<br>19:50 Directed Unweighted Graph<br>20:32 Summary of Four Graph Types<br>21:19 Closing and Future Videos</p>



<p class="wp-block-paragraph">=-=-=-=-=-=-=-=-=</p>



<p class="wp-block-paragraph">Thanks for watching!</p>



<p class="wp-block-paragraph">Find us on other social media here:</p>



<ul class="wp-block-list">
<li>https://www.NeuralLantern.com/social</li>



<li>Twitter / X: https://x.com/NeuralLantern</li>



<li>Rumble: https://rumble.com/c/c-3696939</li>



<li>BitChute: https://www.bitchute.com/channel/pg1Pvv5dN4Gt</li>



<li>Daily Motion: https://www.dailymotion.com/neurallantern</li>



<li>Minds: https://www.minds.com/neurallantern/</li>



<li>Odysee: https://odysee.com/@NeuralLantern:5</li>
</ul>



<p class="wp-block-paragraph">Please show your support!</p>



<ul class="wp-block-list">
<li>Buy me a coffee: https://ko-fi.com/neurallantern</li>



<li>Subscribe + Sharing on Social Media</li>



<li>Leave a comment or suggestion</li>



<li>Subscribe to the Blog: https://www.NeuralLantern.com</li>



<li>Watch the main &#8220;pinned&#8221; video of this channel for offers and extras</li>
</ul>



<p class="wp-block-paragraph">Hello there! Let&#8217;s talk about four different types of graphs that you can use and how they relate to computer science.</p>



<p class="wp-block-paragraph">Okay, so you can see like I&#8217;ve got like a blank little graph paper up here.</p>



<p class="wp-block-paragraph">I&#8217;m going to talk about graphs and just the very basic idea of graphs in general</p>



<p class="wp-block-paragraph">and then show you the four different types of graphs that we have.</p>



<p class="wp-block-paragraph">about how to implement graphs inside the machine, time complexities, maybe graph algorithms,</p>



<p class="wp-block-paragraph">and a whole bunch of stuff, terminology, everything. Okay, so the first thing is, I guess I&#8217;m going to</p>



<p class="wp-block-paragraph">assume probably most of you have sort of seen a graph before and you kind of understand a little</p>



<p class="wp-block-paragraph">bit about it already, but I&#8217;ll say that a graph is basically a collection of nodes, also known as</p>



<p class="wp-block-paragraph">vertices or vertexes, and edges, which are the lines that connect nodes to each other. This screen</p>



<p class="wp-block-paragraph">See, this is a valid graph.</p>



<p class="wp-block-paragraph">I&#8217;m not talking about the graphing paper.</p>



<p class="wp-block-paragraph">It&#8217;s just an empty graph.</p>



<p class="wp-block-paragraph">There&#8217;s nothing there.</p>



<p class="wp-block-paragraph">So it&#8217;s still valid.</p>



<p class="wp-block-paragraph">It&#8217;s just blank.</p>



<p class="wp-block-paragraph">Okay, so then what I want to do is start drawing some nodes.</p>



<p class="wp-block-paragraph">What are the nodes again?</p>



<p class="wp-block-paragraph">Those are just vertices.</p>



<p class="wp-block-paragraph">Those are just like little data structure objects you can imagine in the code.</p>



<p class="wp-block-paragraph">I don&#8217;t want to get too far ahead of myself, but imagine that you have a class called graph.</p>



<p class="wp-block-paragraph">This is just one way to imagine.</p>



<p class="wp-block-paragraph">We have a class called graph and then a nested class inside of a graph called a node or a vertex</p>



<p class="wp-block-paragraph">If you want to be more fancy</p>



<p class="wp-block-paragraph">So the vertex class itself by the way</p>



<p class="wp-block-paragraph">This is not always going to be the way that you actually do this in your code the other representations that we&#8217;ll talk about sooner a little bit easier, but</p>



<p class="wp-block-paragraph">The vertex class itself needs to basically hold some data</p>



<p class="wp-block-paragraph">Depending on your implementation it might know about who it&#8217;s connected to maybe the graph knows that instead</p>



<p class="wp-block-paragraph">instead. In my implementations, the graph is going to know everything, but the vertex or the node</p>



<p class="wp-block-paragraph">itself needs to hold one piece of data. That&#8217;s kind of the whole point. So I&#8217;m going to say that</p>



<p class="wp-block-paragraph">the data type that these nodes hold are just integers. So I&#8217;m just going to put like a six in</p>



<p class="wp-block-paragraph">here just to indicate we have one node and the templated data type that it holds is an integer.</p>



<p class="wp-block-paragraph">And the specific integer for this specific node is just the number six. You can have any template</p>



<p class="wp-block-paragraph">any template type if you really want to you can people put floats in there you could put a custom</p>



<p class="wp-block-paragraph">custom class in there whatever you want but i just want to show you that we have a class called</p>



<p class="wp-block-paragraph">vertex or node and inside of it&#8217;s got a template type maybe just to make this a little bit more</p>



<p class="wp-block-paragraph">clear i&#8217;ll say you can imagine inside the vertex class uh there is a template type and we&#8217;ll call</p>



<p class="wp-block-paragraph">it uh i don&#8217;t know node node value type or something and we&#8217;ll call it data and then up</p>



<p class="wp-block-paragraph">I&#8217;m doing C++ up here.</p>



<p class="wp-block-paragraph">We have to kind of define the whole graph class as a template class.</p>



<p class="wp-block-paragraph">Now, of course, you could define the vertex class as the template class,</p>



<p class="wp-block-paragraph">but if you define the graph class as a template, then it all kind of falls through.</p>



<p class="wp-block-paragraph">So I&#8217;m just going to say class node value type.</p>



<p class="wp-block-paragraph">And so if you&#8217;ve written template classes before in C++,</p>



<p class="wp-block-paragraph">now you know that the user can instance the graph and at the same time,</p>



<p class="wp-block-paragraph">specify what is the data type of the stuff that the nodes hold.</p>



<p class="wp-block-paragraph">the stuff that the nodes hold.</p>



<p class="wp-block-paragraph">We do the same thing for edges too,</p>



<p class="wp-block-paragraph">but notice how there are no nodes that are connected to each other.</p>



<p class="wp-block-paragraph">So we have no edges in this graph.</p>



<p class="wp-block-paragraph">This is still a valid graph,</p>



<p class="wp-block-paragraph">but we could just sort of copy a node just for fun and say,</p>



<p class="wp-block-paragraph">all right, we&#8217;ve got two nodes now, two vertices.</p>



<p class="wp-block-paragraph">They could have the same value if you want.</p>



<p class="wp-block-paragraph">Graphs are supposed to, you know, support duplicate values in the nodes,</p>



<p class="wp-block-paragraph">but I&#8217;m just going to change the value here.</p>



<p class="wp-block-paragraph">This is also a valid graph.</p>



<p class="wp-block-paragraph">You don&#8217;t really need edges to have a valid graph.</p>



<p class="wp-block-paragraph">edges to have a valid graph. This is just something called a something called a graph that is not</p>



<p class="wp-block-paragraph">connected. We&#8217;ll talk about all that terminology and how to detect it in a future video. For now,</p>



<p class="wp-block-paragraph">I&#8217;m just going to say we have like a little graph here, which is kind of boring, but I&#8217;m going to</p>



<p class="wp-block-paragraph">add an edge. An edge is basically just, you know, a little mini data structure that connects two</p>



<p class="wp-block-paragraph">nodes. Depending on the way you represent this in the machine, which we&#8217;ll talk about in future</p>



<p class="wp-block-paragraph">well, a whole bunch of different ways.</p>



<p class="wp-block-paragraph">You could imagine this as a full-fledged class,</p>



<p class="wp-block-paragraph">although that&#8217;s not always going to be the way that we represent an actual edge.</p>



<p class="wp-block-paragraph">So imagine that we have a nested class called edge.</p>



<p class="wp-block-paragraph">And inside the edge class, we&#8217;ve got, you know, some stuff.</p>



<p class="wp-block-paragraph">We could have a weight, which means the cost of traveling against the edge.</p>



<p class="wp-block-paragraph">We could have many other properties.</p>



<p class="wp-block-paragraph">For now, I&#8217;ll just try to keep it simple.</p>



<p class="wp-block-paragraph">is pretty much a collection of vertices and edges and some sort of connection.</p>



<p class="wp-block-paragraph">What is a graph really for?</p>



<p class="wp-block-paragraph">Some people at first think that a graph is another way to represent a database.</p>



<p class="wp-block-paragraph">I&#8217;m going to erase this thing over here.</p>



<p class="wp-block-paragraph">Graphs, you could sort of use them as databases,</p>



<p class="wp-block-paragraph">but they&#8217;re not very good as databases because</p>



<p class="wp-block-paragraph">it would be really, really slow to search through the graph</p>



<p class="wp-block-paragraph">to find some piece of data that you&#8217;re looking for.</p>



<p class="wp-block-paragraph">It could be like a linear time database.</p>



<p class="wp-block-paragraph">better would be to take this graph and add a bunch of rules as you probably have found</p>



<p class="wp-block-paragraph">in my other videos by now and turn it into a binary search tree.</p>



<p class="wp-block-paragraph">A binary search tree is lightning fast.</p>



<p class="wp-block-paragraph">It runs in log time.</p>



<p class="wp-block-paragraph">Hash tables are faster than binary search trees, but basically a graph is always going</p>



<p class="wp-block-paragraph">to be way slower than a binary search tree unless the binary search tree is severely</p>



<p class="wp-block-paragraph">imbalanced.</p>



<p class="wp-block-paragraph">But that&#8217;s something for another video.</p>



<p class="wp-block-paragraph">Anyway, so we have a graph and it&#8217;s not a good database.</p>



<p class="wp-block-paragraph">What would a graph be good for?</p>



<p class="wp-block-paragraph">would a graph be good for? Well, graphs are usually pretty good to help you represent</p>



<p class="wp-block-paragraph">relationships between things. For example, the six and the one, imagine the six is something,</p>



<p class="wp-block-paragraph">maybe it&#8217;s a computer, maybe it&#8217;s a city, maybe it&#8217;s, I don&#8217;t know, like a train station,</p>



<p class="wp-block-paragraph">and the edges could represent connections. So I&#8217;m just going to start changing these values</p>



<p class="wp-block-paragraph">have some nodes just kind of hanging out off to the side, not really connected to anything.</p>



<p class="wp-block-paragraph">Maybe not great for your particular use case, but like it&#8217;s a valid graph. So I&#8217;m just going to,</p>



<p class="wp-block-paragraph">I&#8217;m just going to connect this and try to make this into a better graph.</p>



<p class="wp-block-paragraph">That&#8217;s a little bit more interesting. So we&#8217;ve got graphs that do a whole bunch of different</p>



<p class="wp-block-paragraph">things. Let me change these values real fast. I&#8217;ll maybe turn that into a 13 and turn that</p>



<p class="wp-block-paragraph">So imagine that we have like a little connection here, a little connection here, maybe another</p>



<p class="wp-block-paragraph">connection here and another one there.</p>



<p class="wp-block-paragraph">And you know, you are allowed to have connections that sort of look weird, like going from this</p>



<p class="wp-block-paragraph">six all the way around to this 13.</p>



<p class="wp-block-paragraph">That&#8217;s totally valid also.</p>



<p class="wp-block-paragraph">So I&#8217;ve basically just drawn a random graph, random nodes and random edges.</p>



<p class="wp-block-paragraph">Imagine that every single node here is a computer in a computer network and imagine every edge</p>



<p class="wp-block-paragraph">every edge which connects the nodes is just some sort of a connection let&#8217;s say a network cable</p>



<p class="wp-block-paragraph">or a wi-fi signal or something like that so if you imagine it that way then this graph could</p>



<p class="wp-block-paragraph">represent a network topology a bunch of computers connected together if these were cities and this</p>



<p class="wp-block-paragraph">is like actually maybe these are airports in cities you could imagine a graph could represent</p>



<p class="wp-block-paragraph">the relationship between different airports in which planes will fly notice on this graph just</p>



<p class="wp-block-paragraph">that the uh you know the uh the city number one uh there are no flights connecting it directly to</p>



<p class="wp-block-paragraph">city 44 but you could probably imagine well if we take a flight to uh from city one to city 10 and</p>



<p class="wp-block-paragraph">then from city 10 to 44 then we can get from one to 44 we just have to be clever about our connecting</p>



<p class="wp-block-paragraph">flights um let&#8217;s see so we could do like road maps airport maps the worldwide web is basically a graph</p>



<p class="wp-block-paragraph">at least from a certain perspective electrical circuits that are connected to each other</p>



<p class="wp-block-paragraph">are connected to each other even game maps what if your character is allowed to stand here in</p>



<p class="wp-block-paragraph">in space number three on some map and the character is only allowed to travel to space 13 or</p>



<p class="wp-block-paragraph">space 6 but not directly to space 1 well it could be a map that helps you understand where your</p>



<p class="wp-block-paragraph">character can go in a game okay so that&#8217;s like the basic idea of of what a graph is and uh how it</p>



<p class="wp-block-paragraph">actual four types of graphs that I&#8217;m going to go over in more detail in future videos. Let&#8217;s see,</p>



<p class="wp-block-paragraph">what time is it right now? We got like 10 minutes. Okay, so I can still kind of make this fast.</p>



<p class="wp-block-paragraph">So the first type of graph that we&#8217;re looking at right now is actually something called an</p>



<p class="wp-block-paragraph">undirected, unweighted graph. Why is it, let&#8217;s see, let me write this down first. It&#8217;s an undirected,</p>



<p class="wp-block-paragraph">undirected, unweighted graph. So why is this undirected? Because the edges don&#8217;t have direction.</p>



<p class="wp-block-paragraph">If I was standing in, you know, city six and I wanted to like drive or fly or whatever</p>



<p class="wp-block-paragraph">from city six to city three, then I should be able to do it because this edge that connects</p>



<p class="wp-block-paragraph">them doesn&#8217;t really say that I have to go in one direction or the other. I could also go to city</p>



<p class="wp-block-paragraph">three and then just walk right back or fly right back to city six. There&#8217;s no direction. So there&#8217;s</p>



<p class="wp-block-paragraph">no direction. So there&#8217;s an this that&#8217;s that&#8217;s why this is an undirected graph. This is an</p>



<p class="wp-block-paragraph">unweighted graph because we haven&#8217;t specified a cost for traveling along an edge. For example,</p>



<p class="wp-block-paragraph">if you know, if you&#8217;re at city three here, and you want to fly to city 13, how much jet fuel</p>



<p class="wp-block-paragraph">does it cost? How much time does it cost? If three is a computer and 13 is a computer,</p>



<p class="wp-block-paragraph">and the edges like a network cable, like how much money does it cost to transmit the data?</p>



<p class="wp-block-paragraph">transmit the data or what is the lag in milliseconds.</p>



<p class="wp-block-paragraph">You know, you can represent all sorts of things with these edges,</p>



<p class="wp-block-paragraph">but there&#8217;s no value on these edges,</p>



<p class="wp-block-paragraph">which means there are no weights to these edges.</p>



<p class="wp-block-paragraph">So that&#8217;s why this is an undirected and also unweighted graph.</p>



<p class="wp-block-paragraph">Uh, the first upgrade that I want to do is just kind of show you what you can</p>



<p class="wp-block-paragraph">sort of assume about an unweighted graph. This is not always true.</p>



<p class="wp-block-paragraph">It just depends on who you talk to and what your application implementations are.</p>



<p class="wp-block-paragraph">So imagine the node that goes from six, sorry, the edge that goes from six to one.</p>



<p class="wp-block-paragraph">If it&#8217;s an unweighted graph, you could just probably imagine that every weight is just a one.</p>



<p class="wp-block-paragraph">The point being that it always costs the same amount to travel along every edge,</p>



<p class="wp-block-paragraph">because in an unweighted graph, we don&#8217;t differentiate between the different edges</p>



<p class="wp-block-paragraph">in terms of their costs.</p>



<p class="wp-block-paragraph">We could just put a bunch of ones on all these edges.</p>



<p class="wp-block-paragraph">And it would still, you know, basically be considered an unweighted graph.</p>



<p class="wp-block-paragraph">It depends on who you talk to.</p>



<p class="wp-block-paragraph">maybe all the weights are zero, maybe all the weights are 10 or whatever.</p>



<p class="wp-block-paragraph">But, you know, usually I put a one there because I&#8217;d like to imagine the cost could just be the number of hops.</p>



<p class="wp-block-paragraph">So, for example, if I wanted to go from city six to city 10,</p>



<p class="wp-block-paragraph">I could probably, you know, start at city six and then go to city one and then hop to city 10.</p>



<p class="wp-block-paragraph">How many actual hops did I do? I did two.</p>



<p class="wp-block-paragraph">I could also come up with that number by just looking at the sum of all the weights of all the edges.</p>



<p class="wp-block-paragraph">all the edges. So notice how when I go from six to one, that costs me one weight or one hop. And</p>



<p class="wp-block-paragraph">then when I go from one to 10, that&#8217;s another one. So if you put ones on all the edges in an</p>



<p class="wp-block-paragraph">unweighted graph, then you&#8217;re kind of saying the total cost of some path is really just the number</p>



<p class="wp-block-paragraph">of hops. So it&#8217;s up to you. Anyway, that&#8217;s unweighted and undirected. Let&#8217;s upgrade this</p>



<p class="wp-block-paragraph">see we have an undirected and unweighted and i&#8217;m just going to duplicate this real fast and change</p>



<p class="wp-block-paragraph">this to a weighted graph so undirected but also weighted and the thing is as soon as you start</p>



<p class="wp-block-paragraph">putting numbers on a graph on the edges of a graph well then it&#8217;s considered weighted so even even a</p>



<p class="wp-block-paragraph">graph that has all ones on all the edges you could also call that weighted but now you have the</p>



<p class="wp-block-paragraph">freedom since it is considered a weighted graph to just assign different values to all the edges</p>



<p class="wp-block-paragraph">to all the edges. Again, these edges are a class sometimes, or you can think of them that way</p>



<p class="wp-block-paragraph">inside the graph. And the edge weights themselves are definitely considered a T type, a templated</p>



<p class="wp-block-paragraph">type, which means, you know, right now I&#8217;m clearly typing integers, but you could type some other</p>



<p class="wp-block-paragraph">data type. You could type floats. You could type some weird data type, like a string.</p>



<p class="wp-block-paragraph">Whether or not that&#8217;s going to be useful depends on your program, you know, what you&#8217;re trying to</p>



<p class="wp-block-paragraph">you know, what you&#8217;re trying to do with the graph. But let&#8217;s see, I think I&#8217;ve added custom numbers</p>



<p class="wp-block-paragraph">to every single edge. So now this is definitely an undirected, but weighted graph. That&#8217;s the</p>



<p class="wp-block-paragraph">second type of graph that we&#8217;re talking about. Okay, what&#8217;s what&#8217;s cool about a weighted graph?</p>



<p class="wp-block-paragraph">Well, imagine again, that this is an airport map, where we&#8217;re representing relationships between,</p>



<p class="wp-block-paragraph">you know, cities, like where can we fly and stuff. We&#8217;re basically saying at this point,</p>



<p class="wp-block-paragraph">it&#8217;s going to cost you 44 of something.</p>



<p class="wp-block-paragraph">Maybe this is a graph representing jet fuel or time or frequent flyer points or something like that.</p>



<p class="wp-block-paragraph">If you consider your edges to be custom classes,</p>



<p class="wp-block-paragraph">you could even put a whole bunch of different types of values in your graph at the same time</p>



<p class="wp-block-paragraph">to make it a little bit more flexible.</p>



<p class="wp-block-paragraph">But for now, we&#8217;ll just say there&#8217;s one templated type,</p>



<p class="wp-block-paragraph">which means if we go back up to this code real fast, where was that code at?</p>



<p class="wp-block-paragraph">Where was that code at?</p>



<p class="wp-block-paragraph">And we had, you know, our rough idea of, you know, what the, what the graph holds, you</p>



<p class="wp-block-paragraph">know, it holds like vertices and edges.</p>



<p class="wp-block-paragraph">We could upgrade this just a little bit to say that there is a, an edge value type.</p>



<p class="wp-block-paragraph">So I&#8217;m going to say class edge value, edge weight type, something like that.</p>



<p class="wp-block-paragraph">for the edge so that I can save characters. And then here, I&#8217;ll change this to a type for the</p>



<p class="wp-block-paragraph">node. This is why we call it T type. There&#8217;s like, we put the keyword template here in C++.</p>



<p class="wp-block-paragraph">And then sometimes people just use T&#8217;s here for these tokens. So I&#8217;m just going to say</p>



<p class="wp-block-paragraph">the type of data that a node can hold is going to be the T node. And then the type of data that</p>



<p class="wp-block-paragraph">the edge could hold would be the T edge. We&#8217;ll call that data. Or we could call that weight,</p>



<p class="wp-block-paragraph">because usually that data comes into play when you&#8217;re traveling along an edge, right? So there&#8217;s</p>



<p class="wp-block-paragraph">traveling along an edge, right? So there&#8217;s like two different types here. Anyway, so we got an</p>



<p class="wp-block-paragraph">undirected and unweighted graph. If we traveled from city six to city one, that costs us 44. But</p>



<p class="wp-block-paragraph">if you look at the graph a little bit more closely, we could take the longer way around. We could say</p>



<p class="wp-block-paragraph">go from six to three, and then go from three to 13. And then actually, let me change the color</p>



<p class="wp-block-paragraph">to orange so that you can see there&#8217;s different paths, six to three, and then three to 13,</p>



<p class="wp-block-paragraph">and then 13 to one, even though we took more hops,</p>



<p class="wp-block-paragraph">and that might have been considered more expensive</p>



<p class="wp-block-paragraph">in an unweighted graph,</p>



<p class="wp-block-paragraph">you can see that the cost of the first path</p>



<p class="wp-block-paragraph">from six to one, that&#8217;s 44.</p>



<p class="wp-block-paragraph">And the cost of the second path is seven plus three,</p>



<p class="wp-block-paragraph">that&#8217;s 10, and then plus nine, so that&#8217;s 19.</p>



<p class="wp-block-paragraph">So if we take the long way,</p>



<p class="wp-block-paragraph">it actually costs us less</p>



<p class="wp-block-paragraph">of whatever we&#8217;ve determined this unit is.</p>



<p class="wp-block-paragraph">You know, less jet fuel, less time, less whatever.</p>



<p class="wp-block-paragraph">less whatever these graphs in the machine are not necessarily going to be to scale because the</p>



<p class="wp-block-paragraph">machine in your computer your computer doesn&#8217;t really keep track of like the physical positioning</p>



<p class="wp-block-paragraph">of all these nodes and edges it just can keeps track of the relationship between the nodes and</p>



<p class="wp-block-paragraph">the edges and the weights and all that stuff so two different paths that we could take to get</p>



<p class="wp-block-paragraph">from six to one one of the paths is less expensive um or less time costly or just whatever and a graph</p>



<p class="wp-block-paragraph">data structure can kind of help us figure that out if we&#8217;re using an algorithm that understands</p>



<p class="wp-block-paragraph">weights okay so undirected and unweighted let&#8217;s add direction so um i&#8217;m going to erase this stuff</p>



<p class="wp-block-paragraph">right here real quick and in an undirected graph remember you can just kind of go in either</p>



<p class="wp-block-paragraph">direction along any edge but in a directed graph every single edge needs to have a direction so as</p>



<p class="wp-block-paragraph">I change one of the edges to have direction, then I must change all of the edges to have direction</p>



<p class="wp-block-paragraph">as well. So I&#8217;m just saying, okay, as soon as I did that, now this is an invalid graph</p>



<p class="wp-block-paragraph">because some of the edges don&#8217;t have direction. So now I need to fix everything. So I just,</p>



<p class="wp-block-paragraph">I&#8217;m going to arbitrarily and randomly choose a direction for every single edge like this.</p>



<p class="wp-block-paragraph">And then as soon as I&#8217;m done, I&#8217;m going to deal, I guess, with that giant edge</p>



<p class="wp-block-paragraph">that giant edge. So I&#8217;m going to go like that. So let&#8217;s see, all the edges seem to have direction.</p>



<p class="wp-block-paragraph">Now I&#8217;m just going to hand draw an arrow on one side of this giant edge. Okay. So this is directed</p>



<p class="wp-block-paragraph">and also weighted. What can we do with the directed graph? Well, it just basically tells</p>



<p class="wp-block-paragraph">you which direction you&#8217;re allowed to travel in. What if you have an airport where city six can</p>



<p class="wp-block-paragraph">only fly to city one, but city one, for some reason, never flies to city six. You got to take</p>



<p class="wp-block-paragraph">take like the long way you got to go from city one to 13 to three to six that&#8217;s something that</p>



<p class="wp-block-paragraph">a graph could help you represent what if your character in your game can only go in one direction</p>



<p class="wp-block-paragraph">but not the other direction okay no problem i mean that&#8217;s pretty much it you&#8217;re only allowed</p>



<p class="wp-block-paragraph">to travel in the same direction as the edge points but now we have a graph that is a lot less</p>



<p class="wp-block-paragraph">flexible because for example before we used to be able to go from city uh 10 to city 44 and then</p>



<p class="wp-block-paragraph">then come back again later if we wanted in the opposite direction. We can no longer do that</p>



<p class="wp-block-paragraph">because this edge only goes to 10. It doesn&#8217;t even go to 44. We can&#8217;t even ever actually get to 44.</p>



<p class="wp-block-paragraph">How do you sort of solve that? Well, just add another edge in the opposite direction.</p>



<p class="wp-block-paragraph">In graphs, you are allowed to do something called a parallel edge,</p>



<p class="wp-block-paragraph">which just basically means, you know, two edges between the same pair of nodes that just point</p>



<p class="wp-block-paragraph">in the same direction. You&#8217;re also allowed to do, you know, opposite facing edges. So</p>



<p class="wp-block-paragraph">edges so i just added a second edge there going from 10 to 44 and now if i was you know hanging</p>



<p class="wp-block-paragraph">out in city 10 i could just go back and forth between city 10 and 44 as much as i wanted to</p>



<p class="wp-block-paragraph">oh i forgot to add an edge weight for that new edge which means i wrote down an invalid graph</p>



<p class="wp-block-paragraph">so i&#8217;m just going to say two so uh maybe the wind is blowing in in your favor when you&#8217;re going from</p>



<p class="wp-block-paragraph">city 10 to city 44 maybe it&#8217;s blowing against you if you&#8217;re talking about city 44 to city 10 you</p>



<p class="wp-block-paragraph">you know whatever but you just have to have edge uh edge weight on every single edge</p>



<p class="wp-block-paragraph">okay so uh that&#8217;s directed and also weighted um and you can probably imagine previously when we</p>



<p class="wp-block-paragraph">had an undirected um graph when there was just like you know one edge going between uh two nodes</p>



<p class="wp-block-paragraph">and there was no direction on it like you know 44 to 10 if we just had like one edge with no</p>



<p class="wp-block-paragraph">have two edges each going in the opposite direction so we have directed and weighted i think the last</p>



<p class="wp-block-paragraph">thing that we didn&#8217;t do was directed and unweighted right so we have let me just double check real</p>



<p class="wp-block-paragraph">fast here we have undirected and unweighted and then we had undirected and weighted and then</p>



<p class="wp-block-paragraph">directed and weighted okay so now let&#8217;s do um i&#8217;m getting lost already oh my gosh i can&#8217;t believe i</p>



<p class="wp-block-paragraph">I saw undirected and unweighted so we did undirected twice already undirected so we&#8217;re</p>



<p class="wp-block-paragraph">going to do directed and unweighted next okay so the next graph a little bit less useful than</p>



<p class="wp-block-paragraph">what we&#8217;re looking at this this type of graph is a little bit more useful we&#8217;re going to do</p>



<p class="wp-block-paragraph">directed and unweighted oh my god okay directed and unweighted so directed and unweighted you</p>



<p class="wp-block-paragraph">Directed and unweighted, you can imagine, just means we get rid of all these weights.</p>



<p class="wp-block-paragraph">And then we keep the direction on all the edges.</p>



<p class="wp-block-paragraph">So this means we can keep track of where we&#8217;re allowed to go, if we&#8217;re pathfinding or just whatever.</p>



<p class="wp-block-paragraph">But we don&#8217;t really know what it costs to travel between the different graphs.</p>



<p class="wp-block-paragraph">So that&#8217;s directed and unweighted.</p>



<p class="wp-block-paragraph">Let&#8217;s see here.</p>



<p class="wp-block-paragraph">I&#8217;m going to just duplicate this or just make a new blank slide.</p>



<p class="wp-block-paragraph">Okay, undirected, oh gosh, I&#8217;ve got pink letters.</p>



<p class="wp-block-paragraph">Let&#8217;s see, undirected plus unweighted.</p>



<p class="wp-block-paragraph">And we&#8217;ve got undirected plus weighted.</p>



<p class="wp-block-paragraph">And then we&#8217;ve got directed plus unweighted.</p>



<p class="wp-block-paragraph">I don&#8217;t think I&#8217;m writing these down in the same order,</p>



<p class="wp-block-paragraph">but that&#8217;s okay.</p>



<p class="wp-block-paragraph">And then we&#8217;ve got directed plus weighted.</p>



<p class="wp-block-paragraph">So basically, you know, four types of graphs</p>



<p class="wp-block-paragraph">that we can talk about.</p>



<p class="wp-block-paragraph">In future videos, we&#8217;re going to go over graphs</p>



<p class="wp-block-paragraph">in more detail.</p>



<p class="wp-block-paragraph">We&#8217;ll talk about graph terminology,</p>



<p class="wp-block-paragraph">maybe some pathfinding algorithms.</p>



<p class="wp-block-paragraph">And yeah, so this is just a basic intro.</p>



<p class="wp-block-paragraph">How much time do we spend already?</p>



<p class="wp-block-paragraph">Oh God, we spent so much time.</p>



<p class="wp-block-paragraph">Spent like 22 minutes.</p>



<p class="wp-block-paragraph">Dang, man, even the smallest thing takes time.</p>



<p class="wp-block-paragraph">So I&#8217;ll see you in a future video</p>



<p class="wp-block-paragraph">when we talk more and more and more about graphs</p>



<p class="wp-block-paragraph">and other data structures concepts.</p>



<p class="wp-block-paragraph">Thanks for watching this video.</p>



<p class="wp-block-paragraph">I hope you learned a little bit of stuff</p>



<p class="wp-block-paragraph">I hope you learned a little bit of stuff and had a little bit of fun.</p>



<p class="wp-block-paragraph">I&#8217;m out of here.</p>



<p class="wp-block-paragraph">Go.</p>



<p class="wp-block-paragraph">Hey, everybody.</p>



<p class="wp-block-paragraph">Thanks for watching this video again from the bottom of my heart.</p>



<p class="wp-block-paragraph">I really appreciate it.</p>



<p class="wp-block-paragraph">I do hope you did learn something and have some fun.</p>



<p class="wp-block-paragraph">If you could do me a please, a small little favor,</p>



<p class="wp-block-paragraph">could you please subscribe and follow this channel or these videos</p>



<p class="wp-block-paragraph">or whatever it is you do on the current social media website that you&#8217;re looking at right now,</p>



<p class="wp-block-paragraph">it would really mean the world to me.</p>



<p class="wp-block-paragraph">And it&#8217;ll help make more videos and grow this community.</p>



<p class="wp-block-paragraph">So we&#8217;ll be able to do more videos, longer videos, better videos,</p>



<p class="wp-block-paragraph">or just I&#8217;ll be able to keep making videos in general.</p>



<p class="wp-block-paragraph">So please do me a kindness and subscribe.</p>



<p class="wp-block-paragraph">You know, sometimes I&#8217;m sleeping in the middle of the night</p>



<p class="wp-block-paragraph">and I just wake up because I know somebody subscribed or followed.</p>



<p class="wp-block-paragraph">It just wakes me up and I get filled with joy.</p>



<p class="wp-block-paragraph">That&#8217;s exactly what happens every single time.</p>



<p class="wp-block-paragraph">So you could do it as a nice favor to me or you could you control me if you want to just wake me up in the middle</p>



<p class="wp-block-paragraph">And I just subscribe and then I&#8217;ll just wake up. I promise that&#8217;s what will happen</p>



<p class="wp-block-paragraph">Also, if you look at the middle of the screen right now</p>



<p class="wp-block-paragraph">You should see a QR code which you can scan in order to go to the website</p>



<p class="wp-block-paragraph">which I think is also named somewhere at the bottom of this video and</p>



<p class="wp-block-paragraph">It&#8217;ll take you to my main website where you can just kind of like see all the videos</p>



<p class="wp-block-paragraph">I published and the services and tutorials and things that I offer and all that good stuff and</p>



<p class="wp-block-paragraph">and if you have a suggestion for clarifications or errata or just future</p>



<p class="wp-block-paragraph">videos that you want to see please leave a comment or if you just want to say hey</p>



<p class="wp-block-paragraph">what&#8217;s up what&#8217;s going on you know just send me a comment whatever I also wake</p>



<p class="wp-block-paragraph">up for those in the middle of the night I get I wake up in a cold sweat I&#8217;m like</p>



<p class="wp-block-paragraph">it would really it really mean the world to me I would really appreciate it so</p>



<p class="wp-block-paragraph">enjoy the cool music as as I fade into the darkness which is coming for us all.</p>



<p class="wp-block-paragraph">Thank you.</p>



<p class="wp-block-paragraph">I&#8217;m going to go ahead and get started.</p>



<p class="wp-block-paragraph">Thank you.</p>



<p class="wp-block-paragraph">Hello there.</p>



<p class="wp-block-paragraph">Let&#8217;s talk about the four types of…</p>



<p class="wp-block-paragraph">Hello there.</p>
<p>The post <a href="https://www.NeuralLantern.com/4-graph-types-undirected-vs-directed-weighted-vs-unweighted/">4 Graph Types: Undirected vs Directed, Weighted vs Unweighted</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.NeuralLantern.com/4-graph-types-undirected-vs-directed-weighted-vs-unweighted/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
