<?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>undirected unweighted Archives - NeuralLantern.com</title>
	<atom:link href="https://www.NeuralLantern.com/tag/undirected-unweighted/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.NeuralLantern.com/tag/undirected-unweighted/</link>
	<description></description>
	<lastBuildDate>Sat, 15 Aug 2026 13:59:03 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>

<image>
	<url>https://www.NeuralLantern.com/wp-content/uploads/2025/04/cropped-2025-04-04-Lantern-03-32x32.png</url>
	<title>undirected unweighted Archives - NeuralLantern.com</title>
	<link>https://www.NeuralLantern.com/tag/undirected-unweighted/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to Represent an Unweighted Undirected Graph with an Edge List</title>
		<link>https://www.NeuralLantern.com/how-to-represent-an-unweighted-undirected-graph-with-an-edge-list/</link>
					<comments>https://www.NeuralLantern.com/how-to-represent-an-unweighted-undirected-graph-with-an-edge-list/#respond</comments>
		
		<dc:creator><![CDATA[mike]]></dc:creator>
		<pubDate>Sat, 15 Aug 2026 13:59:02 +0000</pubDate>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Data Structures]]></category>
		<category><![CDATA[Graphs]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[adjacency alternative]]></category>
		<category><![CDATA[coding graphs]]></category>
		<category><![CDATA[constant time lookup]]></category>
		<category><![CDATA[edge list]]></category>
		<category><![CDATA[edge tuples]]></category>
		<category><![CDATA[graph algorithms]]></category>
		<category><![CDATA[graph data structure]]></category>
		<category><![CDATA[graph representation]]></category>
		<category><![CDATA[graph theory basics]]></category>
		<category><![CDATA[index based edges]]></category>
		<category><![CDATA[node list]]></category>
		<category><![CDATA[undirected graph]]></category>
		<category><![CDATA[undirected unweighted]]></category>
		<category><![CDATA[unweighted graph]]></category>
		<category><![CDATA[vertex list]]></category>
		<guid isPermaLink="false">https://www.NeuralLantern.com/?p=424</guid>

					<description><![CDATA[<p>Represent an unweighted undirected graph as a tuple of a vertex list and an edge list. Store nodes as indexable objects and list each edge once as a pair of indexes so you can reach any vertex in constant time.</p>
<p>The post <a href="https://www.NeuralLantern.com/how-to-represent-an-unweighted-undirected-graph-with-an-edge-list/">How to Represent an Unweighted Undirected Graph with an Edge List</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="How to Represent an Unweighted Undirected Graph with an Edge List" width="1380" height="776" src="https://www.youtube.com/embed/eIBfYgU1QIk?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 an unweighted undirected graph using an edge list. We build a sample graph with nodes and edges, then show the vertex list and edge list as tuples. See why storing indexes instead of node values makes lookups faster in constant time. Follow along as we list every connection without duplicates. This is the first in a series covering all four combinations of weighted and directed graphs with edge lists.</p>



<p class="wp-block-paragraph">00:00 Introduction to Edge List Representation<br>00:56 Drawing a Sample Graph with Nodes<br>02:05 Adding Undirected Unweighted Edges<br>03:10 Graph as a Tuple of Vertex and Edge Lists<br>03:40 Building the Vertex List<br>04:24 Storing Nodes as Objects with Indexes<br>06:13 Creating the Edge List of Tuples<br>07:00 Listing Edges by Node Values<br>11:36 Limitations of Storing Node Values<br>12:30 Switching to Index-Based Edge List<br>14:08 Constant-Time Lookups with Indexes<br>16:54 Summary of the Edge List Method<br>17:16 Preview of Next Videos in the Series<br>17:44 Closing Remarks and Subscribe Request</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 representing an unweighted,</p>



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



<p class="wp-block-paragraph">Okay, so hopefully you watched my previous videos. If you haven&#8217;t, you might want to take a step back</p>



<p class="wp-block-paragraph">and check them out. We talked about, you know, what is a graph? What are some basic rules and</p>



<p class="wp-block-paragraph">terminology of a graph? Not graph and paper, but a graph. And we talked about representing paths</p>



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



<p class="wp-block-paragraph">representing paths in graphs using either a list of nodes or a list of edges and we&#8217;re going to</p>



<p class="wp-block-paragraph">take the edge list concept one step further and we&#8217;re going to actually just say this whole graph</p>



<p class="wp-block-paragraph">is being represented as an edge list it&#8217;ll make sense in a little bit but uh so the first thing</p>



<p class="wp-block-paragraph">i&#8217;m going to do is try to set up my stuff which is always set up wrong because i&#8217;m the one setting it</p>



<p class="wp-block-paragraph">up and it always gets messed up okay so i got a graph paper and uh oh i got to make this other</p>



<p class="wp-block-paragraph">thing full screen. Sorry.</p>



<p class="wp-block-paragraph">um i&#8217;m going to draw a random graph just real fast so i&#8217;m going to do i don&#8217;t know just some random</p>



<p class="wp-block-paragraph">nodes so remember a graph is a collection of nodes and edges doesn&#8217;t even have to have edges but you</p>



<p class="wp-block-paragraph">know we&#8217;ll just say so we&#8217;re going to do that&#8217;s bad let me try one more time we&#8217;ll get that okay</p>



<p class="wp-block-paragraph">so we get i&#8217;m trying to get this circle perfect because i&#8217;m gonna have to duplicate it rare okay</p>



<p class="wp-block-paragraph">i&#8217;ve got a node here and i&#8217;m just going to give it an arbitrary value i&#8217;m going to say it&#8217;s got a 3</p>



<p class="wp-block-paragraph">and then i&#8217;m going to duplicate it a few times just to make a graph that is a little bit</p>



<p class="wp-block-paragraph">interesting so we have something uh something to kind of challenge us i guess so it&#8217;s not</p>



<p class="wp-block-paragraph">incredibly boring um and then i&#8217;m going to change some of the values here and then well i&#8217;ll change</p>



<p class="wp-block-paragraph">the next ones and then we&#8217;ll start looking at edges which edges do we want to make okay so</p>



<p class="wp-block-paragraph">right now we&#8217;re just making a graph make this graph along with me if you want to or uh you</p>



<p class="wp-block-paragraph">you know, after you.</p>



<p class="wp-block-paragraph">to or uh you know after you think you understand do another graph on your own</p>



<p class="wp-block-paragraph">okay so i&#8217;m gonna make some edges right now remember this is going to be an undirected</p>



<p class="wp-block-paragraph">unweighted graph so the edges are just going to be lines they&#8217;re not going to have direction on</p>



<p class="wp-block-paragraph">them and they&#8217;re not going to have weights on them i&#8217;m going to do a line over here i&#8217;m just</p>



<p class="wp-block-paragraph">randomly doing lines doesn&#8217;t really matter um what we do exactly the point is going to be let&#8217;s</p>



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



<p class="wp-block-paragraph">be let&#8217;s practice representing this graph okay so i&#8217;m just making a random graph it&#8217;s kind of like</p>



<p class="wp-block-paragraph">a little bit dense i don&#8217;t know um maybe i&#8217;ll just stop there and then i&#8217;ll add a wonky line just</p>



<p class="wp-block-paragraph">just to prove we can be cool about this i don&#8217;t know we&#8217;ll do another one right here so it&#8217;s a</p>



<p class="wp-block-paragraph">slightly more interesting graph okay so um that&#8217;s just a graph and uh what i&#8217;m going to do is i&#8217;m</p>



<p class="wp-block-paragraph">going to say this is a, you know, an unweighted, oops, weighted.</p>



<p class="wp-block-paragraph">oops waited undirected uh graph and we&#8217;re going to use the edge list of representation</p>



<p class="wp-block-paragraph">i have spell check on this i really hope i do nope okay i guess i forgot to fix that months ago</p>



<p class="wp-block-paragraph">all right so then the next thing we&#8217;re going to do is uh we&#8217;re going to look at the idea of like</p>



<p class="wp-block-paragraph">how do we start with the edge list representation okay um the first thing i&#8217;m going to say is that</p>



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



<p class="wp-block-paragraph">that the our graph in an edge list representation is a tuple just meaning it&#8217;s you know some things</p>



<p class="wp-block-paragraph">put together if you know tuples encoding already uh the tuple is going to consist of a collection</p>



<p class="wp-block-paragraph">of vertices and edges what&#8217;s going to be an edge list don&#8217;t make fun of my ease please</p>



<p class="wp-block-paragraph">anyway so uh let&#8217;s do the first thing is going to be the vertex list so how do we represent the</p>



<p class="wp-block-paragraph">vertex list or the node list well i&#8217;m just going to say that my vertex list v</p>



<p class="wp-block-paragraph">to say that my vertex list v is equal to something and we&#8217;ll just put inside of this</p>



<p class="wp-block-paragraph">some vertices so the easiest way when you&#8217;re kind of drawing this right now is i&#8217;m just going to</p>



<p class="wp-block-paragraph">start putting the values of the node i&#8217;m going to say well here&#8217;s a three and uh i guess i could</p>



<p class="wp-block-paragraph">sort them for whatever reason uh if we&#8217;re going to do binary search on them later but we&#8217;re not</p>



<p class="wp-block-paragraph">going to i&#8217;m just going to maybe you know what i&#8217;ll go from left to right so that&#8217;ll make more</p>



<p class="wp-block-paragraph">sense, just visually. So I&#8217;ll go from left to right. 3, 13, 6, 12.</p>



<p class="wp-block-paragraph">3, 13, 6, 12, and a 15, and an 18.</p>



<p class="wp-block-paragraph">You can see all of those are nodes, right?</p>



<p class="wp-block-paragraph">Somebody stop me if I forgot a node.</p>



<p class="wp-block-paragraph">Okay, here&#8217;s the thing though.</p>



<p class="wp-block-paragraph">What are we actually storing in this vertex list?</p>



<p class="wp-block-paragraph">You probably don&#8217;t want to store the node values.</p>



<p class="wp-block-paragraph">I mean, you could be a little slow and dumb though,</p>



<p class="wp-block-paragraph">but we want the option to be a little bit faster later</p>



<p class="wp-block-paragraph">and also the option to turn these vertices into full classes,</p>



<p class="wp-block-paragraph">like give them extra properties and whatever.</p>



<p class="wp-block-paragraph">So what I&#8217;m going to say is that…</p>



<p class="wp-block-paragraph">So what I&#8217;m going to say is that I&#8217;m writing down the number 3 and the number 13 here for you, but you should imagine in your code you would have an object of type vertex or node, like a full class, and you would basically be stuffing pointers inside of that vector, inside of that list.</p>



<p class="wp-block-paragraph">I keep saying list. It is called an edge list representation, but you can probably imagine</p>



<p class="wp-block-paragraph">that this could just as easily be a vector. If you&#8217;ve seen my other videos, you know what that is.</p>



<p class="wp-block-paragraph">but uh so i want to be able to index this uh faster so for me personally i make this a vector</p>



<p class="wp-block-paragraph">and not an actual list but we&#8217;re going to call it a list anyway so three should be a pointer</p>



<p class="wp-block-paragraph">uh to a full node object uh smart pointer raw pointer whatever you want 13 should be a full</p>



<p class="wp-block-paragraph">pointer to an entire uh entirely different node object with just 13 assigned as its uh template</p>



<p class="wp-block-paragraph">type value because we&#8217;re making this a vector we can actually index</p>



<p class="wp-block-paragraph">can actually index uh the nodes right so like this is like index 0 for the 3 node index 1 for the 13</p>



<p class="wp-block-paragraph">node so i&#8217;m just going to put the indexes here whoops just to drive the point home a little</p>



<p class="wp-block-paragraph">bit further so if i told you hey let&#8217;s do uh the node at index 2 you would know that is the node</p>



<p class="wp-block-paragraph">that is in the very middle with the value of 6 because index 0 and 1 and 2 brings you to this</p>



<p class="wp-block-paragraph">node right here um which is a 6 so this is going to this is going to help us later let me save this</p>



<p class="wp-block-paragraph">Real fast, by the way.</p>



<p class="wp-block-paragraph">let me save this real fast by the way i&#8217;m just going to do that okay so uh the next thing that</p>



<p class="wp-block-paragraph">we need to do is uh make an edge list the edge list is really where it&#8217;s all at that&#8217;s really</p>



<p class="wp-block-paragraph">where all the data is it&#8217;s going to tell us exactly where everything is or it&#8217;s going to</p>



<p class="wp-block-paragraph">describe the whole graph pretty much so the edge list is another we&#8217;ll say that&#8217;s a list this could</p>



<p class="wp-block-paragraph">be like a linked list or vector or whatever you want i&#8217;m just going to say it&#8217;s a linked list</p>



<p class="wp-block-paragraph">and every item in the list is going to be another tuple so remember above the graph itself was a</p>



<p class="wp-block-paragraph">tuple containing a vertex list and an edge list so the edge list is a list of tuples</p>



<p class="wp-block-paragraph">meaning you know items bundled together for one tuple and then just like a list of those</p>



<p class="wp-block-paragraph">so what i&#8217;m going to try to do is describe every single edge uh one by one using one tuple each</p>



<p class="wp-block-paragraph">inside of the edge list so the first thing i&#8217;m going to do just you know to make this a little</p>



<p class="wp-block-paragraph">little bit easier.</p>



<p class="wp-block-paragraph">thing I want to do just you know to make this a little bit easier is I&#8217;m going to ignore the</p>



<p class="wp-block-paragraph">indexes for the vertex list and I&#8217;m going to say let&#8217;s describe everything happening from the three</p>



<p class="wp-block-paragraph">node outwards or just to every other node so the three node itself I&#8217;m going to look at its</p>



<p class="wp-block-paragraph">connections from left to right so the three node let&#8217;s just start by putting a three here</p>



<p class="wp-block-paragraph">maybe I should describe the legend real fast the tuples will basically be the start node</p>



<p class="wp-block-paragraph">and then the end node</p>



<p class="wp-block-paragraph">and then the end node and then the uh well the weight if there was a weight but we&#8217;re doing an</p>



<p class="wp-block-paragraph">unweighted graph so it&#8217;s really just going to be a tuple of two items the other thing to keep</p>



<p class="wp-block-paragraph">in mind is that because this is an undirected graph it really doesn&#8217;t make a difference what</p>



<p class="wp-block-paragraph">node is the start node and what node is the end node you can just swap them and it&#8217;s totally fine</p>



<p class="wp-block-paragraph">for me personally i&#8217;d rather you know sort before assigning the start node and end node that way</p>



<p class="wp-block-paragraph">when i read the graph later it&#8217;s a little bit faster because i wouldn&#8217;t have to check in both</p>



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



<p class="wp-block-paragraph">wouldn&#8217;t have to check in both directions but it really honestly doesn&#8217;t matter right now so</p>



<p class="wp-block-paragraph">start node and end node so the start node here is 3 and the end node is going to be 13 so that&#8217;s the</p>



<p class="wp-block-paragraph">first thing that we&#8217;re doing that&#8217;s the first tuple and then i&#8217;m going to say what else does</p>



<p class="wp-block-paragraph">the 3 connect to it connects to the not the 6 it connects to the 12. okay so the 3 connects to the</p>



<ol start="12" class="wp-block-list">
<li>again we could have said 12 comma 3 wouldn&#8217;t have mattered but i&#8217;m just going to try to keep</li>
</ol>



<p class="wp-block-paragraph">it sorted so then</p>



<p class="wp-block-paragraph">keep it sorted so then what else does the three connect to it connects to the uh the 18 doesn&#8217;t</p>



<p class="wp-block-paragraph">connect to the 15 and just confirm that if i&#8217;m looking at the three i can see three lines</p>



<p class="wp-block-paragraph">touching it so that means okay there&#8217;s got to be three tuples for the for the e for the three so</p>



<p class="wp-block-paragraph">i&#8217;m going to say three connects to the 18. and now i&#8217;ve described everything happened to do with the</p>



<p class="wp-block-paragraph">three note i will simply continue let&#8217;s see should i do like a new line maybe i should try to do a</p>



<p class="wp-block-paragraph">new line for every</p>



<p class="wp-block-paragraph">try to do a new line for every start node so this is easier to look at okay so i&#8217;m going to do that</p>



<p class="wp-block-paragraph">and i&#8217;m going to say the next line is we&#8217;ll start at the 13 this time so the 13 the 13 is also</p>



<p class="wp-block-paragraph">connected to the 3 because it goes in both directions with an undirected graph but we</p>



<p class="wp-block-paragraph">already described that connection with that first row so 3 comma 13 describes 13 comma 3 i don&#8217;t</p>



<p class="wp-block-paragraph">want to duplicate edges so forget about that let&#8217;s look at what else 13 is connected to it&#8217;s connected</p>



<p class="wp-block-paragraph">it to the six</p>



<p class="wp-block-paragraph">connected to it&#8217;s connected to the six so I&#8217;m just going to put 13 comma 6 and then that&#8217;s the end of</p>



<p class="wp-block-paragraph">the 13&#8217;s connections oh I could have used tabs for that hang on let me do that okay so now let&#8217;s look</p>



<p class="wp-block-paragraph">at the six node six is not connected to the three it is connected to the 13 but we already described</p>



<p class="wp-block-paragraph">the 13 6 connection in the previous row so forget that and then I&#8217;m just going to look to the right</p>



<p class="wp-block-paragraph">So the 6 is connected to the 12 and the 15.</p>



<p class="wp-block-paragraph">the 12 and the 15 12 and the 15 and also the 18 so i&#8217;m going to do 6 comma 12 maybe i&#8217;m going to</p>



<p class="wp-block-paragraph">do a copy paste here real fast just to make it easier 6 12 and 6 15 and 6 18 so again all i&#8217;m</p>



<p class="wp-block-paragraph">doing is describing you know what other nodes the current node is touching and i&#8217;m going to do that</p>



<p class="wp-block-paragraph">using a tuple that just has one node and has another node and that&#8217;s pretty much it so when</p>



<p class="wp-block-paragraph">we&#8217;re done with this</p>



<p class="wp-block-paragraph">it so when we&#8217;re done with this uh we&#8217;re going to look at the 12 node 12 node it&#8217;s connected to</p>



<p class="wp-block-paragraph">the six already handled it&#8217;s connected to the three it&#8217;s already handled and it&#8217;s connected</p>



<p class="wp-block-paragraph">to the 18 not handled yet so i&#8217;m going to say 12 goes out to 18. okay then we&#8217;re going to look at</p>



<p class="wp-block-paragraph">the 15 node 15 and 6 that&#8217;s already handled in that third row so forget that 15 and 18 that is</p>



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



<p class="wp-block-paragraph">15 and 18 that is not handled yet so we&#8217;re going to do 15.18 by the way this is one benefit of</p>



<p class="wp-block-paragraph">going from left to right visually all i really have to do is just look my eyes to the right and</p>



<p class="wp-block-paragraph">i&#8217;ll see nodes that i need to take care of and if i look my eyes to the left i&#8217;ll see nodes that i</p>



<p class="wp-block-paragraph">already took care of if that makes sense so now that we&#8217;re done with the 15 let&#8217;s see we did 3 13</p>



<p class="wp-block-paragraph">6 12 15 let&#8217;s just take care of the 18 if there&#8217;s anything left to take care of i can guarantee</p>



<p class="wp-block-paragraph">there&#8217;s not going to be.</p>



<p class="wp-block-paragraph">there&#8217;s not going to be because every node the 18 is the node on the farthest you know the furthest</p>



<p class="wp-block-paragraph">to the right so everything on the left is already handled so we don&#8217;t even have to put anything for</p>



<p class="wp-block-paragraph">the 18 node okay give me a second to clean up this graph real fast i think i want to maybe</p>



<p class="wp-block-paragraph">move this up a little bit okay uh now here&#8217;s the thing though we&#8217;ve only named node values so if</p>



<p class="wp-block-paragraph">we wanted to i don&#8217;t know let&#8217;s say check to see if the uh let&#8217;s say we have an edge we&#8217;re looking</p>



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



<p class="wp-block-paragraph">let&#8217;s say we have an edge we&#8217;re looking at the 3 comma 13 edge and we&#8217;re asking now do both of</p>



<p class="wp-block-paragraph">those nodes exist the edge describes these two nodes do they exist or uh maybe let&#8217;s look at</p>



<p class="wp-block-paragraph">the three here and we want to figure out just you know what other nodes does three touch so we start</p>



<p class="wp-block-paragraph">iterating through all the edges here how can we actually get a pointer to that node to manipulate</p>



<p class="wp-block-paragraph">it in the code right now it&#8217;s okay because it&#8217;s a diagram but you know this is not very</p>



<p class="wp-block-paragraph">diagram but you know this is not very good storing values directly in this notation in your code you</p>



<p class="wp-block-paragraph">probably want to store pointer uh pointers there but maybe not necessarily smart pointers they take</p>



<p class="wp-block-paragraph">a little bit of extra memory and it&#8217;s kind of cumbersome but um we could store an index into</p>



<p class="wp-block-paragraph">this vertex list to make things a little bit faster let me show you what i mean but first i&#8217;m</p>



<p class="wp-block-paragraph">going to duplicate this list that we just made already, duplicate it over here, and</p>



<p class="wp-block-paragraph">over here and maybe i&#8217;ll label the first one and i&#8217;ll say so we already have start node and end</p>



<p class="wp-block-paragraph">node i&#8217;m going to say e underscore by value so we&#8217;re storing the edge list by node values and</p>



<p class="wp-block-paragraph">then here we&#8217;re going to store nodes by their index in the vertex list so what do i mean by</p>



<p class="wp-block-paragraph">index well okay right here the first node that we&#8217;re mentioning is the three well look at the</p>



<p class="wp-block-paragraph">three node in the vertex list it&#8217;s at index zero right so i&#8217;m just going to put a zero</p>



<p class="wp-block-paragraph">zero right so i&#8217;m just gonna put a zero that&#8217;s it change it to an index then i look at the 13</p>



<p class="wp-block-paragraph">that&#8217;s index one and then i look at the three again that&#8217;s index zero um and then the 12 is</p>



<p class="wp-block-paragraph">index three and then the three again is index zero and the 18 is index five um if that was too fast</p>



<p class="wp-block-paragraph">i&#8217;m sorry just rewind and play it back in slow motion i think this video is already getting way</p>



<p class="wp-block-paragraph">too long so then i do the same thing for every single other tuple so the 13 node um that is</p>



<p class="wp-block-paragraph">node um that is index one so i&#8217;m going to put a one there the sixth node is index two go on to</p>



<p class="wp-block-paragraph">the next node so the sixth node is index two and then the 12 is index three and the six is two and</p>



<p class="wp-block-paragraph">the 15 is actually four the six again is two the 18 is five move on to the 12 node here uh that&#8217;s</p>



<p class="wp-block-paragraph">index 3, 18 node is index 5, and then</p>



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



<p class="wp-block-paragraph">and then uh the 15 is index 4 and then 18 again is index 5 so now on you know on both sides like</p>



<p class="wp-block-paragraph">in both of these edge lists uh i&#8217;m representing the graph it&#8217;s just that one can be a little bit</p>



<p class="wp-block-paragraph">more efficient than the other uh for example if i was going to let&#8217;s just say i wanted to scan</p>



<p class="wp-block-paragraph">every single edge in the graph well i could scan this list right here in linear time so linear time</p>



<p class="wp-block-paragraph">based on the number of edges and every single time i see an edge i can jump directly to the</p>



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



<p class="wp-block-paragraph">jump directly to the corresponding vertex or node in constant time because i have an index</p>



<p class="wp-block-paragraph">so for example let&#8217;s say uh you know this uh the sixth node um touching the 15 node so that</p>



<p class="wp-block-paragraph">particular edge right there let me i want to be more interactive here how can i do this okay</p>



<p class="wp-block-paragraph">uh suppose i want to do</p>



<p class="wp-block-paragraph">612 node and so that&#8217;s going to be pointing to this edge right up here i want to see you know</p>



<p class="wp-block-paragraph">what&#8217;s going on with both of those nodes well if i was looking at the value-based edge list</p>



<p class="wp-block-paragraph">and i wanted to get a hold of let&#8217;s say the sixth node itself so i can like do something with that</p>



<p class="wp-block-paragraph">vertex like delete it or move it or just whatever i would have to then scan the entire vertex list</p>



<p class="wp-block-paragraph">i&#8217;d have to go you know this one this one this one this one this one until i eventually found</p>



<p class="wp-block-paragraph">the corresponding value.</p>



<p class="wp-block-paragraph">uh the corresponding value this wouldn&#8217;t really support duplicate values either</p>



<p class="wp-block-paragraph">uh it would be kind of hard to do that but uh i&#8217;ve i&#8217;ve slowed down the program it&#8217;s linear</p>



<p class="wp-block-paragraph">time based on the number of vertexes and if you&#8217;re already doing linear time based on the number of</p>



<p class="wp-block-paragraph">edges this is like it&#8217;s technically still a scalable data structure but it&#8217;s not super fast</p>



<p class="wp-block-paragraph">it could be faster on the other hand uh so like i just said uh sorry for repeating myself if we did</p>



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



<p class="wp-block-paragraph">the index based uh edge list it says two three here which is the 612 how can i find the sixth</p>



<p class="wp-block-paragraph">node well i just look at index two and instead of scanning oh gosh hang on</p>



<p class="wp-block-paragraph">i&#8217;m not as fast as i used to be okay dude there&#8217;s like did you see that uh</p>



<p class="wp-block-paragraph">a whole bunch of pink dots everywhere now what have i done okay</p>



<p class="wp-block-paragraph">So, uh…</p>



<p class="wp-block-paragraph">so uh i&#8217;m looking at the 612 edge i see that the indexes are two and three that means in constant</p>



<p class="wp-block-paragraph">time i can just jump directly to i guess i&#8217;ll put it in red in constant time index two right there</p>



<p class="wp-block-paragraph">and index three right there i do not have to scan the vertex list or the vector i guess if it was a</p>



<p class="wp-block-paragraph">vertex list like an actual linked list then i&#8217;d still have to scan because it&#8217;s linear time to do</p>



<p class="wp-block-paragraph">it but if it&#8217;s a vector</p>



<p class="wp-block-paragraph">But if it&#8217;s a vector or an array, I can just jump to an index in constant time, so it&#8217;s way faster.</p>



<p class="wp-block-paragraph">So what I&#8217;m trying to say is that this representation is what you want to do in the code when it comes to, I don&#8217;t know, representing diagrams and stuff.</p>



<p class="wp-block-paragraph">I don&#8217;t know. The one on the left is more human friendly.</p>



<p class="wp-block-paragraph">So this is the basic idea for how to represent an unweighted and also undirected graph in the machine using the edge list method of representation.</p>



<p class="wp-block-paragraph">i guess i&#8217;m going to cut the video i hope you learned a little bit of stuff and had</p>



<p class="wp-block-paragraph">a little bit of fun in the next video i think i&#8217;m going to do uh weighted uh undirected graphs</p>



<p class="wp-block-paragraph">and this i&#8217;m going to do four videos for this one representation type i&#8217;m going to do unweighted</p>



<p class="wp-block-paragraph">undirected and then weighted and undirected and then unweighted and directed i&#8217;m gonna</p>



<p class="wp-block-paragraph">do all four combinations all right see you in the next video thanks for watching</p>



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



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



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



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



<p class="wp-block-paragraph">world to me and it&#8217;ll help make more videos and grow this community so we&#8217;ll be able to do more</p>



<p class="wp-block-paragraph">videos, longer videos, better videos, or just I&#8217;ll be able to keep making videos in general.</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 and uh and subscribe</p>



<p class="wp-block-paragraph">you know sometimes i&#8217;m sleeping in the middle of the night and i just wake up because i know</p>



<p class="wp-block-paragraph">somebody subscribed or followed it just wakes me up and i get filled with joy that&#8217;s exactly what</p>



<p class="wp-block-paragraph">happens every single time so you could do it as a nice favor to me or you could you could troll me</p>



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



<p class="wp-block-paragraph">wake up i promise that&#8217;s what will happen also uh if you look at the middle of the screen right now</p>



<p class="wp-block-paragraph">you should see a QR code, which</p>



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



<p class="wp-block-paragraph">I think is also named somewhere at the bottom of this video and it&#8217;ll take you to my main website</p>



<p class="wp-block-paragraph">where you can just kind of like see all the videos I published and the services and tutorials and</p>



<p class="wp-block-paragraph">things that I offer and all that good stuff and if you have a suggestion for clarifications or</p>



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



<p class="wp-block-paragraph">hey what&#8217;s up what&#8217;s going on you know just send</p>



<p class="wp-block-paragraph">what&#8217;s going on? You know, just send me a comment, whatever. I also wake up for those in the middle</p>



<p class="wp-block-paragraph">of the night. I get, I wake up in a cold sweat and I&#8217;m like, it would really, it really mean</p>



<p class="wp-block-paragraph">the world to me. I would really appreciate it. So again, thank you so much for watching this video</p>



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



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



<p class="wp-block-paragraph">Thanks for watching!</p>
<p>The post <a href="https://www.NeuralLantern.com/how-to-represent-an-unweighted-undirected-graph-with-an-edge-list/">How to Represent an Unweighted Undirected Graph with an Edge List</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.NeuralLantern.com/how-to-represent-an-unweighted-undirected-graph-with-an-edge-list/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
