<?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>index mapping Archives - NeuralLantern.com</title>
	<atom:link href="https://www.NeuralLantern.com/tag/index-mapping/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.NeuralLantern.com/tag/index-mapping/</link>
	<description></description>
	<lastBuildDate>Sun, 13 Sep 2026 19:29:07 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>

<image>
	<url>https://www.NeuralLantern.com/wp-content/uploads/2025/04/cropped-2025-04-04-Lantern-03-32x32.png</url>
	<title>index mapping Archives - NeuralLantern.com</title>
	<link>https://www.NeuralLantern.com/tag/index-mapping/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Directed Weighted Graph Edge List Representation</title>
		<link>https://www.NeuralLantern.com/directed-weighted-graph-edge-list-representation/</link>
					<comments>https://www.NeuralLantern.com/directed-weighted-graph-edge-list-representation/#respond</comments>
		
		<dc:creator><![CDATA[mike]]></dc:creator>
		<pubDate>Sun, 13 Sep 2026 19:29:05 +0000</pubDate>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Data Structures]]></category>
		<category><![CDATA[Graphs]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[adjacency]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[data structures]]></category>
		<category><![CDATA[directed graph]]></category>
		<category><![CDATA[directed weighted graph]]></category>
		<category><![CDATA[edge list]]></category>
		<category><![CDATA[graph representation]]></category>
		<category><![CDATA[graph theory]]></category>
		<category><![CDATA[graph tutorial]]></category>
		<category><![CDATA[index mapping]]></category>
		<category><![CDATA[nodes and edges]]></category>
		<category><![CDATA[vertex list]]></category>
		<category><![CDATA[weighted graph]]></category>
		<guid isPermaLink="false">https://www.NeuralLantern.com/?p=433</guid>

					<description><![CDATA[<p>A directed weighted graph can be stored as a pair of lists: every vertex in one list, and every edge as a three-part tuple of start node, end node, and weight. Replacing the node values with indexes into the vertex list lets you jump to those nodes in constant time after you find an edge.</p>
<p>The post <a href="https://www.NeuralLantern.com/directed-weighted-graph-edge-list-representation/">Directed Weighted Graph Edge List Representation</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="Directed Weighted Graph Edge List Representation" width="1380" height="776" src="https://www.youtube.com/embed/OOyWpB5Pijk?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">Learn how to represent a directed and weighted graph using an edge list.</p>



<p class="wp-block-paragraph">We start from a directed unweighted example, add weights to every edge, then store the graph as a tuple of a vertex list and an edge list. Each edge is a tuple of start node, end node, and weight. Order matters because the graph is directed.</p>



<p class="wp-block-paragraph">Then we convert node values to indexes so you can jump straight to a vertex in constant time instead of scanning the vertex list. That keeps edge scans closer to O(E) instead of O(E + V).</p>



<p class="wp-block-paragraph">This is part of a series covering all four combinations: directed vs undirected and weighted vs unweighted. Watch the earlier videos for basic graph terms and the other representations.</p>



<p class="wp-block-paragraph">Leave a comment if you want a topic covered next.</p>



<p class="wp-block-paragraph">00:00 Intro to directed weighted edge lists<br>01:05 Starting from the directed unweighted graph<br>01:35 Adding a weight to every edge<br>02:48 Graph as a vertex list plus edge list<br>03:35 Writing the vertex list<br>04:18 Node classes versus raw values<br>05:18 Writing directed weighted edges<br>05:45 Order matters on directed edges<br>06:38 Walking remaining outgoing edges<br>09:08 Why value-based edges scan slowly<br>10:29 Replacing node values with indexes<br>12:36 Constant-time jumps after an edge scan<br>14:13 Series wrap-up<br>14:45 Subscribe and outro</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><a href="https://www.NeuralLantern.com/social">https://www.NeuralLantern.com/social</a></li>



<li>Twitter / X: <a href="https://x.com/NeuralLantern">https://x.com/NeuralLantern</a></li>



<li>Rumble: <a href="https://rumble.com/c/c-3696939">https://rumble.com/c/c-3696939</a></li>



<li>BitChute: <a href="https://www.bitchute.com/channel/pg1Pvv5dN4Gt">https://www.bitchute.com/channel/pg1Pvv5dN4Gt</a></li>



<li>Daily Motion: <a href="https://www.dailymotion.com/neurallantern">https://www.dailymotion.com/neurallantern</a></li>



<li>Minds: <a href="https://www.minds.com/neurallantern/">https://www.minds.com/neurallantern/</a></li>



<li>Odysee: <a href="https://odysee.com/@NeuralLantern:5">https://odysee.com/@NeuralLantern:5</a></li>
</ul>



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



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



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



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



<li>Subscribe to the Blog: <a href="https://www.NeuralLantern.com">https://www.NeuralLantern.com</a></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 representing a directed and weighted</p>



<p class="wp-block-paragraph">graph inside your machine using an edge list representation.</p>



<p class="wp-block-paragraph">That&#8217;s a lot of words, a lot of words. Okay, so I hope you watched my previous videos. You didn&#8217;t</p>



<p class="wp-block-paragraph">necessarily need to watch the previous three where we talked about edge list</p>



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



<p class="wp-block-paragraph">where we talked about edgeless representation on the other types of graphs we&#8217;re doing a directed</p>



<p class="wp-block-paragraph">versus uh undirected and weighted versus unweighted and all four combinations of those</p>



<p class="wp-block-paragraph">so uh you don&#8217;t need to watch those others if you&#8217;re just only interested in this but it&#8217;s</p>



<p class="wp-block-paragraph">probably a good idea if you watch my other graph videos because we talk about basic graph</p>



<p class="wp-block-paragraph">terminology and like you know what is a graph and stuff like that but for now we&#8217;re just going to</p>



<p class="wp-block-paragraph">continue um the screenshot you&#8217;re looking at right now was the last part of the last video where we</p>



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



<p class="wp-block-paragraph">the last part of the last video where we did a directed unweighted graph so I&#8217;m</p>



<p class="wp-block-paragraph">gonna duplicate this real fast and I&#8217;m gonna start modifying it so we can</p>



<p class="wp-block-paragraph">basically just move on with our lives so this is gonna be directed and also</p>



<p class="wp-block-paragraph">weighted then I&#8217;m gonna erase a whole bunch of other stuff because it&#8217;s fun to</p>



<p class="wp-block-paragraph">draw again I don&#8217;t know why but it is I like to do my drawings get that and then</p>



<p class="wp-block-paragraph">And I&#8217;m going to get rid of that stuff.</p>



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



<p class="wp-block-paragraph">that stuff okay and i&#8217;ll get rid of this because i&#8217;d like to draw it okay i probably should have</p>



<p class="wp-block-paragraph">gotten rid of it first so i guess the real first thing that i&#8217;m going to do after erasing all that</p>



<p class="wp-block-paragraph">stuff is add weights to all the edges remember this has to be a weighted graph so this particular</p>



<p class="wp-block-paragraph">graph you&#8217;re looking at right now is directed and unweighted so we have to add weights to all of</p>



<p class="wp-block-paragraph">the edges in my previous videos we talked about what is the meaning of weights you know these</p>



<p class="wp-block-paragraph">could be a cost these could be like some property like in a video game</p>



<p class="wp-block-paragraph">property like in a video game uh whatever you want them to mean uh these could even be classes</p>



<p class="wp-block-paragraph">with like complicated values um but for now i&#8217;m going to say i don&#8217;t know maybe this is an airport</p>



<p class="wp-block-paragraph">map and the weights are how much gas it takes to fly from one city to another maybe a node is a</p>



<p class="wp-block-paragraph">city number six and city number 12 you want to fly between them it&#8217;s like five million jillion</p>



<p class="wp-block-paragraph">gallons of gas so let me just take a look real fast and make sure that i&#8217;m not forgetting</p>



<p class="wp-block-paragraph">I mean, any edge.</p>



<p class="wp-block-paragraph">getting any edge every single edge should have a weight i think there were nine edges here one two</p>



<p class="wp-block-paragraph">three four five six seven eight nine so i should see nine weights one two three four five six seven</p>



<p class="wp-block-paragraph">eight nine okay we&#8217;re now ready to start representing this and what&#8217;s going on with</p>



<p class="wp-block-paragraph">this computer okay the first thing uh that we talk about in all of these you know recent related</p>



<p class="wp-block-paragraph">videos is that in an edge list representation we&#8217;ll say</p>



<p class="wp-block-paragraph">edge list representation, we&#8217;ll say that our graph is a tuple, meaning just like a collection of some</p>



<p class="wp-block-paragraph">things. A tuple where the first item in the tuple is a vertex list or a node list, and the second</p>



<p class="wp-block-paragraph">item is an edge list. Again, in previous videos, we talked about representing paths using nodes or</p>



<p class="wp-block-paragraph">using edges. So the edge list path is going to come back to haunt us where we do our edge list</p>



<p class="wp-block-paragraph">graph representation, which is different than an edge list path.</p>



<p class="wp-block-paragraph">path. So how do we do our vertex list? That&#8217;s going to be pretty easy for this diagram.</p>



<p class="wp-block-paragraph">I&#8217;m going to say that V is equal to, oh, it&#8217;s pink. Let me change the color to be more serious.</p>



<p class="wp-block-paragraph">Okay. The vertex list is going to be a collection of just all the nodes, just naming all the nodes</p>



<p class="wp-block-paragraph">or having all the nodes. I&#8217;m going to say it&#8217;s a vertex list or a node list, but really you</p>



<p class="wp-block-paragraph">probably want this to be a vector I&#8217;ve been saying that recently because it&#8217;s faster to</p>



<p class="wp-block-paragraph">because it&#8217;s faster to jump to a particular index in a vector</p>



<p class="wp-block-paragraph">than it is in an actual linked list or some other list-like data structure.</p>



<p class="wp-block-paragraph">So we&#8217;ve got a vertex list.</p>



<p class="wp-block-paragraph">I&#8217;m just going to name all the nodes.</p>



<p class="wp-block-paragraph">So for me particularly, I like to go from left to right.</p>



<p class="wp-block-paragraph">You can sort them, you can do whatever you want.</p>



<p class="wp-block-paragraph">They just need to all be in there.</p>



<p class="wp-block-paragraph">So I&#8217;m just going to say every node that we see in the graph</p>



<p class="wp-block-paragraph">is going to end up in this vertex list.</p>



<p class="wp-block-paragraph">So we&#8217;ve got 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6.</p>



<p class="wp-block-paragraph">So we&#8217;ve got all the nodes in there.</p>



<p class="wp-block-paragraph">another point that I&#8217;ve been making in the in these recent videos is that in real life in your</p>



<p class="wp-block-paragraph">code in your in your computer you don&#8217;t really want to just have this value three here you don&#8217;t</p>



<p class="wp-block-paragraph">want to have this 12 value here that the 12 value that&#8217;s just the value that the node holds I mean</p>



<p class="wp-block-paragraph">if you want everything to be really fast maybe you know keep it bare bones but for me I like to</p>



<p class="wp-block-paragraph">have a full node class a full vertex class and make an instance of it so I can add a whole bunch</p>



<p class="wp-block-paragraph">of custom properties and function</p>



<p class="wp-block-paragraph">bunch of custom properties and functionality and other stuff onto my node so that that means i</p>



<p class="wp-block-paragraph">couldn&#8217;t really put an integer there i would have to put a full node so keep in mind for yourself</p>



<p class="wp-block-paragraph">you probably want to try it both ways but um you probably want to want an instance of a node class</p>



<p class="wp-block-paragraph">and maybe stick the instance right there in the vector or maybe make a smart pointer and so like</p>



<p class="wp-block-paragraph">you allocate you know a new pointer of an instance of the class or it&#8217;s a raw pointer it&#8217;s a smart</p>



<p class="wp-block-paragraph">point or whatever so just keep in mind this diagram is</p>



<p class="wp-block-paragraph">So just keep in mind, this diagram is more simple than your code, but we&#8217;re just diagramming</p>



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



<p class="wp-block-paragraph">Anyway, so we put all the nodes in there.</p>



<p class="wp-block-paragraph">The next thing I need to do is represent the edges.</p>



<p class="wp-block-paragraph">So I&#8217;m going to put E is equal to another list.</p>



<p class="wp-block-paragraph">And this probably does need to be a linked list or a list like data structure and not</p>



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



<p class="wp-block-paragraph">There&#8217;s not much point in jumping to an index.</p>



<p class="wp-block-paragraph">I don&#8217;t know.</p>



<p class="wp-block-paragraph">You could probably come up with one.</p>



<p class="wp-block-paragraph">But anyway, so the edge list is going to be a list of tuples that describe one edge at</p>



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



<p class="wp-block-paragraph">at a time so every little parenthesis that i put here that&#8217;s going to represent one edge so again</p>



<p class="wp-block-paragraph">for me i like to go from left to right i&#8217;m going to start on the left node and i&#8217;m going to say</p>



<p class="wp-block-paragraph">that the start node is three and remember this is a directed graph which means the order if you</p>



<p class="wp-block-paragraph">looked at my previous videos the hang on the order of the nodes actually matters a lot like i can put</p>



<p class="wp-block-paragraph">3 and 13 but i cannot put 13 comma 3 because the first item in the tuple is supposed to be the</p>



<p class="wp-block-paragraph">The first item in the tuple is supposed to be the starting node.</p>



<p class="wp-block-paragraph">And if you see, I only have like an edge going from 3 to 13.</p>



<p class="wp-block-paragraph">I don&#8217;t have one going from 13 to 3.</p>



<p class="wp-block-paragraph">So 13 comma 3 would be invalid.</p>



<p class="wp-block-paragraph">It would be totally bad.</p>



<p class="wp-block-paragraph">So I&#8217;m going to say the 3 goes out to the 13.</p>



<p class="wp-block-paragraph">So the 3 comes first and the 13 is second.</p>



<p class="wp-block-paragraph">And then I have to describe how much it costs.</p>



<p class="wp-block-paragraph">So that&#8217;s the third item in that one particular tuple.</p>



<p class="wp-block-paragraph">It&#8217;s going to be a 1 because the cost of that one particular edge is 1.</p>



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



<p class="wp-block-paragraph">one millisecond delay one time whatever so then the next item is going to be where else does the</p>



<p class="wp-block-paragraph">three go to the three doesn&#8217;t go anywhere else so we&#8217;re done representing the three at least as a</p>



<p class="wp-block-paragraph">start node so next up uh i&#8217;m going to look at the 13 where does the 13 go to it goes to the six it</p>



<p class="wp-block-paragraph">doesn&#8217;t go to the three the three goes to 13 but this the 13 doesn&#8217;t go to the three so 13 goes to</p>



<p class="wp-block-paragraph">six and it costs six because that&#8217;s the cost of the edge there&#8217;s two sixes here</p>



<p class="wp-block-paragraph">the edge. There&#8217;s two 6s here, a little confusing, but that&#8217;s because one is a node and one is a</p>



<p class="wp-block-paragraph">weight. The 13 does not go out anywhere else, so we&#8217;re done with the 13. I like to make, you know,</p>



<p class="wp-block-paragraph">different rows for every single start node. You don&#8217;t have to do that. Next up, I&#8217;m going to look</p>



<p class="wp-block-paragraph">at the 6. The 6 does not go out to the 13. The 6 does not go out to the 18. There is a connection</p>



<p class="wp-block-paragraph">there, but it&#8217;s going in the other direction. The 6 goes to the 12 and also to the 15. So the 6 goes</p>



<p class="wp-block-paragraph">to the 12, and that cost us $5,000.</p>



<p class="wp-block-paragraph">to the 12 and that cost us five because that was the weight we assigned and the six also goes to</p>



<p class="wp-block-paragraph">the 15 with a cost of i think i just wrote seven in a weird way um so we go from six to fifteen it</p>



<p class="wp-block-paragraph">costs us seven and then we&#8217;re done looking at the outgoing edges of these six let me just double</p>



<p class="wp-block-paragraph">check out out yes now we&#8217;re ready to move on to the uh the 12 node the 12 node has one outgoing</p>



<p class="wp-block-paragraph">connection it goes out to the three did i get that wrong in the last video leave a comment</p>



<p class="wp-block-paragraph">Did I get that wrong in the last video?</p>



<p class="wp-block-paragraph">Leave a comment.</p>



<p class="wp-block-paragraph">I don&#8217;t know.</p>



<p class="wp-block-paragraph">And then we&#8217;re done with the 12 node.</p>



<p class="wp-block-paragraph">Now we look at the 15 node.</p>



<p class="wp-block-paragraph">Oh, that&#8217;s why I had that feeling,</p>



<p class="wp-block-paragraph">because the 15 didn&#8217;t go anywhere.</p>



<p class="wp-block-paragraph">15 has incoming connections, but no outgoing connections,</p>



<p class="wp-block-paragraph">so we actually can&#8217;t write it down here.</p>



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



<p class="wp-block-paragraph">Then we look at the 18 node.</p>



<p class="wp-block-paragraph">The 18 has outgoing connections to four other nodes.</p>



<p class="wp-block-paragraph">To the three, with a cost of three.</p>



<p class="wp-block-paragraph">Am I mind-tripping myself when I&#8217;m doing these duplicates?</p>



<p class="wp-block-paragraph">18 also goes out to the 6 with the cost of 8.</p>



<p class="wp-block-paragraph">Didn&#8217;t trick myself that time.</p>



<p class="wp-block-paragraph">The 18 also goes out to the 12 with the cost of 2.</p>



<p class="wp-block-paragraph">And then the 18 also goes out to 15 with the cost of 9.</p>



<p class="wp-block-paragraph">I just realized recently it&#8217;s a good idea to make faces at the camera for emotional thumbnails.</p>



<p class="wp-block-paragraph">I don&#8217;t know if you&#8217;ve picked up on that yet, but yeah.</p>



<p class="wp-block-paragraph">if you&#8217;ve picked up on that yet but yeah so let me just double check that i&#8217;ve got like nine edges</p>



<p class="wp-block-paragraph">and nine entries one two three four five six seven eight nine so i think i probably did it all right</p>



<p class="wp-block-paragraph">now there&#8217;s a problem um i&#8217;ve been talking about this in in the recent videos there&#8217;s a problem</p>



<p class="wp-block-paragraph">with this type of representation what if you are scanning through the edge list and you&#8217;re like</p>



<p class="wp-block-paragraph">well i&#8217;m scanning this edge and that edge and that edge and that edge and that edge and then i come</p>



<p class="wp-block-paragraph">to the 18-6 edge</p>



<p class="wp-block-paragraph">and I think, well now I found</p>



<p class="wp-block-paragraph">and i think well now i found some edge that was interesting for whatever reason</p>



<p class="wp-block-paragraph">maybe if i was scanning or doing some kind of like a operation that might have costed linear time so</p>



<p class="wp-block-paragraph">you don&#8217;t have to know about this uh this is in other videos but basically it&#8217;s not incredibly</p>



<p class="wp-block-paragraph">scalable it&#8217;s not incredibly fast it is technically scalable just not incredible</p>



<p class="wp-block-paragraph">linear time based on the number of edges so that kind of sucks because if i wanted to do something</p>



<p class="wp-block-paragraph">with those nodes with the 18 and</p>



<p class="wp-block-paragraph">with those nodes with the 18 and the six node i would then have to do another linear scan</p>



<p class="wp-block-paragraph">to find each node i&#8217;d have to go into my vertex list and i&#8217;d have to say well where the heck are</p>



<p class="wp-block-paragraph">those things where&#8217;s 18 nope nope nope nope nope uh found the 18 and then there&#8217;s another scan</p>



<p class="wp-block-paragraph">to find the six so really this is going to end up being um linear time based on the number of edges</p>



<p class="wp-block-paragraph">and also the number of vertices so that&#8217;s a little bit slower not</p>



<p class="wp-block-paragraph">a little bit slower not too great the upgrade that we&#8217;re going to do which we&#8217;ve been doing</p>



<p class="wp-block-paragraph">in all the other videos of of these recent edge list representations is i&#8217;m going to</p>



<p class="wp-block-paragraph">first i&#8217;m going to duplicate the vertex list like this</p>



<p class="wp-block-paragraph">and then i&#8217;m going to show you that each node each vertex has an index so i&#8217;m going to say</p>



<p class="wp-block-paragraph">one this is index two it&#8217;s index three when i type too hard i think my hand shakes the table</p>



<p class="wp-block-paragraph">that kind of sucks i need shock absorbers for my galumpiness oh so we have uh an index for every</p>



<p class="wp-block-paragraph">single vertex what if we uh what if we copy pasted the edge list over here on the left</p>



<p class="wp-block-paragraph">um what&#8217;s going on it&#8217;s not oh there it is dumb okay what if we copy pasted it and then we</p>



<p class="wp-block-paragraph">converted all of the values.</p>



<p class="wp-block-paragraph">at all of the values uh or um i guess you maybe on the left side if you if you&#8217;re doing this in</p>



<p class="wp-block-paragraph">the code you might put pointers instead of values so we&#8217;ll just say that we&#8217;ll convert the pointers</p>



<p class="wp-block-paragraph">or these values into indexes so this first tuple we&#8217;re describing the edge that goes between 3 and</p>



<p class="wp-block-paragraph">13 with the cost of 1 3 is sitting at index 0 in the vertex list so i&#8217;m going to change it to a 0</p>



<p class="wp-block-paragraph">13 is sitting at index 1 I&#8217;m going to leave the weight alone and</p>



<p class="wp-block-paragraph">I&#8217;m going to leave the weight alone, and then I&#8217;m just going to convert every other tuple</p>



<p class="wp-block-paragraph">to indexes. So the 13 node, that&#8217;s sitting at index 1. The 6 node is sitting at index 2,</p>



<p class="wp-block-paragraph">leave the weight alone. The 6 node is at index 2, the 12 node is at index 3.</p>



<p class="wp-block-paragraph">The 6 node again is at index 2. The 15 node is at index 4, again leave the weights alone.</p>



<p class="wp-block-paragraph">The 12 node is sitting at index 3, the 3 node is sitting at index 0, leave the weight alone.</p>



<p class="wp-block-paragraph">The 18 node is sitting at index 5.</p>



<p class="wp-block-paragraph">The 3 node is sitting at index 0.</p>



<p class="wp-block-paragraph">I think I&#8217;m going too fast.</p>



<p class="wp-block-paragraph">I&#8217;m probably going to screw something up.</p>



<p class="wp-block-paragraph">We&#8217;ve got index 5 there for the 18, and then 6 is index 2.</p>



<p class="wp-block-paragraph">18 is index 5.</p>



<p class="wp-block-paragraph">12 is index 3.</p>



<p class="wp-block-paragraph">18 is index 5.</p>



<p class="wp-block-paragraph">15 is index 4.</p>



<p class="wp-block-paragraph">So all I did was just convert every node value or pointer, if it&#8217;s in your code, to an index that references the vertex list.</p>



<p class="wp-block-paragraph">the vertex list why would I want to do this okay so like last time we said we</p>



<p class="wp-block-paragraph">would do O of E it would be linear time based on the number of edges if we&#8217;re</p>



<p class="wp-block-paragraph">performing some sort of a search or examination of all the edges so we have</p>



<p class="wp-block-paragraph">to like scan all the edges and then eventually we come to something we&#8217;re</p>



<p class="wp-block-paragraph">interested in maybe we realize oh that&#8217;s that&#8217;s a special edge we want to see</p>



<p class="wp-block-paragraph">what&#8217;s going on there maybe we want to grab those nodes and extract more</p>



<p class="wp-block-paragraph">information from them or modify them or do something to them this representation</p>



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



<p class="wp-block-paragraph">this representation tells us exactly where to go,</p>



<p class="wp-block-paragraph">because this 5 is an index, it&#8217;s not a node value.</p>



<p class="wp-block-paragraph">Same thing for the 2.</p>



<p class="wp-block-paragraph">So index 5 gives us the 18,</p>



<p class="wp-block-paragraph">and index 2 gives us the 6.</p>



<p class="wp-block-paragraph">Notice how we still actually were looking for the 18 and 6 nodes,</p>



<p class="wp-block-paragraph">like we were in the previous, I guess, representation.</p>



<p class="wp-block-paragraph">So now, instead of scanning the vertex list,</p>



<p class="wp-block-paragraph">we can just jump directly to an index,</p>



<p class="wp-block-paragraph">jump directly to an index and you know remember like if you&#8217;re using an array or a vector it&#8217;s</p>



<p class="wp-block-paragraph">going to be constant time to jump to an index it&#8217;s like very very fast it&#8217;s the holy grail</p>



<p class="wp-block-paragraph">of time complexities so it&#8217;s really going to be something like o of e plus c or one or whatever</p>



<p class="wp-block-paragraph">you want to call it but it&#8217;s going to reduce to just o of e so it&#8217;s going to be a little bit</p>



<p class="wp-block-paragraph">faster notice how you know this one is going to take more time than that one maybe i&#8217;ll put it in</p>



<p class="wp-block-paragraph">red to make the</p>



<p class="wp-block-paragraph">it in red to make the the more than the greater than operator feel feel bad and evil but anyway</p>



<p class="wp-block-paragraph">this is how you do edgeless representation if you&#8217;re interested in the in all four uh types</p>



<p class="wp-block-paragraph">of graphs being represented with an edgeless representation check out all my other videos</p>



<p class="wp-block-paragraph">please leave a comment with ideas for stuff you want me to go over but i think i&#8217;m finished with</p>



<p class="wp-block-paragraph">this video it&#8217;s been 15 minutes already i don&#8217;t remember what i forgot to say but i guess we&#8217;re</p>



<p class="wp-block-paragraph">done now thank you so much for watching</p>



<p class="wp-block-paragraph">we&#8217;re done now thank you so much for watching i hope you learned a little bit of stuff and had a</p>



<p class="wp-block-paragraph">little bit of fun i&#8217;ll see you in the next video i&#8217;m gonna get my gear i&#8217;m just kidding i&#8217;m gonna</p>



<p class="wp-block-paragraph">eat a bunch of cookies i&#8217;m just kidding i shouldn&#8217;t do that but i probably will</p>



<p class="wp-block-paragraph">hey everybody thanks for watching this video again from the bottom of my heart i really</p>



<p class="wp-block-paragraph">appreciate it i do hope you did learn something and have some fun uh if you could do me a please</p>



<p class="wp-block-paragraph">a small little favor could you please subscribe and follow</p>



<p class="wp-block-paragraph">subscribe and follow this channel or these videos or whatever it is you do on</p>



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



<p class="wp-block-paragraph">really mean the world to me and it&#8217;ll help make more videos and grow this</p>



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



<p class="wp-block-paragraph">just I&#8217;ll be able to keep making videos in general so please do do me a kindness</p>



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



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



<p class="wp-block-paragraph">up and I could feel</p>



<p class="wp-block-paragraph">followed it just wakes me up and i get filled with joy 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 could troll me if you want to just wake</p>



<p class="wp-block-paragraph">me up in the middle of the night just subscribe and then i&#8217;ll i&#8217;ll just wake up i promise that&#8217;s</p>



<p class="wp-block-paragraph">what will happen also uh if you look at the middle of the screen right now you should see a qr code</p>



<p class="wp-block-paragraph">which you can scan in order to go to the website which i think is also named somewhere at the</p>



<p class="wp-block-paragraph">bottom of this video and it&#8217;ll take you to my main website where you can just kind of like see</p>



<p class="wp-block-paragraph">all the videos I published, and the services, and</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">If you have a suggestion for</p>



<p class="wp-block-paragraph">Clarifications or errata or just future 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</p>



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



<p class="wp-block-paragraph">It would really it really mean the world to me. I would really appreciate it. So again, thank you</p>



<p class="wp-block-paragraph">it. So again, thank you so much for watching this video and, um, enjoy the cool music as,</p>



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



<p class="wp-block-paragraph">ご視聴ありがとうございました</p>



<p class="wp-block-paragraph">Teksting av Nicolai Winther</p>



<p class="wp-block-paragraph">Hey there!</p>
<p>The post <a href="https://www.NeuralLantern.com/directed-weighted-graph-edge-list-representation/">Directed Weighted Graph Edge List Representation</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.NeuralLantern.com/directed-weighted-graph-edge-list-representation/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
